CB2-20200827ONU\Administrator
2021-09-22 4d584101e46ff34b2694e88af706b9b2e92364bc
CY_ECommercePlatform/CY.WebForm/Pages/business/CorporateClientsEdit.aspx.cs
@@ -29,6 +29,12 @@
        public string Targetid = ""; //收货方式目标值
        public string Shifouwanjie = "";  //完结状态
        public string CorporateClientsid = "";
        public string strNewKeyid = "";
        /// <summary>
        /// 在新建时,保存或者是处理附件时先要生成这个Guid
        /// </summary>
        public Guid NewKeyid{ get; set; }
        //初始化
        public AddCorporateClients()
        {
@@ -45,6 +51,9 @@
            try
            {
                GetKeyID();
                this.saveKey.Value = NewKeyid.ToString();
                Targetid = Request["Keyid"].ToString2();
                CorporateClientsid = Targetid;
                switch (Request["datatype"].ToString2())
@@ -71,6 +80,7 @@
                Response.Write("-1");
            }
            Response.End();
        }
        //提交事件
@@ -82,7 +92,26 @@
            try
            {
                Guid Keyid = Request["Keyid"].ToGuid2();
                //var files = Request.Files;
                //for (int iFile = 0; iFile < files.Count; iFile++)
                //{
                //    ///'检查文件扩展名字
                //    HttpPostedFile postedFile = files[iFile];
                //    string fileName, fileExtension;
                //    fileName = System.IO.Path.GetFileName(postedFile.FileName);
                //    if (fileName != "")
                //    {
                //        fileExtension = System.IO.Path.GetExtension(fileName);
                //        //strMsg.Append("上传的文件类型:" + postedFile.ContentType.ToString() + "<br>");
                //        //strMsg.Append("客户端文件地址:" + postedFile.FileName + "<br>");
                //        //strMsg.Append("上传文件的文件名:" + fileName + "<br>");
                //        //strMsg.Append("上传文件的扩展名:" + fileExtension + "<br><hr>");
                //        ///'可根据扩展名字的不同保存到不同的文件夹
                //        ///注意:可能要修改你的文件夹的匿名写入权限。
                //        postedFile.SaveAs(System.Web.HttpContext.Current.Request.MapPath("images/") + fileName);
                //    }
                //}
                    Guid Keyid = Request["Keyid"].ToGuid2();
                bool isExit = bll_OA_CorporateClientsBLL.isExistCompanyName(this.txtCompanyName.Value.ToString2(), CurrentUser.MemberId, Keyid);
                if (!isExit)
                {
@@ -106,7 +135,7 @@
                        }
                        #region 初始合作客户基础信息
                        m_OA_CorporateClients.CompanyName = this.txtCompanyName.Value.ToString2();
                        m_OA_CorporateClients.CompanyName = this.txtCompanyName.Value.ToString2();
                        m_OA_CorporateClients.CustomerIndustriesId = this.selCustomerIndustriesId.Value.ToInt32() ?? 0;
                        m_OA_CorporateClients.CustomerTypeId = this.selCustomerTypeId.Value.ToInt32() ?? 0;
                        m_OA_CorporateClients.SourcesInfoId = this.selSourcesInfoId.Value.ToInt32() ?? 0;
@@ -232,6 +261,7 @@
                                JavaScript.MessageBox("更新成功", this, true, true);
                            else
                                JavaScript.MessageBox("更新失败", this);
                        }
                        else
                        {
@@ -242,7 +272,7 @@
                            m_OA_CorporateClients.IsPriority = false;
                            m_OA_CorporateClients.CumulativePrepayments = 0;
                            m_OA_CorporateClients.Keyid = Guid.NewGuid();
                            m_OA_CorporateClients.Keyid = new Guid( this.saveKey.Value);// Guid.NewGuid();//GetKeyID();
                            m_OA_CorporateClients.CreateTime = DateTime.Now;
                            m_OA_CorporateClients.CustomerId = bll_OA_CorporateClientsBLL.GetLastIdByFirmId(CurrentUser.MemberId) + 1;
                            m_OA_CorporateClients.FirmId = CurrentUser.MemberId;
@@ -331,7 +361,6 @@
                                JavaScript.MessageBox("完结成功", this, true, true);
                            else
                                JavaScript.MessageBox("完结失败", this);
                    
                        #endregion
                
@@ -345,85 +374,85 @@
        }
        //完结事件
        protected void btn_Submit_Visit(object sender, EventArgs e)
        {
            OA_CorporateClientsVisit m_OA_CorporateClientsVisit = new OA_CorporateClientsVisit();
        ////完结事件
        //protected void btn_Submit_Visit(object sender, EventArgs e)
        //{
        //    OA_CorporateClientsVisit m_OA_CorporateClientsVisit = new OA_CorporateClientsVisit();
            try
            {
                Guid Keyid = Request["Keyid"].ToGuid2();
        //    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();
        //        if (Request["Keyid"] != null)
        //        {
                m_OA_CorporateClientsVisit.CorporateClientsid = Keyid;
        //        }
        //        else
        //        {
        //            JavaScript.MessageBox("请先保存客户", this);
        //        }
                m_OA_CorporateClientsVisit.VisitTime = this.txtVisitTime.Value.ToDateTime2();
        //        if (this.txtVisitTime.Value == "")
        //        {
        //            JavaScript.MessageBox("请选择日期", this);
                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;
        //        }
        //        if (this.txtVisitTime.Value == "")
        //        {
        //            JavaScript.MessageBox("请填写维护记录", this);
        //        }
        //        m_OA_CorporateClientsVisit.Keyid = Guid.NewGuid();
                #region 添加或编辑
        //        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;
                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);
                }
                else
                    JavaScript.MessageBox("维护保存失败", this);
                Province = CurrentUser.Province;
                City = CurrentUser.City;
                County = CurrentUser.County;
                BindData();
                #endregion
        //        #region 添加或编辑
            }
            catch (Exception ex)
            {
                PAGEHandleException(ex);
                JavaScript.MessageBox("操作失败", this);
            }
        }
        //        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);
        //        }
        //        else
        //            JavaScript.MessageBox("维护保存失败", this);
        //        Province = CurrentUser.Province;
        //        City = CurrentUser.City;
        //        County = CurrentUser.County;
        //        BindData();
        //        #endregion
        //    }
        //    catch (Exception ex)
        //    {
        //        PAGEHandleException(ex);
        //        JavaScript.MessageBox("操作失败", this);
        //    }
        //}
        //绑定数据
        protected void BindData()
@@ -676,9 +705,42 @@
                return ("[" + string.Join(",", modelArry) + "]");
            }
        }
        /// <summary>
        /// 获取Guid
        /// </summary>
        /// <returns></returns>
        public Guid GetKeyID()
        {
            if (NewKeyid != null && NewKeyid != new Guid("00000000-0000-0000-0000-000000000000"))
            {
                strNewKeyid = NewKeyid.ToString();
                return NewKeyid;
            }
            if (Request["Keyid"] != null)
            {
                NewKeyid = Request["Keyid"].ToGuid2();
                //  this.SaveNewKeyID.Value = NewKeyid.ToString();
                strNewKeyid = NewKeyid.ToString();
                return NewKeyid;
            }
            if (this.saveKey.Value == "")
            {
                NewKeyid = Guid.NewGuid();
                this.saveKey.Value = NewKeyid.ToString();
                return NewKeyid;
            }
            else
            {
                NewKeyid = new Guid(this.saveKey.Value);
                return NewKeyid;
            }
        }
        //CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult1 = CY.WebForm.cs.UploadCS.Upload(
        //提交事件
        protected void btn_SubmitClientsBiddingcompany_Config(object sender, EventArgs e)