示例#1
0
 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;
         }
     }
 }
示例#2
0
 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);
     }
 }
示例#3
0
        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);
        }
示例#4
0
        private void tsbSave_Click(object sender, EventArgs e)
        {
            ORD_SalesReturnResult info = Form_GetEditEntity() as ORD_SalesReturnResult;

            if (!this.DataIsChanged)
            {
                this.ShowNoChangedMsg();
                return;
            }


            bsSalesReturnLine.EndEdit();
            tempList.Clear();
            foreach (ORD_SalesReturnLineResult rst in addOrModifyList)
            {
                if (rst.HasChanged())
                {
                    tempList.Add(rst);
                }
            }
            //tempList.AddRange(addOrModifyList);
            tempList.AddRange(delList);
            info.ReturnLineList = tempList;
            WCFAddUpdateResult result = this.AsyncExecute <WCFAddUpdateResult, ORD_SalesReturnResult>(info, returnLogic.AddOrUpdate, (a) =>
            {
                if (a.KeyGuid.ToGuid() != Guid.Empty)
                {
                    SRGuid = a.KeyGuid.ToGuid();
                    CRM_CompanyResult companyResult = companyLogic.GetCustInfo(new CRM_CompanyParam()
                    {
                        CompanyID = txtCustomerID.Text.ToInt32()
                    });
                    if (companyResult != null)
                    {
                        companyResult.LastBusinessDate = txtReturnDate.Text.ToDateTime();
                        companyLogic.AddOrUpdateSup(companyResult);
                    }
                    if (SaveAttach != null)
                    {
                        SaveAttach("ORD_SalesReturn", SRGuid.ToGuid(), a.BillNo);
                    }
                    InitData();
                    delList.Clear();
                }
            });
        }
示例#5
0
        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;
        }
示例#6
0
        /// <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
        }