Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        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();
                }
            });
        }