From be3b255bbe328d793ff20011683dca5aee1668a1 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期三, 23 七月 2025 09:05:29 +0800
Subject: [PATCH] 20250722 川印系统客户访问增加长度,增加附件何查看  20250721  川印系统修改 完成

---
 CY_ECommercePlatform/CY.WebForm/Pages/business/CorporateClientsVisit.aspx.cs |  352 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 351 insertions(+), 1 deletions(-)

diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/business/CorporateClientsVisit.aspx.cs b/CY_ECommercePlatform/CY.WebForm/Pages/business/CorporateClientsVisit.aspx.cs
index 3018f45..20d0954 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/business/CorporateClientsVisit.aspx.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/business/CorporateClientsVisit.aspx.cs
@@ -10,6 +10,10 @@
 using CY.Infrastructure.Common;
 using CY.BLL.Sys;
 using CY.Model.Inquiry;
+using CY.SQLDAL;
+using System.Data.SqlClient;
+using CY.Infrastructure.Logging;
+using CY.WebForm.Helper;
 
 namespace CY.WebForm.Pages.business
 {
@@ -18,7 +22,19 @@
         OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null;
         Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;//瀛楀吀涓氬姟閫昏緫鎿嶄綔绫诲璞�
         SysInquiry_PrintingTypeBLL bll_SysInquiry_PrintingTypeBLL = null;//鍗板埛涓氬姟绫诲瀷涓氬姟閫昏緫鎿嶄綔绫诲璞�
+        /// <summary>
+        /// 鏄惁闇�瑕佽妭鍋囨棩缁存姢
+        /// </summary>
+        public bool IsNeedJiejiaRi { get; set; }
+        /// <summary>
+        /// 鏄惁闇�瑕佺淮鎶�
+        /// </summary>
+        public bool NeedWeihu { get; set; }
 
+        /// <summary>
+        /// 鍚堜綔瀹㈡埛渚嬪瓙
+        /// </summary>
+        public OA_CorporateClients client { get; set; }
         //鍒濆鍖�
         public CorporateClientsVisit()
         {
@@ -26,7 +42,10 @@
             bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
             bll_SysInquiry_PrintingTypeBLL = new SysInquiry_PrintingTypeBLL();
         }
-
+        /// <summary>
+        /// 鏄惁鏃剁淮鎶ゆ彁閱掍紶杩囨潵鐨�
+        /// </summary>
+        public bool IsWeihuTixingUrl { get; set; } = false;
         //椤甸潰鍔犺浇
         protected void Page_Load(object sender, EventArgs e)
         {
@@ -37,10 +56,341 @@
                 this.spanCompanyName.InnerText = m_OA_CorporateClients.CompanyName;
                 this.spanBusinessManagerId.InnerText = m_OA_CorporateClients.BusinessmanagerName;
                 this.spanprintdate.InnerText = DateTime.Now.ToString("yyyy-MM-dd");
+                client = bll_OA_CorporateClientsBLL.GetModel(Request["Keyid"].ToGuid2());
+                IsNeedJiejiaRi = client.JieJiaRiWiHu==true;
+                NeedWeihu = client.NeedWiHu == true;
+                this.RepClientList.DataSource = bll_OA_CorporateClientsBLL.SelectVisitListByCorId(Request["Keyid"].ToGuid2());
 
+                this.RepClientList.DataBind();
+                if (IsNeedJiejiaRi)
+                    this.btn_Submit.Enabled = true;
+                else
+                    this.btn_Submit.Enabled = false;
+
+
+                //鍒ゅ喅鏄惁鏄妭鍋囨棩缁存姢寮圭獥 杩欎釜寮圭獥娣诲姞缁存姢璁板綍鍚庝細鍏抽棴绐楀彛
+                var x = Request["JIeriCount"];
+                if (x != "undefined"&&x!=null)
+                {
+                    this.Button1.Enabled = false;
+                    this.txtvisitRemark.Value = x;
+                }
+
+                this.txtVisitTime.Value = DateTime.Now.ToString("yyyy-MM-dd");
+                //鍒ゅ喅鏄惁鏄彁閱掑脊绐�  杩欎釜寮圭獥娣诲姞缁存姢璁板綍鍚庝細鍏抽棴绐楀彛
+                var y = Request["tixingweihu"];
+                if ( y != null&& y=="1")
+                {
+                    IsWeihuTixingUrl = true;
+                }
+
+
+            }
+
+
+        }
+        //瀹岀粨浜嬩欢
+        protected void btn_Submit_Visit(object sender, EventArgs e)
+        {
+            OA_CorporateClientsVisit m_OA_CorporateClientsVisit = new OA_CorporateClientsVisit();
+
+          
+            try
+            {
+                Guid Keyid = Request["Keyid"].ToGuid2();
+
+
+
+
+                if (Request["Keyid"] != null)
+                {
+
+
+                }
+                else
+                {
+                    JavaScript.MessageBox("璇峰厛淇濆瓨瀹㈡埛", this);
+                    return;
+                }
+
+                if (this.txtVisitTime.Value == "")
+                {
+                    JavaScript.MessageBox("璇烽�夋嫨鏃ユ湡", this);
+                    return;
+
+                }
+                if (this.txtVisitTime.Value == "")
+                {
+                    JavaScript.MessageBox("璇峰~鍐欑淮鎶よ褰�", this);
+                    return;
+
+                }
+                if (this.txtvisitRemark.Value.Trim() == "")
+                {
+                    JavaScript.MessageBox("璇峰~鍐欑淮鎶よ褰�", this);
+                    return;
+
+                }
+
+                var files = Request.Files;
+                List<HttpPostedFile> fileList = new List<HttpPostedFile>();
+                if (files.Count > 0)
+                {
+                    HttpPostedFile postedFile;
+                  
+
+
+                    for (int i = 0; i < files.Count; i++)
+                    {
+
+                        if (files.Keys[i] == "filesel")
+                        {
+                            postedFile = files[i];
+                            if (postedFile.ContentLength == 0)
+                                continue;
+                            if (postedFile.ContentLength > 2 * 1024 * 1024)
+                            {
+                                JavaScript.MessageBox("涓婁紶鏂囦欢澶у皬蹇呴』灏忎簬2M", this);
+                                return;
+                            }
+                                                                          
+
+                            
+                            fileList.Add(postedFile);
+                        }
+
+                    }
+                }
+               
+
+                  
+               
+
+
+
+               
+
+
+
+                m_OA_CorporateClientsVisit.Keyid = Guid.NewGuid();
+
+
+                m_OA_CorporateClientsVisit.CorporateClientsid = Keyid;
+
+                m_OA_CorporateClientsVisit.VisitTime = this.txtVisitTime.Value.ToDateTime2();
+
+                m_OA_CorporateClientsVisit.Remark = this.txtvisitRemark.Value.Trim();
+                m_OA_CorporateClientsVisit.Creater = CurrentUser.TrueMemberId;
+                m_OA_CorporateClientsVisit.CreateTime = DateTime.Now;
+                m_OA_CorporateClientsVisit.Updater = CurrentUser.TrueMemberId;
+                m_OA_CorporateClientsVisit.LastUpdateTime = DateTime.Now;
+
+
+                #region 娣诲姞鎴栫紪杈�
+
+
+                bool result = bll_OA_CorporateClientsBLL.InsertModelVisit(m_OA_CorporateClientsVisit);//鏇存柊淇℃伅
+
+                if (result)
+                {
+                    if (fileList.Count > 0)
+                    {
+                        upLoadContractFile uploadContract = new upLoadContractFile();
+                        foreach (var file in fileList)
+                        {
+                            var re = uploadContract.UploadFile(file, "ClientVisit", file.FileName);
+                            var oa_Attachment = new OA_attachment();
+                            oa_Attachment.OA_Id = m_OA_CorporateClientsVisit.Keyid;
+                            oa_Attachment.AttachmentType = 99;
+                            oa_Attachment.PlanAttachment = re;
+                            oa_Attachment.CreateTime = DateTime.Now;
+                            oa_Attachment.Operator = CurrentUser.TrueName;
+                            oa_Attachment.AttachmentName = file.FileName;
+                            oa_Attachment.AttachmentHouzhui = System.IO.Path.GetExtension(file.FileName).ToLower();
+                            bll_OA_CorporateClientsBLL.Insertattachment(oa_Attachment);
+                        }
+                    }
+                    this.txtVisitTime.Value = "";
+                    this.txtvisitRemark.Value = "";
+                    // JavaScript.MessageBox("缁存姢淇濆瓨鎴愬姛", this, false, false);
+                    JavaScript.MessageBoxandhideLoadingIndicator("淇濆瓨鎴愬姛", this);
+                    if (NeedWeihu)
+                    {
+
+                        Database DC = new Database();
+                        string sqlStr = string.Format("  UPDATE[dbo].[OA_CorporateClients] SET [NeedWiHu] = 'false' where Keyid='{0}'", Request["Keyid"]);
+
+                        try
+                        {
+                            SqlCommand myCmd = new SqlCommand(sqlStr, DC.Connection);
+                            //SqlDataAdapter myDa = new SqlDataAdapter(myCmd);
+                            int a = myCmd.ExecuteNonQuery();
+                            //myDa.Dispose();                  
+
+
+                        }
+                        catch (Exception ee)
+                        {
+                            new Log4NetAdapter().Log("涓鑺傛彁閱掗敊璇� 閿欒锛�" + ee.Message);
+                            this.txtVisitTime.Value = "";
+                            this.txtvisitRemark.Value = "";
+                            JavaScript.MessageBox("娓呴櫎缁存姢鏍囧織澶辫触", this, false, false);
+
+                        }
+                        finally
+                        {
+                            if (DC.Connection.State != System.Data.ConnectionState.Closed)
+                                DC.Connection.Close();
+                        }
+
+
+                       
+                    }
+
+
+
+                }
+
+                else
+                    JavaScript.MessageBox("缁存姢淇濆瓨澶辫触", this);
                 this.RepClientList.DataSource = bll_OA_CorporateClientsBLL.SelectVisitListByCorId(Request["Keyid"].ToGuid2());
                 this.RepClientList.DataBind();
+                if (IsWeihuTixingUrl)
+                    JavaScript.RefreshDIVOpener(this);
+                #endregion
+
+
+            }
+            catch (Exception ex)
+            {
+                PAGEHandleException(ex);
+                JavaScript.MessageBox("鎿嶄綔澶辫触", this);
+                if (IsWeihuTixingUrl)
+                    JavaScript.RefreshDIVOpener(this);
+            }
+        }
+
+        protected void btn_Submit_Visit_jiari(object sender, EventArgs e)
+        {
+
+           
+            OA_CorporateClientsVisit m_OA_CorporateClientsVisit = new OA_CorporateClientsVisit();
+
+
+            try
+            {
+                Guid Keyid = Request["Keyid"].ToGuid2();
+
+
+
+
+                if (Request["Keyid"] != null)
+                {
+
+
+                }
+                else
+                {
+                    JavaScript.MessageBox("璇峰厛淇濆瓨瀹㈡埛", this);
+                }
+
+                if (this.txtVisitTime.Value == "")
+                {
+                    JavaScript.MessageBox("璇烽�夋嫨鏃ユ湡", this);
+
+                }
+                if (this.txtVisitTime.Value == "")
+                {
+                    JavaScript.MessageBox("璇峰~鍐欑淮鎶よ褰�", this);
+
+                }
+
+                m_OA_CorporateClientsVisit.Keyid = Guid.NewGuid();
+
+
+                m_OA_CorporateClientsVisit.CorporateClientsid = Keyid;
+
+                m_OA_CorporateClientsVisit.VisitTime = this.txtVisitTime.Value.ToDateTime2();
+
+                m_OA_CorporateClientsVisit.Remark = this.txtvisitRemark.Value.ToString2();
+                m_OA_CorporateClientsVisit.Creater = CurrentUser.TrueMemberId;
+                m_OA_CorporateClientsVisit.CreateTime = DateTime.Now;
+                m_OA_CorporateClientsVisit.Updater = CurrentUser.TrueMemberId;
+                m_OA_CorporateClientsVisit.LastUpdateTime = DateTime.Now;
+
+
+                #region 娣诲姞鎴栫紪杈�
+
+
+                bool result = bll_OA_CorporateClientsBLL.InsertModelVisit(m_OA_CorporateClientsVisit);//鏇存柊淇℃伅
+
+                if (result)
+                {
+                    //this.RepClientList.DataSource = bll_OA_CorporateClientsBLL.SelectVisitListByCorId(Keyid);
+                    //this.RepClientList.DataBind();
+                    this.txtVisitTime.Value = "";
+                    this.txtvisitRemark.Value = "";
+                    JavaScript.MessageBox("缁存姢淇濆瓨鎴愬姛", this, false, false);
+                    if (IsNeedJiejiaRi)
+                    {
+
+                        Database DC = new Database();
+                      
+                        string sqlStr = string.Format("   UPDATE[dbo].[OA_CorporateClients] SET [JieJiaRiWiHu] = 'false' where Keyid='{0}'", Request["Keyid"]);
+
+                        try
+                        {
+                            SqlCommand myCmd = new SqlCommand(sqlStr, DC.Connection);
+                            //SqlDataAdapter myDa = new SqlDataAdapter(myCmd);
+                            int a = myCmd.ExecuteNonQuery();
+                            //myDa.Dispose();                  
+
+
+                        }
+                        catch (Exception ee)
+                        {
+                            new Log4NetAdapter().Log("鑺傚亣鏃ユ竻闄ゆ爣蹇� 閿欒锛�" + ee.Message);
+                            this.txtVisitTime.Value = "";
+                            this.txtvisitRemark.Value = "";
+                            JavaScript.MessageBox("娓呴櫎缁存姢鏍囧織澶辫触", this, false, false);
+
+                        }
+                        finally
+                        {
+                            if (DC.Connection.State != System.Data.ConnectionState.Closed)
+                                DC.Connection.Close();
+                        }
+
+
+
+                    }
+
+
+
+                }
+
+                else
+                    JavaScript.MessageBox("缁存姢淇濆瓨澶辫触", this);
+                this.RepClientList.DataSource = bll_OA_CorporateClientsBLL.SelectVisitListByCorId(Request["Keyid"].ToGuid2());
+                this.RepClientList.DataBind();
+                JavaScript.MessageBox("缁存姢瀹屾垚", this);
+                //Province = CurrentUser.Province;
+                //City = CurrentUser.City;
+                //County = CurrentUser.County;
+                //BindData();
                 
+              if(IsWeihuTixingUrl)
+                JavaScript.RefreshDIVOpener(this);
+                #endregion
+
+
+            }
+            catch (Exception ex)
+            {
+                PAGEHandleException(ex);
+                JavaScript.MessageBox("鎿嶄綔澶辫触", this);
+                if (IsWeihuTixingUrl)
+                    JavaScript.RefreshDIVOpener(this);
             }
         }
     }

--
Gitblit v1.9.1