void InitSourceData(ORD_PurchaseOrderResult orderResult) { if (orderResult != null) { txtPOGuid.Text = orderResult.POGuid.ToStringHasNull(); txtPOBillNo.Text = orderResult.BillNo; cboCurrency.SelectedValue = orderResult.Currency; txtPODate.Text = orderResult.PODate.ToStringHasNull(); decimal?totalAmount = 0.0m; List <STK_InLineResult> inLineList = inLineLogic.GetList(new STK_InLineParam() { SourceBillGuid = orderResult.POGuid }); foreach (STK_InLineResult inLineResult in inLineList) { ORD_PurchaseReturnLineResult returnListResult = new ORD_PurchaseReturnLineResult(); SetStkLineObjectValue(returnListResult, inLineResult); totalAmount += returnListResult.Amount; bsPurchaseReturnLine.Add(returnListResult); } totalAmount = Math.Round(totalAmount.ToDecimal(), 3, MidpointRounding.AwayFromZero); txtAmount.Text = totalAmount.ToStringHasNull(); CRM_CompanyResult companyResult = companyLogic.GetCustInfo(new CRM_CompanyParam() { CompanyID = orderResult.SupplierID.ToInt32() }); if (companyResult != null) { txtSupplierID.Text = companyResult.CompanyID.ToStringHasNull(); txtSupplierName.Text = companyResult.CompanyName; } } }
public CRM_CompanyResult GetSupInfo(CRM_CompanyParam param) { this.CheckSession(); CRM_CompanyResult rst = new CRM_CompanyResult(); #region 判断 if (param.CompanyID <= 0 && param.CompanyGuID == null) { throw new WarnException("请指定公司ID或者GUID!"); } #endregion #region 获取实体 WhereClip whereClip = WhereClip.All; if (param.CompanyID > 0) { whereClip = whereClip && CRM_Company._.CompanyID == param.CompanyID; } if (param.CompanyGuID != null) { whereClip = whereClip && CRM_Company._.CompanyGuID == param.CompanyGuID; } rst = this.Select <CRM_CompanyResult>(whereClip); if (rst != null) { rst.ContactList = this.SelectList <CRM_CompanyContactResult>(CRM_CompanyContact._.CompanyID == rst.CompanyID); } #endregion return(rst); }
public WCFAddUpdateResult DelSupInfo(CRM_CompanyParam param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); int affect = 0; try { #region 判断 if (param.CompanyID <= 0) { throw new WarnException("请指定要删除的公司ID!"); } #endregion WhereClip whereClip = GetSupWhereClip(param); CRM_CompanyResult info = new CRM_CompanyResult(); info.IsDeleted = true; affect = this.Update <CRM_CompanyResult>(info, whereClip); #region 设置返回值 ret.Key = affect; #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
public void InitData() { if (custVstPlnGuID != Guid.Empty) { CRM_VisitPlanResult planInfo = planLogic.GetInfo(new CRM_VisitPlanParam { CustVstPlnGuID = custVstPlnGuID }); this.ConvertEntityToControl <CRM_VisitPlanResult>(this.grpVisitPlan.Controls, planInfo, null); this.ConvertEntityToControl <CRM_VisitPlanResult>(this.grpVisitResult.Controls, planInfo, null); companyGuID = planInfo.CompanyGuID; } if (custVstPlnLineID > 0) { CRM_VisitPlanLineResult planLineInfo = planLineLogic.GetInfo(new CRM_VisitPlanLineParam { CustVstPlnLineID = custVstPlnLineID }); this.ConvertEntityToControl <CRM_VisitPlanLineResult>(this.grpVisitResult.Controls, planLineInfo, null); txtLineVstText.BodyInnerHTML = planLineInfo.VstText; companyGuID = planLineInfo.CompanyGuID; } else { txtRptEmpName.Text = this.SessionInfo.UserName; txtRptEmpID.Text = this.SessionInfo.UserID.ToStringHasNull(); txtVstDate.Text = ZNLCRM.UI.Logic.Sys.Common.GetServerNow(); txtVstName.Text = txtPlanName.Text; } if (companyGuID != Guid.Empty) { CRM_CompanyResult companyInfo = companyLogic.GetCustInfo(new CRM_CompanyParam { CompanyGuID = companyGuID }); this.ConvertEntityToControl <CRM_CompanyResult>(this.grpVisitResult.Controls, companyInfo, null); } }
public WCFAddUpdateResult AddOrUpdateSup(CRM_CompanyResult param) { WCFAddUpdateResult ret = new WCFAddUpdateResult(); ExeResult rst = new ExeResult(); rst = this.Execute("ZNLCRM.BLL.CRM.CRM_CompanyBLL", "AddOrUpdateSup", param); ret = (rst == null ? new WCFAddUpdateResult() : rst.Result as WCFAddUpdateResult); return(ret); }
public CRM_CompanyResult GetCustInfo(CRM_CompanyParam param) { CRM_CompanyResult ret = new CRM_CompanyResult(); ExeResult rst = new ExeResult(); rst = this.Execute("ZNLCRM.BLL.CRM.CRM_CompanyBLL", "GetCustInfo", param); ret = rst == null ? new CRM_CompanyResult() : rst.Result as CRM_CompanyResult; return(ret); }
object Form_GetEditEntity() { CRM_CompanyResult info = new CRM_CompanyResult(); info.CompanyID = companyID; info = this.ConvertControlToEntity <CRM_CompanyResult>(this.tpCompanyInfo.Controls, info, null); info = this.ConvertControlToEntity <CRM_CompanyResult>(this.tpFunnelInfo.Controls, info, null); info = this.ConvertControlToEntity <CRM_CompanyResult>(this.tpOtherContact.Controls, info, null); this.SetDataIsChanged <CRM_CompanyResult>(info); return(info); }
private bool SaveData(bool isAsyncExecute) { bool ret = false; ORD_PurchaseOrderResult info = Form_GetEditEntity() as ORD_PurchaseOrderResult; if (isAsyncExecute && !this.DataIsChanged) { this.ShowNoChangedMsg(); return(ret); } #region 异步执行保存操作 if (isAsyncExecute) { WCFAddUpdateResult result = this.AsyncExecute <WCFAddUpdateResult, ORD_PurchaseOrderResult>(info, orderLogic.AddOrUpdate, (a) => { if (a.KeyGuid.ToGuid() != Guid.Empty) { poid = a.Key; poguid = a.KeyGuid.ToGuid(); sourcebillno = a.BillNo; CRM_CompanyResult companyResult = companyLogic.GetCustInfo(new CRM_CompanyParam() { CompanyID = txtSupplierID.Text.ToInt32() }); if (companyResult != null) { companyResult.LastBusinessDate = txtPODate.Text.ToDateTime(); companyLogic.AddOrUpdateSup(companyResult); } if (SaveAttach != null) { SaveAttach("ORD_PurchaseOrder", poguid.ToGuid(), sourcebillno); } InitData(); delList.Clear(); } }); } #endregion #region 步执行保存操作 else { WCFAddUpdateResult result = orderLogic.AddOrUpdate(info); if (result.KeyGuid.ToGuid() != Guid.Empty) { ret = true; } } #endregion return(ret); }
private void tsbSave_Click(object sender, EventArgs e) { ORD_PurchaseReturnResult info = Form_GetEditEntity() as ORD_PurchaseReturnResult; if (!this.DataIsChanged) { this.ShowNoChangedMsg(); return; } bsPurchaseReturnLine.EndEdit(); tempList.Clear(); foreach (ORD_PurchaseReturnLineResult rst in addOrModifyList) { if (rst.HasChanged()) { tempList.Add(rst); } } //tempList.AddRange(addOrModifyList); tempList.AddRange(delList); info.ReturnLineList = tempList; WCFAddUpdateResult result = this.AsyncExecute <WCFAddUpdateResult, ORD_PurchaseReturnResult>(info, returnLogic.AddOrUpdate, (a) => { if (a.KeyGuid.ToGuid() != Guid.Empty) { PRGuid = a.KeyGuid.ToGuid(); CRM_CompanyResult companyResult = companyLogic.GetCustInfo(new CRM_CompanyParam() { CompanyID = txtSupplierID.Text.ToInt32() }); if (companyResult != null) { companyResult.LastBusinessDate = txtReturnDate.Text.ToDateTime(); companyLogic.AddOrUpdateSup(companyResult); } if (SaveAttach != null) { SaveAttach("ORD_PurchaseReturn", PRGuid.ToGuid(), a.BillNo); } InitData(); delList.Clear(); } }); }
/// <summary> /// 获取一条信息记录 /// </summary> /// <param name="param"></param> /// <returns></returns> public CRM_VisitPlanResult GetInfo(CRM_VisitPlanParam param) { this.CheckSession(); CRM_VisitPlanResult rst = new CRM_VisitPlanResult(); #region 判断 if (param.CustVstPlnID == null && param.CustVstPlnGuID == null) { throw new WarnException("请指定拜访计划主单ID或者GUID!"); } #endregion #region 保存实体 WhereClip where = GetWhereClip(param); rst = this.Select <CRM_VisitPlanResult>(where); if (rst.CompanyGuID != null) { CRM_CompanyBLL companyBLL = new CRM_CompanyBLL(); companyBLL.SessionInfo = this.SessionInfo; CRM_CompanyResult companyRst = companyBLL.GetCustInfo(new CRM_CompanyParam { CompanyGuID = rst.CompanyGuID }); if (companyRst != null) { rst.CrmCompany = companyRst; } CRM_VisitPlanLineBLL visitPlanLineBLL = new CRM_VisitPlanLineBLL(); visitPlanLineBLL.SessionInfo = this.SessionInfo; DateTime?lastVistTime = visitPlanLineBLL.GetLastVisitTime(new CRM_VisitPlanLineParam() { CustVstPlnGuID = rst.CustVstPlnGuID }); if (lastVistTime != null) { rst.LastVisitTime = lastVistTime.ToStringHasNull(); } rst.TotalVisitCount = visitPlanLineBLL.GetTotalVisitCount(new CRM_VisitPlanLineParam() { CustVstPlnGuID = rst.CustVstPlnGuID }); } //Sys_EmpDataRightBLL.SetRecIsEdit<CRM_VisitPlanResult>(rst, "BeLongEmpID", "", "OrgID", this.SessionInfo); #endregion return(rst); }
private void btnSave_Click(object sender, EventArgs e) { CRM_CompanyResult info = Form_GetEditEntity() as CRM_CompanyResult; if (!this.DataIsChanged) { this.ShowNoChangedMsg(); return; } bool flag = false; foreach (CRM_CompanyContactResult rst in addOrModifyList) { if (string.IsNullOrEmpty(rst.ContactName) || string.IsNullOrEmpty(rst.Telephone)) { flag = true; break; } } if (flag) { this.ShowMessage("联系人和联系电话不能为空!"); return; } bsContact.EndEdit(); tempList.Clear(); foreach (CRM_CompanyContactResult rst in addOrModifyList) { if (rst.HasChanged()) { tempList.Add(rst); } } tempList.AddRange(delList); info.ContactList = tempList; WCFAddUpdateResult result = this.AsyncExecute <WCFAddUpdateResult, CRM_CompanyResult>(info, companyLogic.AddOrUpdateSup, (a) => { companyID = a.Key; InitData(); delList.Clear(); }); }
public void InitData() { //cboOrgID.SelectedValue = this.SessionInfo.OrgID; //cboDeptID.SelectedValue = this.SessionInfo.DeptID; if (companyID > 0) { CRM_CompanyResult info = companyLogic.GetCustInfo(new CRM_CompanyParam { CompanyID = companyID }); this.ConvertEntityToControl <CRM_CompanyResult>(this.tpCompanyInfo.Controls, info, null); this.ConvertEntityToControl <CRM_CompanyResult>(this.tpFunnelInfo.Controls, info, null); this.ConvertEntityToControl <CRM_CompanyResult>(this.tpOtherContact.Controls, info, null); if (info != null && info.ContactList != null) { addOrModifyList = info.ContactList; } } bsContact.DataSource = addOrModifyList; dgvContact.DataSource = bsContact; }
public void InitData() { if (custVstPlnID > 0) { CRM_VisitPlanResult info = cvpLogic.GetInfo(new CRM_VisitPlanParam { CustVstPlnID = custVstPlnID }); this.ConvertEntityToControl <CRM_VisitPlanResult>(this.grpBase.Controls, info, null); this.ConvertEntityToControl <CRM_VisitPlanResult>(this.grpVst.Controls, info, null); CRM_CompanyResult crmCompany = info.CrmCompany; if (crmCompany != null) { txtCompanyName.Text = crmCompany.CompanyName; txtWebSite.Text = crmCompany.WebSite; txtEmail.Text = crmCompany.Email; } switch (info.Important) { case "高": rdoHight.Checked = true; break; case "普通": rdoCommon.Checked = true; break; case "低": rdoLow.Checked = true; break; } } else { this.txtOpEmpID.Text = this.SessionInfo.UserID.ToStringHasNull(); this.txtOpEmpName.Text = this.SessionInfo.UserName; txtStartDate.Text = Common.GetServerNow(); } BindLineDataGridView(); BindFeeDataGridView(); }
public WCFAddUpdateResult AddOrUpdateSup(CRM_CompanyResult param) { this.CheckSession(); WCFAddUpdateResult ret = new WCFAddUpdateResult(); try { int affect = 0; #region 判断 if (string.IsNullOrEmpty(param.CompanyName.Trim())) { throw new WarnException("请指定公司名称!"); } #endregion List <CRM_CompanyContactResult> contactList = param.ContactList; if (string.IsNullOrEmpty(param.CompanyCode)) { param.CompanyCode = StringHandler.GetChineseSpell(param.CompanyName); } if (string.IsNullOrEmpty(param.CompanyCode)) { throw new WarnException("请指定公司编码!"); } #region 判断重复 WhereClip whereChkName = CRM_Company._.IsDeleted == false && CRM_Company._.CompanyName == param.CompanyName; WhereClip whereChkCode = CRM_Company._.IsDeleted == false && CRM_Company._.CompanyCode == param.CompanyCode; if (param.CompanyID > 0) { whereChkName = whereChkName && CRM_Company._.CompanyID != param.CompanyID; whereChkCode = whereChkCode && CRM_Company._.CompanyID != param.CompanyID; } int chkNameNum = this.Count <CRM_CompanyResult>(whereChkName); int chkCodeNum = this.Count <CRM_CompanyResult>(whereChkCode); if (chkNameNum > 0) { throw new WarnException("存在重复的公司名称!"); } if (chkCodeNum > 0) { throw new WarnException("存在重复的公司编码!"); } #endregion #region 系统默认值 if (param.CompanyID > 0) { WhereClip where = CRM_Company._.CompanyID == param.CompanyID; param.UpdatedEmpID = this.SessionInfo.UserID; param.UpdatedEmpName = this.SessionInfo.UserName; param.UpdatedTime = DateTime.Now; affect = this.Update <CRM_CompanyResult>(param, where); } else { param.CompanyGuID = Guid.NewGuid(); param.CompanyType = 2; param.GCompanyID = this.SessionInfo.CompanyID; param.IsDeleted = false; param.CreatedEmpID = this.SessionInfo.UserID; param.CreatedEmpName = this.SessionInfo.UserName; param.CreatedTime = DateTime.Now; affect = this.Insert <CRM_CompanyResult>(param); param = this.Select <CRM_CompanyResult>(new List <Field>() { CRM_CompanyResult._.CompanyID }, CRM_Company._.CompanyName == param.CompanyName); } foreach (CRM_CompanyContactResult rst in contactList) { if (rst.ContactID == 0) { rst.IsDeleted = false; rst.CompanyID = param.CompanyID; rst.GCompanyID = this.SessionInfo.CompanyID; rst.CreatedEmpID = this.SessionInfo.UserID; rst.CreatedEmpName = this.SessionInfo.UserName; rst.CreatedTime = DateTime.Now; } else { rst.UpdatedEmpID = this.SessionInfo.UserID; rst.UpdatedEmpName = this.SessionInfo.UserName; rst.UpdatedTime = DateTime.Now; } } this.BatchInsertOrUpdate <CRM_CompanyContactResult>(contactList); this.BatchExecute(); #region 设置返回值 ret.Key = param.CompanyID; #endregion #endregion } catch (WarnException exp) { throw exp; } catch (System.Exception exp) { LogInfoBLL.WriteLog(this.SessionInfo, exp); throw exp; } return(ret); }
/// <summary> /// 保存,返回值如果是异步执行,返回值无效果,除非是同步执行,返回值有效 /// </summary> /// <param name="isAsyncExecute">是否异步执行</param> /// <returns></returns> private bool SaveData(bool isAsyncExecute) { bool ret = false; WCFAddUpdateResult result = new WCFAddUpdateResult(); #region 判断和获取实体 ORD_SalesOrderResult info = Form_GetEditEntity() as ORD_SalesOrderResult; if (!this.DataIsChanged && isAsyncExecute)//异步执行时判断数据是否有变化 { this.ShowNoChangedMsg(); return(ret); } bool flag = false; foreach (ORD_SalesOrderLineResult rst in addOrModifyList) { if (string.IsNullOrEmpty(rst.Model) || rst.Qty.ToInt32() <= 0) { flag = true; break; } } if (flag) { this.ShowMessage("型号或数量不能为空!"); return(ret); } #endregion #region 明细 bsOrderLine.EndEdit(); tempList.Clear(); foreach (ORD_SalesOrderLineResult rst in addOrModifyList) { if (rst.HasChanged()) { tempList.Add(rst); } } //tempList.AddRange(addOrModifyList); tempList.AddRange(delList); info.OrderLineList = tempList; #endregion #region 异步执行,点击保存铵钮时 if (isAsyncExecute) { #region 异步执行保存操作 result = this.AsyncExecute <WCFAddUpdateResult, ORD_SalesOrderResult>(info, orderLogic.AddOrUpdate, (a) => { if (a.KeyGuid.ToGuid() != Guid.Empty) { soid = a.Key; soguid = a.KeyGuid.ToGuid(); sourcebillno = a.BillNo; CRM_CompanyResult companyResult = companyLogic.GetCustInfo(new CRM_CompanyParam() { CompanyID = txtCustomerID.Text.ToInt32() }); if (companyResult != null) { companyResult.LastBusinessDate = txtSODate.Text.ToDateTime(); companyLogic.AddOrUpdateCust(companyResult); } if (SaveAttach != null) { SaveAttach("ORD_SalesOrder", soguid.ToGuid(), sourcebillno); } InitData(); delList.Clear(); } }); #endregion } #endregion #region 非异步执 else { result = orderLogic.AddOrUpdate(info); if (result.KeyGuid.ToGuid() != Guid.Empty) { ret = true; } } return(ret); #endregion }