Esempio n. 1
0
        public void Supplier_Update(FactoryArgs args, t_BigID SupplierID, t_String SupplierName, t_ID IsForbidden)
        {
            IsForbidden.IsNullToZero();
            using (DataTable dtCar = _DALDbSupplier.GetSupplierByName(args, SupplierID, SupplierName))
            {
                if (dtCar.Rows.Count > 0)
                {
                    throw new Exception("该供应商名称已存在!");
                }
            }

            _DALDbSupplier.Supplier_Update(args, SupplierID, SupplierName, IsForbidden);
        }
Esempio n. 2
0
        public void Supplier_Insert(FactoryArgs args, out t_BigID SupplierID, out t_String SupplierCode, t_String SupplierName, t_ID IsForbidden)
        {
            SupplierCode = new t_String();
            SupplierID   = new t_BigID();
            IsForbidden.IsNullToZero();
            using (DataTable dtSupplier = _DALDbSupplier.GetSupplierByName(args, SupplierID, SupplierName))
            {
                if (dtSupplier.Rows.Count > 0)
                {
                    throw new Exception("该供应商名称已存在!");
                }
            }

            t_BigID  SupplierID_temp   = new t_BigID();
            t_String SupplierCode_temp = new t_String();

            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                t_String MaxCode;
                _DALDbSupplier.GetMaxCarCode(argsInTrans, out MaxCode);
                int CodeIndex = MaxCode.Value == null ? 0 : LBConverter.ToInt32(MaxCode.Value.Replace("G", ""));
                CodeIndex++;
                if (CodeIndex < 10)
                {
                    SupplierCode_temp.SetValueWithObject("G0" + CodeIndex.ToString());
                }
                else
                {
                    SupplierCode_temp.SetValueWithObject("G" + CodeIndex.ToString());
                }

                _DALDbSupplier.Supplier_Insert(argsInTrans, out SupplierID_temp, SupplierName, SupplierCode_temp, IsForbidden);
            };
            DBHelper.ExecInTrans(args, exec);
            SupplierID.Value   = SupplierID_temp.Value;
            SupplierCode.Value = SupplierCode_temp.Value;
        }
Esempio n. 3
0
        public void Update(FactoryArgs args, t_BigID ReceiveBillHeaderID, t_DTSmall BillDate, t_Decimal ReceiveAmount,
                           t_String Description, t_BigID ReceiveBankID, t_ID RPReceiveType, t_Decimal SalesReceiveAmountAdd,
                           t_Decimal SalesReceiveAmountReduce, t_Decimal OriginalAmount, t_BigID ChargeTypeID)
        {
            RPReceiveType.IsNullToZero();

            if (ReceiveAmount.Value == 0)
            {
                throw new Exception("充值金额不能为0!");
            }

            using (DataTable dtHeader = _DALRPReceiveBillHeader.GetRPReceiveBillHeader(args, ReceiveBillHeaderID))
            {
                if (dtHeader.Rows.Count > 0)
                {
                    DataRow drHeader     = dtHeader.Rows[0];
                    bool    bolIsApprove = LBConverter.ToBoolean(drHeader["IsApprove"]);
                    bool    bolIsCancel  = LBConverter.ToBoolean(drHeader["IsCancel"]);
                    if (bolIsApprove)
                    {
                        throw new Exception("该充值单已审核,无法进行修改!");
                    }
                    if (bolIsCancel)
                    {
                        throw new Exception("该充值单已作废,无法进行修改!");
                    }
                }
                else
                {
                    throw new Exception("该充值单已删除,无法进行修改!");
                }
            }
            _DALRPReceiveBillHeader.Update(args, ReceiveBillHeaderID, BillDate, ReceiveAmount,
                                           Description, ReceiveBankID, RPReceiveType, SalesReceiveAmountAdd, SalesReceiveAmountReduce, OriginalAmount,
                                           ChargeTypeID);
        }
Esempio n. 4
0
        public void Insert(FactoryArgs args, out t_BigID ReceiveBillHeaderID, out t_String ReceiveBillCode, t_DTSmall BillDate, t_BigID CustomerID, t_Decimal ReceiveAmount,
                           t_String Description, t_BigID SaleCarInBillID, t_BigID ReceiveBankID, t_ID RPReceiveType,
                           t_Decimal SalesReceiveAmountAdd, t_Decimal SalesReceiveAmountReduce, t_Decimal OriginalAmount,
                           t_BigID ChargeTypeID)
        {
            BillDate = new t_DTSmall(DateTime.Now);
            ReceiveBankID.NullIfZero();
            RPReceiveType.IsNullToZero();
            ReceiveBillCode = new t_String();

            if (ReceiveAmount.Value == 0)
            {
                throw new Exception("充值金额不能为0!");
            }
            //生成编码
            string strBillFont = "SK" + DateTime.Now.ToString("yyyyMM") + "-";

            using (DataTable dtBillCode = _DALRPReceiveBillHeader.GetMaxBillCode(args, strBillFont))
            {
                if (dtBillCode.Rows.Count > 0)
                {
                    DataRow drBillCode = dtBillCode.Rows[0];
                    int     iIndex     = 1;
                    string  strIndex   = "";
                    if (drBillCode["ReceiveBillCode"].ToString().TrimEnd().Contains(strBillFont))
                    {
                        iIndex  = Convert.ToInt32(drBillCode["ReceiveBillCode"].ToString().TrimEnd().Replace(strBillFont, ""));
                        iIndex += 1;
                        if (iIndex < 10)
                        {
                            strIndex = "0000" + iIndex.ToString();
                        }
                        else if (iIndex < 100)
                        {
                            strIndex = "000" + iIndex.ToString();
                        }
                        else if (iIndex < 1000)
                        {
                            strIndex = "00" + iIndex.ToString();
                        }
                        else if (iIndex < 10000)
                        {
                            strIndex = "0" + iIndex.ToString();
                        }
                        else
                        {
                            strIndex = iIndex.ToString();
                        }
                        ReceiveBillCode.SetValueWithObject(strBillFont + strIndex);
                    }
                    else
                    {
                        ReceiveBillCode.SetValueWithObject(strBillFont + "00001");
                    }
                }
                else
                {
                    ReceiveBillCode.SetValueWithObject(strBillFont + "00001");
                }
            }

            _DALRPReceiveBillHeader.Insert(args, out ReceiveBillHeaderID, ReceiveBillCode, BillDate, CustomerID, ReceiveAmount, Description, SaleCarInBillID,
                                           ReceiveBankID, RPReceiveType, SalesReceiveAmountAdd, SalesReceiveAmountReduce, OriginalAmount, ChargeTypeID);
        }