当前位置: 首页>>代码示例>>C#>>正文


C# MasterDataBLL.IsKaTypeNull方法代码示例

本文整理汇总了C#中BusinessObjects.MasterDataBLL.IsKaTypeNull方法的典型用法代码示例。如果您正苦于以下问题:C# MasterDataBLL.IsKaTypeNull方法的具体用法?C# MasterDataBLL.IsKaTypeNull怎么用?C# MasterDataBLL.IsKaTypeNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BusinessObjects.MasterDataBLL的用法示例。


在下文中一共展示了MasterDataBLL.IsKaTypeNull方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddNoActivitySettlement


//.........这里部分代码省略.........
                formSettleRow.CurrencyID = CurrencyID;
                if (AttachedFileName != null && AttachedFileName != string.Empty) {
                    formSettleRow.AttachedFileName = AttachedFileName;
                }
                if (RealAttachedFileName != null && RealAttachedFileName != string.Empty) {
                    formSettleRow.RealAttachedFileName = RealAttachedFileName;
                }
                if (Remark != null && Remark != string.Empty) {
                    formSettleRow.Remark = Remark;
                }
                formSettleRow.AmountRMB = 0;
                formSettleRow.FormApplyIds = FormApplyIds;
                formSettleRow.FormApplyNos = FormApplyNos;
                formSettleRow.IsClose = false;
                formSettleRow.PaymentTypeID = PaymentTypeID;
                this.FormDataSet.FormSaleSettlement.AddFormSaleSettlementRow(formSettleRow);
                this.TAFormSaleSettlement.Update(formSettleRow);

                //费用项
                decimal totalAmountRMB = 0;
                decimal totalApplyAmountRMB = 0;
                FormDS.FormSettlementExpenseDetailDataTable newExpenseDetailTable = new FormDS.FormSettlementExpenseDetailDataTable();
                foreach (FormDS.FormSettlementExpenseDetailRow expenseRow in this.FormDataSet.FormSettlementExpenseDetail) {
                    if (expenseRow.RowState != DataRowState.Deleted) {
                        FormDS.FormSettlementExpenseDetailRow newExpenseRow = newExpenseDetailTable.NewFormSettlementExpenseDetailRow();
                        newExpenseRow.FormSaleSettlementID = formSettleRow.FormSaleSettlementID;
                        newExpenseRow.FormSaleExpenseDetailID = expenseRow.FormSaleExpenseDetailID;
                        newExpenseRow.FormSaleApplyID = expenseRow.FormSaleApplyID;
                        newExpenseRow.ApplyFormNo = expenseRow.ApplyFormNo;
                        newExpenseRow.ApplyPeriod = expenseRow.ApplyPeriod;
                        newExpenseRow.ApplyProjectName = expenseRow.ApplyProjectName;
                        newExpenseRow.ExpenseItemID = expenseRow.ExpenseItemID;
                        if (!expenseRow.IsShopNameNull()) {
                            newExpenseRow.ShopName = expenseRow.ShopName;
                        }
                        if (!expenseRow.IsSKUIDNull()) {
                            newExpenseRow.SKUID = expenseRow.SKUID;
                        }
                        newExpenseRow.ApplyAmount = expenseRow.ApplyAmount;
                        newExpenseRow.ApplyAmountRMB = expenseRow.ApplyAmountRMB;
                        if (!expenseRow.IsApplyRemarkNull()) {
                            newExpenseRow.ApplyRemark = expenseRow.ApplyRemark;
                        }
                        if (!expenseRow.IsAdvancedAmountNull()) {
                            newExpenseRow.AdvancedAmount = expenseRow.AdvancedAmount;
                        }
                        newExpenseRow.AmountRMB = expenseRow.AmountRMB;
                        if (!expenseRow.IsRemarkNull()) {
                            newExpenseRow.Remark = expenseRow.Remark;
                        }

                        newExpenseDetailTable.AddFormSettlementExpenseDetailRow(newExpenseRow);
                        totalAmountRMB = totalAmountRMB + newExpenseRow.AmountRMB;
                        totalApplyAmountRMB = totalApplyAmountRMB + newExpenseRow.ApplyAmountRMB;
                    }
                }
                this.TAFormSettlementExpenseDetail.Update(newExpenseDetailTable);

                formSettleRow.ApplyAmountRMB = totalApplyAmountRMB;
                formSettleRow.AmountRMB = totalAmountRMB;

                this.TAFormSaleSettlement.Update(formSettleRow);

                //作废之前的单据
                if (RejectedFormID != null) {
                    FormDS.FormRow oldRow = this.TAForm.GetDataByID(RejectedFormID.GetValueOrDefault())[0];
                    if (oldRow.StatusID == (int)SystemEnums.FormStatus.Rejected) {
                        oldRow.StatusID = (int)SystemEnums.FormStatus.Scrap;
                        this.TAForm.Update(oldRow);
                    }
                }

                // 正式提交
                if (StatusID == SystemEnums.FormStatus.Awaiting) {
                    Dictionary<string, object> dic = new Dictionary<string, object>();
                    dic["TotalAmount"] = totalAmountRMB;
                    MasterData.CustomerRow customer = new MasterDataBLL().GetCustomerById(CustomerID)[0];
                    dic["CustomerChannel"] = new MasterDataBLL().GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelCode;
                    dic["KAType"] = customer.IsKaTypeNull() ? "" : customer.KaType;
                    dic["PaymentTypeID"] = PaymentTypeID;
                    APResult result = new APFlowBLL().CreateProcess(new APParameter(formRow.FormID, formRow.FormNo, formRow.OrganizationUnitID, formRow.UserID, (int)StatusID, formRow.FormTypeID, formRow.PositionID, dic));
                    if (result != null) {
                        formRow.InTurnPositionIds = result.InTurnPositionIds;
                        formRow.InTurnUserIds = result.InTurnUserIds;
                        formRow.SubmitDate = result.ApprovedDate.GetValueOrDefault();
                        formRow.StatusID = result.StatusID;
                        formRow.ProcID = result.ProcID;
                        this.TAForm.Update(formRow);
                    }
                }

                transaction.Commit();

            } catch (Exception ex) {
                transaction.Rollback();
                throw new ApplicationException("Save Fail!" + ex.ToString());
            } finally {
                transaction.Dispose();
            }
        }
开发者ID:hijoy,项目名称:CPL_ERS,代码行数:101,代码来源:FormSaleBLL.cs

示例2: AddPaymentCash


//.........这里部分代码省略.........
                        this.TAFormInvoice.Update(newInvoiceTable);
                    }
                } else {
                    foreach (FormDS.FormInvoiceRow invoiceRow in this.FormDataSet.FormInvoice) {
                        // 与父表绑定
                        if (invoiceRow.RowState != DataRowState.Deleted) {
                            invoiceRow.FormID = formPaymentRow.FormSalePaymentID;
                        }
                    }
                }
                this.TAFormInvoice.Update(this.FormDataSet.FormInvoice);

                //处理明细
                decimal totalAmountBeforeTax = 0;
                decimal totalTaxAmount = 0;
                decimal totalAmountRMB = 0;
                FormDS.FormSalePaymentDetailDataTable newDetailTable = new FormDS.FormSalePaymentDetailDataTable();
                foreach (FormDS.FormSalePaymentDetailRow detailRow in this.FormDataSet.FormSalePaymentDetail) {
                    // 与父表绑定
                    if (detailRow.RowState != DataRowState.Deleted) {
                        totalAmountBeforeTax += detailRow.AmountBeforeTax;
                        totalTaxAmount += detailRow.TaxAmount;
                        totalAmountRMB += detailRow.AmountRMB;
                        FormDS.FormSalePaymentDetailRow newDetailRow = newDetailTable.NewFormSalePaymentDetailRow();
                        newDetailRow.FormSalePaymentID = formPaymentRow.FormSalePaymentID;
                        newDetailRow.FormSaleApplyID = detailRow.FormSaleApplyID;
                        newDetailRow.FormSaleExpenseDetailID = detailRow.FormSaleExpenseDetailID;
                        newDetailRow.ApplyFormNo = detailRow.ApplyFormNo;
                        newDetailRow.ApplyPeriod = detailRow.ApplyPeriod;
                        if (!detailRow.IsApplyProjectNameNull()) {
                            newDetailRow.ApplyProjectName = detailRow.ApplyProjectName;
                        }
                        newDetailRow.ExpenseItemID = detailRow.ExpenseItemID;
                        if (!detailRow.IsShopNameNull()) {
                            newDetailRow.ShopName = detailRow.ShopName;
                        }
                        if (!detailRow.IsSKUIDNull()) {
                            newDetailRow.SKUID = detailRow.SKUID;
                        }
                        newDetailRow.ApplyAmount = detailRow.ApplyAmount;
                        newDetailRow.ApplyAmountRMB = detailRow.ApplyAmountRMB;
                        if (!detailRow.IsSettlementAmountNull()) {
                            newDetailRow.SettlementAmount = detailRow.SettlementAmount;
                        }
                        if (!detailRow.IsPayedAmountNull()) {
                            newDetailRow.PayedAmount = detailRow.PayedAmount;
                        }
                        if (!detailRow.IsRemainAmountNull()) {
                            newDetailRow.RemainAmount = detailRow.RemainAmount;
                        }
                        newDetailRow.AmountBeforeTax = detailRow.AmountBeforeTax;
                        newDetailRow.TaxAmount = detailRow.TaxAmount;
                        newDetailRow.AmountRMB = detailRow.AmountRMB;

                        newDetailTable.AddFormSalePaymentDetailRow(newDetailRow);
                    }
                }
                this.TAFormSalePaymentDetail.Update(newDetailTable);

                formPaymentRow.AmountBeforeTax = totalAmountBeforeTax;
                formPaymentRow.TaxAmount = totalTaxAmount;
                formPaymentRow.AmountRMB = totalAmountRMB;
                this.TAFormSalePayment.Update(formPaymentRow);
                //作废之前的单据
                if (RejectedFormID != null) {
                    FormDS.FormRow oldRow = this.TAForm.GetDataByID(RejectedFormID.GetValueOrDefault())[0];
                    if (oldRow.StatusID == (int)SystemEnums.FormStatus.Rejected) {
                        oldRow.StatusID = (int)SystemEnums.FormStatus.Scrap;
                        this.TAForm.Update(oldRow);
                    }
                }

                // 正式提交
                if (StatusID == SystemEnums.FormStatus.Awaiting) {
                    Dictionary<string, object> dic = new Dictionary<string, object>();
                    dic["TotalAmount"] = totalAmountRMB;
                    MasterData.CustomerRow customer = new MasterDataBLL().GetCustomerById(this.TAFormSaleSettlement.GetDataByID(FormSaleSettlementID)[0].CustomerID)[0];
                    dic["CustomerChannel"] = new MasterDataBLL().GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelCode;
                    dic["KAType"] = customer.IsKaTypeNull() ? "" : customer.KaType;
                    dic["InvoiceStatus"] = formPaymentRow.InvoiceStatusID;
                    dic["PaymentTypeID"] = PaymentTypeID;
                    APResult result = new APFlowBLL().CreateProcess(new APParameter(formRow.FormID, formRow.FormNo, formRow.OrganizationUnitID, formRow.UserID, (int)StatusID, formRow.FormTypeID, formRow.PositionID, dic));
                    if (result != null) {
                        formRow.InTurnPositionIds = result.InTurnPositionIds;
                        formRow.InTurnUserIds = result.InTurnUserIds;
                        formRow.SubmitDate = result.ApprovedDate.GetValueOrDefault();
                        formRow.StatusID = result.StatusID;
                        formRow.ProcID = result.ProcID;
                        formRow.FinanceRemark = formPaymentRow.Remark;
                        this.TAForm.Update(formRow);
                    }
                }
                transaction.Commit();
            } catch (Exception ex) {
                transaction.Rollback();
                throw new ApplicationException("Save Fail!" + ex.ToString());
            } finally {
                transaction.Dispose();
            }
        }
开发者ID:hijoy,项目名称:CPL_ERS,代码行数:101,代码来源:FormSaleBLL.cs

示例3: UpdateSaleNoActivityApply

        public void UpdateSaleNoActivityApply(int FormID, SystemEnums.FormType FormTypeID, SystemEnums.FormStatus StatusID,
                        decimal ExchangeRate, string ShopName, int? ShopCount, string ProjectName, string ProjectDesc,
                        string ApplyFileName, string ApplyRealFileName, DateTime? ActivityBeginDate, DateTime? ActivityEndDate, int? CostCenterID, int? DiscountTypeID,
                        decimal TotalBudget, decimal ApprovedAmount, decimal ApprovingAmount, decimal CompletedAmount, decimal ReimbursedAmount, decimal RemainBudget)
        {
            SqlTransaction transaction = null;

            try {
                //事务开始
                transaction = TableAdapterHelper.BeginTransaction(this.TAForm);
                TableAdapterHelper.SetTransaction(this.TAFormSaleApply, transaction);
                TableAdapterHelper.SetTransaction(this.TAFormSaleExpenseDetail, transaction);

                FormDS.FormRow formRow = this.TAForm.GetDataByID(FormID)[0];
                FormDS.FormSaleApplyRow formApplyRow = this.TAFormSaleApply.GetDataByID(FormID)[0];

                //处理单据的内容
                UtilityBLL utility = new UtilityBLL();
                if (StatusID == SystemEnums.FormStatus.Awaiting) {
                    string formTypeString = utility.GetFormTypeString((int)FormTypeID);
                    formRow.FormNo = utility.GetFormNo(formTypeString);
                    formRow.InTurnUserIds = "P";//待改动
                    formRow.InTurnPositionIds = "P";//待改动
                } else {
                    formRow.SetFormNoNull();
                }
                formRow.StatusID = (int)StatusID;
                formRow.SubmitDate = DateTime.Now;
                formRow.LastModified = DateTime.Now;
                if (CostCenterID != null) {
                    formRow.CostCenterID = CostCenterID.GetValueOrDefault();
                }
                this.TAForm.Update(formRow);

                //处理申请表的内容
                formApplyRow.ExchangeRate = ExchangeRate;
                if (ShopName != null)
                    formApplyRow.ShopName = ShopName;
                if (ShopCount != null)
                    formApplyRow.ShopCount = ShopCount.GetValueOrDefault();
                if (ProjectName != null)
                    formApplyRow.ProjectName = ProjectName;
                if (ProjectDesc != null)
                    formApplyRow.ProjectDesc = ProjectDesc;
                if (ApplyFileName != null && ApplyFileName != string.Empty) {
                    formApplyRow.ApplyFileName = ApplyFileName;
                } else {
                    formApplyRow.SetApplyFileNameNull();
                }
                if (ApplyRealFileName != null && ApplyRealFileName != string.Empty) {
                    formApplyRow.ApplyRealFileName = ApplyRealFileName;
                } else {
                    formApplyRow.SetApplyRealFileNameNull();
                }
                if (ActivityBeginDate != null)
                    formApplyRow.ActivityBeginDate = ActivityBeginDate.GetValueOrDefault();
                if (ActivityEndDate != null)
                    formApplyRow.ActivityEndDate = ActivityEndDate.GetValueOrDefault();
                if (DiscountTypeID != null) {
                    formApplyRow.DiscountTypeID = DiscountTypeID.GetValueOrDefault();
                }

                formApplyRow.TotalBudget = TotalBudget;
                formApplyRow.ApprovedAmount = ApprovedAmount;
                formApplyRow.ApprovingAmount = ApprovingAmount;
                formApplyRow.CompletedAmount = CompletedAmount;
                formApplyRow.ReimbursedAmount = ReimbursedAmount;
                formApplyRow.RemainBudget = RemainBudget;

                this.TAFormSaleApply.Update(formApplyRow);

                //处理明细
                decimal totalAmountRMB = 0;
                foreach (FormDS.FormSaleExpenseDetailRow detailRow in this.FormDataSet.FormSaleExpenseDetail) {
                    if (detailRow.RowState != DataRowState.Deleted) {
                        detailRow.FormSaleApplyID = formApplyRow.FormSaleApplyID;
                        detailRow.AmountRMB = decimal.Round(detailRow.Amount * ExchangeRate, 2);
                        totalAmountRMB = totalAmountRMB + detailRow.AmountRMB;
                    }
                }
                this.TAFormSaleExpenseDetail.Update(this.FormDataSet.FormSaleExpenseDetail);
                formApplyRow.AmountRMB = totalAmountRMB;
                TAFormSaleApply.Update(formApplyRow);

                // 正式提交
                if (StatusID == SystemEnums.FormStatus.Awaiting) {
                    Dictionary<string, object> dic = new Dictionary<string, object>();
                    dic["TotalAmount"] = totalAmountRMB;
                    MasterData.CustomerRow customer = new MasterDataBLL().GetCustomerById(formApplyRow.CustomerID)[0];
                    dic["CustomerChannel"] = new MasterDataBLL().GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelCode;
                    dic["KAType"] = customer.IsKaTypeNull() ? "" : customer.KaType;
                    dic["MaxDiscount"] = 0;
                    dic["DiscountType"] = DiscountTypeID;

                    APResult result = new APFlowBLL().CreateProcess(new APParameter(formRow.FormID, formRow.FormNo, formRow.OrganizationUnitID, formRow.UserID, (int)StatusID, formRow.FormTypeID, formRow.PositionID, dic));
                    if (result != null) {
                        formRow.InTurnPositionIds = result.InTurnPositionIds;
                        formRow.InTurnUserIds = result.InTurnUserIds;
                        formRow.SubmitDate = result.ApprovedDate.GetValueOrDefault();
                        formRow.StatusID = result.StatusID;
//.........这里部分代码省略.........
开发者ID:hijoy,项目名称:CPL_ERS,代码行数:101,代码来源:FormSaleBLL.cs

示例4: UpdateSaleActivityApply


//.........这里部分代码省略.........
                    formApplyRow.ActivityBeginDate = ActivityBeginDate.GetValueOrDefault();
                if (ActivityEndDate != null)
                    formApplyRow.ActivityEndDate = ActivityEndDate.GetValueOrDefault();
                if (DeliveryBeginDate != null)
                    formApplyRow.DeliveryBeginDate = DeliveryBeginDate.GetValueOrDefault();
                if (DeliveryEndDate != null)
                    formApplyRow.DeliveryEndDate = DeliveryEndDate.GetValueOrDefault();

                formApplyRow.TotalBudget = TotalBudget;
                formApplyRow.ApprovedAmount = ApprovedAmount;
                formApplyRow.ApprovingAmount = ApprovingAmount;
                formApplyRow.CompletedAmount = CompletedAmount;
                formApplyRow.ReimbursedAmount = ReimbursedAmount;
                formApplyRow.RemainBudget = RemainBudget;

                this.TAFormSaleApply.Update(formApplyRow);

                //处理明细,先产品表
                decimal totalPriceDiscountAmountRMB = 0;//
                decimal totalForecastOrderAmount = 0;
                decimal maxDiscount = 0;
                foreach (FormDS.FormSaleSKUDetailRow skuRow in this.FormDataSet.FormSaleSKUDetail) {
                    if (skuRow.RowState != DataRowState.Deleted) {
                        skuRow.FormSaleApplyID = formApplyRow.FormSaleApplyID;
                        skuRow.PriceDiscountAmountRMB = decimal.Round(skuRow.PriceDiscountAmount * ExchangeRate, 2);
                        totalPriceDiscountAmountRMB = totalPriceDiscountAmountRMB + skuRow.PriceDiscountAmountRMB;
                        totalForecastOrderAmount = totalForecastOrderAmount + skuRow.ForecastOrderAmount;
                        if (skuRow.Discount > maxDiscount) {
                            maxDiscount = skuRow.Discount;
                        }
                        //如果有折扣的话,要生成费用项
                        if (!skuRow.IsPriceDiscountAmountRMBNull()) {
                            if (StatusID == SystemEnums.FormStatus.Awaiting && new ExpenseItemTableAdapter().GetPriceDiscountExpenseItem().Count != 0) {
                                FormDS.FormSaleExpenseDetailRow newExpenseDetail = this.FormDataSet.FormSaleExpenseDetail.NewFormSaleExpenseDetailRow();
                                newExpenseDetail.FormSaleApplyID = formApplyRow.FormSaleApplyID;
                                newExpenseDetail.ExpenseItemID = new ExpenseItemTableAdapter().GetPriceDiscountExpenseItem()[0].ExpenseItemID;
                                newExpenseDetail.SKUID = skuRow.SKUID;
                                newExpenseDetail.Amount = skuRow.PriceDiscountAmount;
                                newExpenseDetail.AmountRMB = decimal.Round(skuRow.PriceDiscountAmount * ExchangeRate, 2);
                                if (!skuRow.IsRemarkNull()) {
                                    newExpenseDetail.Remark = skuRow.Remark;
                                }
                                this.FormDataSet.FormSaleExpenseDetail.AddFormSaleExpenseDetailRow(newExpenseDetail);
                            }
                        }
                    }
                }
                this.TAFormSaleSKUDetail.Update(this.FormDataSet.FormSaleSKUDetail);
                //费用项
                decimal totalAmountRMB = 0;
                foreach (FormDS.FormSaleExpenseDetailRow expenseRow in this.FormDataSet.FormSaleExpenseDetail) {
                    if (expenseRow.RowState != DataRowState.Deleted) {
                        expenseRow.FormSaleApplyID = formApplyRow.FormSaleApplyID;
                        expenseRow.AmountRMB = decimal.Round(expenseRow.Amount * ExchangeRate, 2);
                        totalAmountRMB = totalAmountRMB + expenseRow.AmountRMB;
                    }
                }
                this.TAFormSaleExpenseDetail.Update(this.FormDataSet.FormSaleExpenseDetail);

                formApplyRow.PriceDiscountAmountRMB = totalPriceDiscountAmountRMB;
                formApplyRow.AmountRMB = totalAmountRMB;
                formApplyRow.OtherAmountRMB = totalAmountRMB - totalPriceDiscountAmountRMB;
                formApplyRow.ForecastOrderAmount = totalForecastOrderAmount;
                if (totalForecastOrderAmount != 0) {
                    formApplyRow.CostBenefitRate = totalAmountRMB / totalForecastOrderAmount * 100;
                } else {
                    formApplyRow.CostBenefitRate = 0;
                }
                TAFormSaleApply.Update(formApplyRow);

                // 正式提交
                if (StatusID == SystemEnums.FormStatus.Awaiting) {
                    Dictionary<string, object> dic = new Dictionary<string, object>();
                    dic["TotalAmount"] = totalAmountRMB;
                    MasterData.CustomerRow customer = new MasterDataBLL().GetCustomerById(formApplyRow.CustomerID)[0];
                    dic["CustomerChannel"] = new MasterDataBLL().GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelCode;
                    dic["KAType"] = customer.IsKaTypeNull() ? "" : customer.KaType;
                    dic["MaxDiscount"] = maxDiscount;
                    dic["DiscountType"] = DiscountTypeID;
                    APResult result = new APFlowBLL().CreateProcess(new APParameter(formRow.FormID, formRow.FormNo, formRow.OrganizationUnitID, formRow.UserID, (int)StatusID, formRow.FormTypeID, formRow.PositionID, dic));
                    if (result != null) {
                        formRow.InTurnPositionIds = result.InTurnPositionIds;
                        formRow.InTurnUserIds = result.InTurnUserIds;
                        formRow.SubmitDate = result.ApprovedDate.GetValueOrDefault();
                        formRow.StatusID = result.StatusID;
                        formRow.ProcID = result.ProcID;
                        this.TAForm.Update(formRow);
                    }
                }
                transaction.Commit();
            } catch (ApplicationException ex) {
                transaction.Rollback();
                throw ex;
            } catch (Exception ex) {
                transaction.Rollback();
                throw new ApplicationException("Save Fail!" + ex.ToString());
            } finally {
                transaction.Dispose();
            }
        }
开发者ID:hijoy,项目名称:CPL_ERS,代码行数:101,代码来源:FormSaleBLL.cs

示例5: UpdatePaymentFreeGoods

        public void UpdatePaymentFreeGoods(int FormID, SystemEnums.FormType FormTypeID, SystemEnums.FormStatus StatusID, int InvoiceStatusID, int PaymentTypeID,
                string Remark, string AttachedFileName, string RealAttachedFileName, int? VendorID)
        {
            SqlTransaction transaction = null;
            try {
                //事务开始
                transaction = TableAdapterHelper.BeginTransaction(this.TAForm);
                TableAdapterHelper.SetTransaction(this.TAFormSalePayment, transaction);
                TableAdapterHelper.SetTransaction(this.TAFormSalePaymentDetail, transaction);
                TableAdapterHelper.SetTransaction(this.TAFormSalePaymentFreeGoods, transaction);

                FormDS.FormRow formRow = this.TAForm.GetDataByID(FormID)[0];
                FormDS.FormSalePaymentRow formPaymentRow = this.TAFormSalePayment.GetDataByID(FormID)[0];

                //处理单据的内容
                UtilityBLL utility = new UtilityBLL();
                if (StatusID == SystemEnums.FormStatus.Awaiting) {
                    string formTypeString = utility.GetFormTypeString((int)FormTypeID);
                    formRow.FormNo = utility.GetFormNo(formTypeString);
                    formRow.InTurnUserIds = "P";//待改动
                    formRow.InTurnPositionIds = "P";//待改动
                } else {
                    formRow.SetFormNoNull();
                }
                formRow.StatusID = (int)StatusID;
                formRow.SubmitDate = DateTime.Now;
                formRow.LastModified = DateTime.Now;

                this.TAForm.Update(formRow);

                //处理Payment的内容
                if (AttachedFileName != null && AttachedFileName != string.Empty) {
                    formPaymentRow.AttachedFileName = AttachedFileName;
                } else {
                    formPaymentRow.SetAttachedFileNameNull();
                }
                if (RealAttachedFileName != null && RealAttachedFileName != string.Empty) {
                    formPaymentRow.RealAttachedFileName = RealAttachedFileName;
                } else {
                    formPaymentRow.SetRealAttachedFileNameNull();
                }
                if (Remark != null && Remark != string.Empty) {
                    formPaymentRow.Remark = Remark;
                }
                formPaymentRow.InvoiceStatusID = InvoiceStatusID;
                formPaymentRow.PaymentTypeID = PaymentTypeID;
                if (VendorID != null) {
                    formPaymentRow.VendorID = VendorID.GetValueOrDefault();
                }
                this.TAFormSalePayment.Update(formPaymentRow);

                //处理明细
                decimal totalAmountRMB = 0;
                foreach (FormDS.FormSalePaymentDetailRow detailRow in this.FormDataSet.FormSalePaymentDetail) {
                    if (detailRow.RowState != DataRowState.Deleted) {
                        totalAmountRMB += detailRow.AmountRMB;
                        detailRow.FormSalePaymentID = formPaymentRow.FormSalePaymentID;
                    }
                }
                this.TAFormSalePaymentDetail.Update(this.FormDataSet.FormSalePaymentDetail);

                formPaymentRow.AmountRMB = totalAmountRMB;
                this.TAFormSalePayment.Update(formPaymentRow);

                foreach (FormDS.FormSalePaymentFreeGoodsRow detailFGRow in this.FormDataSet.FormSalePaymentFreeGoods) {
                    // 与父表绑定
                    if (detailFGRow.RowState != DataRowState.Deleted) {
                        detailFGRow.FormSalePaymentID = formPaymentRow.FormSalePaymentID;
                    }
                }
                this.TAFormSalePaymentFreeGoods.Update(this.FormDataSet.FormSalePaymentFreeGoods);

                // 正式提交
                if (StatusID == SystemEnums.FormStatus.Awaiting) {
                    Dictionary<string, object> dic = new Dictionary<string, object>();
                    dic["TotalAmount"] = totalAmountRMB;
                    MasterData.CustomerRow customer = new MasterDataBLL().GetCustomerById(this.TAFormSaleSettlement.GetDataByID(formPaymentRow.FormSaleSettlementID)[0].CustomerID)[0];
                    dic["CustomerChannel"] = new MasterDataBLL().GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelCode;
                    dic["KAType"] = customer.IsKaTypeNull() ? "" : customer.KaType;
                    dic["PaymentTypeID"] = PaymentTypeID;
                    APResult result = new APFlowBLL().CreateProcess(new APParameter(formRow.FormID, formRow.FormNo, formRow.OrganizationUnitID, formRow.UserID, (int)StatusID, formRow.FormTypeID, formRow.PositionID, dic));
                    if (result != null) {
                        formRow.InTurnPositionIds = result.InTurnPositionIds;
                        formRow.InTurnUserIds = result.InTurnUserIds;
                        formRow.SubmitDate = result.ApprovedDate.GetValueOrDefault();
                        formRow.StatusID = result.StatusID;
                        formRow.ProcID = result.ProcID;
                        formRow.FinanceRemark = formPaymentRow.Remark;
                        this.TAForm.Update(formRow);
                    }
                }

                transaction.Commit();

            } catch (Exception ex) {
                transaction.Rollback();
                throw new ApplicationException("Save Fail!" + ex.ToString());
            } finally {
                transaction.Dispose();
            }
//.........这里部分代码省略.........
开发者ID:hijoy,项目名称:CPL_ERS,代码行数:101,代码来源:FormSaleBLL.cs

示例6: UpdateActivitySettlement

        public void UpdateActivitySettlement(int FormID, SystemEnums.FormType FormTypeID, SystemEnums.FormStatus StatusID, string AttachedFileName, string RealAttachedFileName, string Remark, int PaymentTypeID)
        {
            SqlTransaction transaction = null;
            try {
                //事务开始
                transaction = TableAdapterHelper.BeginTransaction(this.TAForm);
                TableAdapterHelper.SetTransaction(this.TAFormSaleSettlement, transaction);
                TableAdapterHelper.SetTransaction(this.TAFormSettlementExpenseDetail, transaction);
                TableAdapterHelper.SetTransaction(this.TAFormSettlementSKUDetail, transaction);

                FormDS.FormRow formRow = this.TAForm.GetDataByID(FormID)[0];
                FormDS.FormSaleSettlementRow formSettleRow = this.TAFormSaleSettlement.GetDataByID(FormID)[0];

                //处理单据的内容
                UtilityBLL utility = new UtilityBLL();
                if (StatusID == SystemEnums.FormStatus.Awaiting) {
                    string formTypeString = utility.GetFormTypeString((int)FormTypeID);
                    formRow.FormNo = utility.GetFormNo(formTypeString);
                    formRow.InTurnUserIds = "P";//待改动
                    formRow.InTurnPositionIds = "P";//待改动
                } else {
                    formRow.SetFormNoNull();
                }
                formRow.StatusID = (int)StatusID;
                formRow.SubmitDate = DateTime.Now;
                formRow.LastModified = DateTime.Now;

                this.TAForm.Update(formRow);

                //处理settlement的内容
                if (AttachedFileName != null && AttachedFileName != string.Empty) {
                    formSettleRow.AttachedFileName = AttachedFileName;
                } else {
                    formSettleRow.SetAttachedFileNameNull();
                }
                if (RealAttachedFileName != null && RealAttachedFileName != string.Empty) {
                    formSettleRow.RealAttachedFileName = RealAttachedFileName;
                } else {
                    formSettleRow.SetRealAttachedFileNameNull();
                }
                if (Remark != null && Remark != string.Empty) {
                    formSettleRow.Remark = Remark;
                }
                formSettleRow.PaymentTypeID = PaymentTypeID;
                this.TAFormSaleSettlement.Update(formSettleRow);

                //处理明细,先产品表
                decimal totalForecastOrderAmount = 0;
                decimal totalActualOrderAmount = 0;
                foreach (FormDS.FormSettlementSKUDetailRow skuRow in this.FormDataSet.FormSettlementSKUDetail) {
                    if (skuRow.RowState != DataRowState.Deleted) {
                        skuRow.FormSaleSettlementID = formSettleRow.FormSaleSettlementID;
                        totalForecastOrderAmount = totalForecastOrderAmount + skuRow.ForecastOrderAmount;
                        totalActualOrderAmount = totalActualOrderAmount + skuRow.ActualOrderAmount;
                    }
                }
                this.TAFormSettlementSKUDetail.Update(this.FormDataSet.FormSettlementSKUDetail);
                //费用项
                decimal totalAmountRMB = 0;
                decimal totalApplyAmountRMB = 0;
                foreach (FormDS.FormSettlementExpenseDetailRow expenseRow in this.FormDataSet.FormSettlementExpenseDetail) {
                    if (expenseRow.RowState != DataRowState.Deleted) {
                        expenseRow.FormSaleSettlementID = formSettleRow.FormSaleSettlementID;
                        totalAmountRMB = totalAmountRMB + expenseRow.AmountRMB;
                        totalApplyAmountRMB = totalApplyAmountRMB + expenseRow.ApplyAmountRMB;
                    }
                }
                this.TAFormSettlementExpenseDetail.Update(this.FormDataSet.FormSettlementExpenseDetail);

                formSettleRow.ForecastOrderAmount = totalForecastOrderAmount;
                formSettleRow.ApplyAmountRMB = totalApplyAmountRMB;
                if (totalForecastOrderAmount != 0) {
                    formSettleRow.CostBenefitRate = totalApplyAmountRMB / totalForecastOrderAmount * 100;
                } else {
                    formSettleRow.CostBenefitRate = 0;
                }
                formSettleRow.ActualOrderAmount = totalActualOrderAmount;
                formSettleRow.AmountRMB = totalAmountRMB;
                if (totalActualOrderAmount != 0) {
                    formSettleRow.ActualCostBenefitRate = totalAmountRMB / totalActualOrderAmount * 100;
                } else {
                    formSettleRow.ActualCostBenefitRate = 0;
                }

                this.TAFormSaleSettlement.Update(formSettleRow);

                // 正式提交
                if (StatusID == SystemEnums.FormStatus.Awaiting) {
                    Dictionary<string, object> dic = new Dictionary<string, object>();
                    dic["TotalAmount"] = totalAmountRMB;
                    MasterData.CustomerRow customer = new MasterDataBLL().GetCustomerById(formSettleRow.CustomerID)[0];
                    dic["CustomerChannel"] = new MasterDataBLL().GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelCode;
                    dic["KAType"] = customer.IsKaTypeNull() ? "" : customer.KaType;
                    dic["PaymentTypeID"] = PaymentTypeID;

                    APResult result = new APFlowBLL().CreateProcess(new APParameter(formRow.FormID, formRow.FormNo, formRow.OrganizationUnitID, formRow.UserID, (int)StatusID, formRow.FormTypeID, formRow.PositionID, dic));
                    if (result != null) {
                        formRow.InTurnPositionIds = result.InTurnPositionIds;
                        formRow.InTurnUserIds = result.InTurnUserIds;
                        formRow.SubmitDate = result.ApprovedDate.GetValueOrDefault();
//.........这里部分代码省略.........
开发者ID:hijoy,项目名称:CPL_ERS,代码行数:101,代码来源:FormSaleBLL.cs

示例7: AddSaleNoActivityApply


//.........这里部分代码省略.........
                    formApplyRow.ApplyRealFileName = ApplyRealFileName;
                }
                if (ActivityBeginDate != null)
                    formApplyRow.ActivityBeginDate = ActivityBeginDate.GetValueOrDefault();
                if (ActivityEndDate != null)
                    formApplyRow.ActivityEndDate = ActivityEndDate.GetValueOrDefault();
                if (DiscountTypeID != null) {
                    formApplyRow.DiscountTypeID = DiscountTypeID.GetValueOrDefault();
                }
                formApplyRow.TotalBudget = TotalBudget;
                formApplyRow.ApprovedAmount = ApprovedAmount;
                formApplyRow.ApprovingAmount = ApprovingAmount;
                formApplyRow.CompletedAmount = CompletedAmount;
                formApplyRow.ReimbursedAmount = ReimbursedAmount;
                formApplyRow.RemainBudget = RemainBudget;
                formApplyRow.AmountRMB = 0;//暂时
                formApplyRow.IsClose = false;
                formApplyRow.IsCompleted = false;

                this.FormDataSet.FormSaleApply.AddFormSaleApplyRow(formApplyRow);
                this.TAFormSaleApply.Update(formApplyRow);

                //处理明细

                decimal totalAmountRMB = 0;

                if (RejectedFormID != null) {
                    FormDS.FormSaleExpenseDetailDataTable newDetailTable = new FormDS.FormSaleExpenseDetailDataTable();
                    foreach (FormDS.FormSaleExpenseDetailRow detailRow in this.FormDataSet.FormSaleExpenseDetail) {
                        if (detailRow.RowState != DataRowState.Deleted) {
                            FormDS.FormSaleExpenseDetailRow newDetailRow = newDetailTable.NewFormSaleExpenseDetailRow();
                            newDetailRow.FormSaleApplyID = formApplyRow.FormSaleApplyID;
                            newDetailRow.ExpenseItemID = detailRow.ExpenseItemID;
                            newDetailRow.SKUID = detailRow.SKUID;
                            newDetailRow.Amount = detailRow.Amount;
                            newDetailRow.AmountRMB = decimal.Round(detailRow.Amount * ExchangeRate, 2);
                            if (!detailRow.IsRemarkNull()) {
                                newDetailRow.Remark = detailRow.Remark;
                            }
                            newDetailTable.AddFormSaleExpenseDetailRow(newDetailRow);
                            totalAmountRMB = totalAmountRMB + newDetailRow.AmountRMB;
                        }

                        this.TAFormSaleExpenseDetail.Update(newDetailTable);
                    }
                } else {
                    foreach (FormDS.FormSaleExpenseDetailRow detailRow in this.FormDataSet.FormSaleExpenseDetail) {
                        if (detailRow.RowState != DataRowState.Deleted) {
                            detailRow.FormSaleApplyID = formApplyRow.FormSaleApplyID;
                            detailRow.AmountRMB = decimal.Round(detailRow.Amount * ExchangeRate, 2);
                            totalAmountRMB = totalAmountRMB + detailRow.AmountRMB;
                        }
                    }
                    this.TAFormSaleExpenseDetail.Update(this.FormDataSet.FormSaleExpenseDetail);
                }

                formApplyRow.AmountRMB = totalAmountRMB;
                TAFormSaleApply.Update(formApplyRow);

                //作废之前的单据
                if (RejectedFormID != null) {
                    FormDS.FormRow oldRow = this.TAForm.GetDataByID(RejectedFormID.GetValueOrDefault())[0];
                    if (oldRow.StatusID == (int)SystemEnums.FormStatus.Rejected) {
                        oldRow.StatusID = (int)SystemEnums.FormStatus.Scrap;
                        this.TAForm.Update(oldRow);
                    }
                }

                // 正式提交
                if (StatusID == SystemEnums.FormStatus.Awaiting) {
                    Dictionary<string, object> dic = new Dictionary<string, object>();
                    dic["TotalAmount"] = totalAmountRMB;
                    MasterData.CustomerRow customer = new MasterDataBLL().GetCustomerById(CustomerID)[0];
                    dic["CustomerChannel"] = new MasterDataBLL().GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelCode;
                    dic["KAType"] = customer.IsKaTypeNull() ? "" : customer.KaType;
                    dic["MaxDiscount"] = 0; ;
                    dic["DiscountType"] = DiscountTypeID;

                    APResult result = new APFlowBLL().CreateProcess(new APParameter(formRow.FormID, formRow.FormNo, formRow.OrganizationUnitID, formRow.UserID, (int)StatusID, formRow.FormTypeID, formRow.PositionID, dic));
                    if (result != null) {
                        formRow.InTurnPositionIds = result.InTurnPositionIds;
                        formRow.InTurnUserIds = result.InTurnUserIds;
                        formRow.SubmitDate = result.ApprovedDate.GetValueOrDefault();
                        formRow.StatusID = result.StatusID;
                        formRow.ProcID = result.ProcID;
                        this.TAForm.Update(formRow);
                    }
                }

                transaction.Commit();
            } catch (ApplicationException ex) {
                transaction.Rollback();
                throw ex;
            } catch (Exception ex) {
                transaction.Rollback();
                throw new ApplicationException("Save Fail!" + ex.ToString());
            } finally {
                transaction.Dispose();
            }
        }
开发者ID:hijoy,项目名称:CPL_ERS,代码行数:101,代码来源:FormSaleBLL.cs


注:本文中的BusinessObjects.MasterDataBLL.IsKaTypeNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。