Exemplo n.º 1
0
        public void Customer_Insert(FactoryArgs args, out t_BigID CustomerID, t_String CustomerCode, t_String CustomerName, t_String Contact, t_String Phone, t_String Address,
                                    t_Bool CarIsLimit, t_ID AmountType, t_String LicenceNum, t_String Description, t_ID ReceiveType,
                                    t_Decimal CreditAmount, t_Bool IsDisplayPrice, t_Bool IsDisplayAmount, t_Bool IsPrintAmount, t_Bool IsAllowOverFul,
                                    t_Bool IsAllowEmptyIn, t_Decimal AmountNotEnough, t_String K3CustomerCode, t_BigID CustomerTypeID)
        {
            CustomerTypeID.NullIfZero();
            CarIsLimit.IsNullToZero();
            IsDisplayPrice.IsNullToZero();
            IsDisplayAmount.IsNullToZero();
            IsPrintAmount.IsNullToZero();
            IsAllowOverFul.IsNullToZero();
            CreditAmount.IsNullToZero();
            CreditAmount.IsNullToZero();

            CustomerID = new t_BigID();
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("CustomerID", CustomerID, true));
            parms.Add(new LBDbParameter("CustomerCode", CustomerCode));
            parms.Add(new LBDbParameter("CustomerName", CustomerName));
            parms.Add(new LBDbParameter("CustomerTypeID", CustomerTypeID));
            parms.Add(new LBDbParameter("Contact", Contact));
            parms.Add(new LBDbParameter("Phone", Phone));
            parms.Add(new LBDbParameter("Address", Address));
            parms.Add(new LBDbParameter("CarIsLimit", CarIsLimit));
            parms.Add(new LBDbParameter("AmountType", AmountType));
            parms.Add(new LBDbParameter("LicenceNum", LicenceNum));
            parms.Add(new LBDbParameter("Description", Description));
            parms.Add(new LBDbParameter("ReceiveType", ReceiveType));
            parms.Add(new LBDbParameter("CreditAmount", CreditAmount));
            parms.Add(new LBDbParameter("IsDisplayPrice", IsDisplayPrice));
            parms.Add(new LBDbParameter("IsDisplayAmount", IsDisplayAmount));
            parms.Add(new LBDbParameter("IsPrintAmount", IsPrintAmount));
            parms.Add(new LBDbParameter("IsAllowOverFul", IsAllowOverFul));
            parms.Add(new LBDbParameter("IsAllowEmptyIn", IsAllowEmptyIn));
            parms.Add(new LBDbParameter("CreateBy", new t_String(args.LoginName)));
            parms.Add(new LBDbParameter("CreateTime", new t_DTSmall(DateTime.Now)));
            parms.Add(new LBDbParameter("ChangeBy", new t_String(args.LoginName)));
            parms.Add(new LBDbParameter("ChangeTime", new t_DTSmall(DateTime.Now)));
            parms.Add(new LBDbParameter("AmountNotEnough", AmountNotEnough));
            parms.Add(new LBDbParameter("K3CustomerCode", K3CustomerCode));

            string strSQL = @"
insert into dbo.DbCustomer(CustomerCode,CustomerName, Contact, Phone, Address, CarIsLimit, AmountType, LicenceNum, 
    Description, ReceiveType, CreditAmount, IsDisplayPrice, IsDisplayAmount, IsPrintAmount, IsAllowOverFul, 
    CreateBy, CreateTime, ChangeBy, ChangeTime,IsAllowEmptyIn,AmountNotEnough,K3CustomerCode, CustomerTypeID)
values(@CustomerCode, @CustomerName, @Contact, @Phone, @Address, @CarIsLimit, @AmountType, @LicenceNum, 
    @Description, @ReceiveType, @CreditAmount, @IsDisplayPrice, @IsDisplayAmount, @IsPrintAmount, @IsAllowOverFul, 
    @CreateBy, @CreateTime, @ChangeBy, @ChangeTime,@IsAllowEmptyIn,@AmountNotEnough,@K3CustomerCode, @CustomerTypeID)

set @CustomerID = @@identity
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
            CustomerID.Value = Convert.ToInt64(parms["CustomerID"].Value);
        }
Exemplo n.º 2
0
        public void Car_Insert(FactoryArgs args, out t_BigID CarID, out t_String CarCode, t_String CarNum,
                               t_BigID SupplierID, t_BigID CardID, t_String Description, t_Decimal DefaultCarWeight)
        {
            CarCode = new t_String();
            CarID   = new t_BigID();
            DefaultCarWeight.IsNullToZero();
            CardID.NullIfZero();
            SupplierID.NullIfZero();
            using (DataTable dtCar = _DALDbCar.GetCarByName(args, CarID, CarNum))
            {
                if (dtCar.Rows.Count > 0)
                {
                    throw new Exception("该车牌号码已存在!");
                }
            }

            t_BigID  CarID_temp   = new t_BigID();
            t_String CarCode_temp = new t_String();

            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                t_String MaxCode;
                _DALDbCar.GetMaxCarCode(argsInTrans, out MaxCode);
                int CodeIndex = MaxCode.Value == null ? 0 : LBConverter.ToInt32(MaxCode.Value.Replace("C", ""));
                CodeIndex++;
                if (CodeIndex < 10)
                {
                    CarCode_temp.SetValueWithObject("C000" + CodeIndex.ToString());
                }
                else if (CodeIndex < 100)
                {
                    CarCode_temp.SetValueWithObject("C00" + CodeIndex.ToString());
                }
                else if (CodeIndex < 1000)
                {
                    CarCode_temp.SetValueWithObject("C0" + CodeIndex.ToString());
                }
                else
                {
                    CarCode_temp.SetValueWithObject("C" + CodeIndex.ToString());
                }

                if (CardID.Value > 0)//取消卡片的车辆关联
                {
                    CancelRefCard(argsInTrans, CardID);
                }

                _DALDbCar.Car_Insert(argsInTrans, out CarID_temp, CarCode_temp, CarNum, Description, DefaultCarWeight, SupplierID, CardID);
            };
            DBHelper.ExecInTrans(args, exec);
            CarID.Value   = CarID_temp.Value;
            CarCode.Value = CarCode_temp.Value;
        }
Exemplo n.º 3
0
        public void Car_Update(FactoryArgs args, t_BigID CarID, t_String CarNum,
                               t_BigID CustomerID, t_String Description, t_Decimal DefaultCarWeight)
        {
            DefaultCarWeight.IsNullToZero();
            using (DataTable dtCar = _DALDbCar.GetCarByName(args, CarID, CarNum))
            {
                if (dtCar.Rows.Count > 0)
                {
                    throw new Exception("该车牌号码已存在!");
                }
            }

            _DALDbCar.Car_Update(args, CarID, CarNum, Description, DefaultCarWeight);
        }
Exemplo n.º 4
0
        public void UpdateAmount(FactoryArgs args, t_BigID CustomerID, t_Decimal TotalReceivedAmount, t_Decimal SalesReceivedAmount)
        {
            TotalReceivedAmount.IsNullToZero();
            SalesReceivedAmount.IsNullToZero();

            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("CustomerID", CustomerID));
            parms.Add(new LBDbParameter("TotalReceivedAmount", TotalReceivedAmount));
            parms.Add(new LBDbParameter("SalesReceivedAmount", SalesReceivedAmount));

            string strSQL = @"
update dbo.DbCustomer
set TotalReceivedAmount = @TotalReceivedAmount, 
    SalesReceivedAmount=@SalesReceivedAmount
where CustomerID =  @CustomerID
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
Exemplo n.º 5
0
        public void UpdateCustomerReceiveAmount(FactoryArgs args, t_BigID CustomerID, t_Decimal ReceiveAmount,
                                                t_Decimal SalesReceiveAmountAdd, t_Decimal SalesReceiveAmountReduce)
        {
            SalesReceiveAmountAdd.IsNullToZero();
            SalesReceiveAmountReduce.IsNullToZero();
            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("CustomerID", CustomerID));
            parms.Add(new LBDbParameter("ReceiveAmount", ReceiveAmount));
            parms.Add(new LBDbParameter("SalesReceiveAmountAdd", SalesReceiveAmountAdd));
            parms.Add(new LBDbParameter("SalesReceiveAmountReduce", SalesReceiveAmountReduce));
            string strSQL = @"
update dbo.DbCustomer
set TotalReceivedAmount = isnull(TotalReceivedAmount,0)+isnull(@ReceiveAmount,0),
    SalesReceivedAmount= isnull(SalesReceivedAmount,0)+@SalesReceiveAmountAdd-@SalesReceiveAmountReduce,
    ChangeBy = getdate()
where CustomerID = @CustomerID
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }
Exemplo n.º 6
0
        public void Car_Update(FactoryArgs args, t_BigID CarID, t_String CarNum,
                               t_BigID CustomerID, t_String Description, t_Decimal DefaultCarWeight,
                               t_BigID SupplierID, t_BigID CardID)
        {
            DefaultCarWeight.IsNullToZero();
            using (DataTable dtCar = _DALDbCar.GetCarByName(args, CarID, CarNum))
            {
                if (dtCar.Rows.Count > 0)
                {
                    throw new Exception("该车牌号码已存在!");
                }
            }

            DBHelper.ExecInTransDelegate exec = delegate(FactoryArgs argsInTrans)
            {
                if (CardID.Value > 0)//取消卡片的车辆关联
                {
                    CancelRefCard(argsInTrans, CardID);
                }
                _DALDbCar.Car_Update(argsInTrans, CarID, CarNum, Description, DefaultCarWeight, SupplierID, CardID);
            };
            DBHelper.ExecInTrans(args, exec);
        }
Exemplo n.º 7
0
        public void Customer_Update(FactoryArgs args, t_BigID CustomerID, t_String CustomerName, t_String Contact, t_String Phone, t_String Address,
                                    t_Bool CarIsLimit, t_ID AmountType, t_String LicenceNum, t_String Description, t_ID ReceiveType,
                                    t_Decimal CreditAmount, t_Bool IsDisplayPrice, t_Bool IsDisplayAmount, t_Bool IsPrintAmount, t_Bool IsAllowOverFul,
                                    t_Bool IsAllowEmptyIn, t_Decimal AmountNotEnough, t_String K3CustomerCode, t_BigID CustomerTypeID)
        {
            CustomerTypeID.NullIfZero();
            CarIsLimit.IsNullToZero();
            IsDisplayPrice.IsNullToZero();
            IsDisplayAmount.IsNullToZero();
            IsPrintAmount.IsNullToZero();
            IsAllowOverFul.IsNullToZero();
            CreditAmount.IsNullToZero();
            CreditAmount.IsNullToZero();

            LBDbParameterCollection parms = new LBDbParameterCollection();

            parms.Add(new LBDbParameter("CustomerID", CustomerID));
            parms.Add(new LBDbParameter("CustomerName", CustomerName));
            parms.Add(new LBDbParameter("CustomerTypeID", CustomerTypeID));
            parms.Add(new LBDbParameter("Contact", Contact));
            parms.Add(new LBDbParameter("Phone", Phone));
            parms.Add(new LBDbParameter("Address", Address));
            parms.Add(new LBDbParameter("CarIsLimit", CarIsLimit));
            parms.Add(new LBDbParameter("AmountType", AmountType));
            parms.Add(new LBDbParameter("LicenceNum", LicenceNum));
            parms.Add(new LBDbParameter("Description", Description));
            parms.Add(new LBDbParameter("ReceiveType", ReceiveType));
            parms.Add(new LBDbParameter("CreditAmount", CreditAmount));
            parms.Add(new LBDbParameter("IsDisplayPrice", IsDisplayPrice));
            parms.Add(new LBDbParameter("IsDisplayAmount", IsDisplayAmount));
            parms.Add(new LBDbParameter("IsPrintAmount", IsPrintAmount));
            parms.Add(new LBDbParameter("IsAllowOverFul", IsAllowOverFul));
            parms.Add(new LBDbParameter("IsAllowEmptyIn", IsAllowEmptyIn));
            parms.Add(new LBDbParameter("ChangeBy", new t_String(args.LoginName)));
            parms.Add(new LBDbParameter("ChangeTime", new t_DTSmall(DateTime.Now)));
            parms.Add(new LBDbParameter("AmountNotEnough", AmountNotEnough));
            parms.Add(new LBDbParameter("K3CustomerCode", K3CustomerCode));

            string strSQL = @"
update dbo.DbCustomer
set CustomerName = @CustomerName, 
    Contact=@Contact, 
    Phone=@Phone, 
    Address=@Address, 
    CarIsLimit=@CarIsLimit, 
    AmountType=@AmountType, 
    LicenceNum=@LicenceNum, 
    Description=@Description,
    ReceiveType=@ReceiveType, 
    CreditAmount=@CreditAmount, 
    IsDisplayPrice=@IsDisplayPrice, 
    IsDisplayAmount=@IsDisplayAmount, 
    IsPrintAmount=@IsPrintAmount, 
    IsAllowOverFul=@IsAllowOverFul, 
    ChangeBy=@ChangeBy, 
    ChangeTime=@ChangeTime,
    IsAllowEmptyIn = @IsAllowEmptyIn,   
    AmountNotEnough = @AmountNotEnough,
    K3CustomerCode = @K3CustomerCode,
    CustomerTypeID = @CustomerTypeID
where CustomerID =  @CustomerID
";

            DBHelper.ExecuteNonQuery(args, System.Data.CommandType.Text, strSQL, parms, false);
        }