Пример #1
0
        //get and set api
        protected bool getCard(out Card c)
        {
            //先获取status
            int tempStatus = 1;

            if (card != null)
            {
                tempStatus = card.Status;
            }

            c = new Card();

            c.Status = tempStatus;

            c.ID = cardID;

            string code;

            if (ValidateUtility.getName(this.textBox_serial, this.errorProvider1, out code) == false)
            {
                return(false);
            }
            c.Code = code;

            int customerID = -1;

            if (this.lookupText1.Visible == true && ValidateUtility.getLookupValueID(this.lookupText1, this.errorProvider1, out customerID) == false)
            {
                return(false);
            }

            c.CustomerID = customerID;

            c.CardTime = this.dateTime_cardTime.Value;
            c.Comment  = this.textBox_comment.Text;
            c.Oper     = this.textBox_operator.Text;


            c.CustomerName = this.lookupText1.Text_Lookup;

            double total;
            int    num, leftNum;

            if (ValidateUtility.getDouble(this.textBox_realTotal, this.errorProvider1, true, true, out total) &&
                ValidateUtility.getInt(this.textBox_num, this.errorProvider1, true, true, out num) &&
                ValidateUtility.getInt(this.textBox_leftNum, this.errorProvider1, true, true, out leftNum))
            {
                c.Total      = total;
                c.Number     = num;
                c.LeftNumber = leftNum;
            }
            else
            {
                return(false);
            }
            return(true);
        }
Пример #2
0
        /// <summary>
        /// for get value from controls
        /// </summary>
        //没有获取status
        protected bool getPayReceipt(out PayReceipt payReceipt)
        {
            payReceipt               = new PayReceipt();
            payReceipt.id            = this.payReceiptID;
            payReceipt.bill_type     = conf.type;
            payReceipt.bill_time     = this.dateTime_time.Value;
            payReceipt.handle_people = textBox_operator.Text;
            payReceipt.comment       = textBox_comment.Text;

            payReceipt.cashDirection   = conf.cashDirection;
            payReceipt.arrearDirection = conf.arrearDirection;

            string name;

            if (ValidateUtility.getName(this.textBox_serial, this.errorProvider1, out name) == false)
            {
                return(false);
            }
            payReceipt.serial = name;

            if (this.lookupText1.Visible == true && ValidateUtility.getLookupValueID(this.lookupText1, this.errorProvider1, out payReceipt.customer_id) == false)
            {
                return(false);
            }

            double sum = 0, pay, previousArrears;

            if ((this.panel_sum.Visible == false || ValidateUtility.getDouble(this.textBox_sum, this.errorProvider1, true, true, out sum))
                //如果是退点,本单付款就不是必填,否则为必填
                && (this.label_pay_need.Visible == true && ValidateUtility.getDouble(this.textBox_thisPayed, this.errorProvider1, true, true, out pay) || this.label_pay_need.Visible == false && ValidateUtility.getDouble(this.textBox_thisPayed, this.errorProvider1, false, true, out pay)) &&
                ValidateUtility.getDouble(this.textBox_previousArrears, this.errorProvider1, false, false, out previousArrears))
            {
                payReceipt.amount = sum;
                //欠款用的是呈现给用户看得,一般为正数
                payReceipt.previousArrears = previousArrears;
                payReceipt.thisPayed       = pay;
            }
            else
            {
                return(false);
            }

            return(true);
        }
Пример #3
0
        //get and set api
        protected bool getConsume(out Consume consume)
        {
            consume    = new Consume();
            consume.ID = consumeID;

            string code;

            if (ValidateUtility.getName(this.textBox_code, this.errorProvider1, out code) == false)
            {
                return(false);
            }
            consume.Code = code;

            int num = 1;

            if (ValidateUtility.getInt(this.textBox_num, this.errorProvider1, true, true, out num) == false)
            {
                return(false);
            }
            consume.Number = num;


            int cardID = -1;

            if (this.lookupText2.Visible == true && ValidateUtility.getLookupValueID(this.lookupText2, this.errorProvider1, out cardID) == false)
            {
                return(false);
            }

            consume.CardID = cardID;
            int leftNum = 0;

            int.TryParse(this.lookupText2.LookupArg.ArgName, out leftNum);
            consume.LeftNumber = leftNum;

            consume.ConsumeTime = this.dateTime_consumeTime.Value;
            consume.Comment     = this.textBox_comment.Text;
            consume.Oper        = this.textBox_operator.Text;

            return(true);
        }
        protected bool getCirculation(out ProductCirculation circulation)
        {
            circulation                 = new ProductCirculation();
            circulation.ID              = circulationID;
            circulation.Type            = (int)conf.type;
            circulation.FlowType        = conf.productDirection;
            circulation.ArrearDirection = conf.arrearsDirection;

            string name;

            if (ValidateUtility.getName(this.textBox_serial, this.errorProvider1, out name) == false)
            {
                return(false);
            }
            circulation.Code = name;

            int customerID = -1;

            if (this.lookupText1.Visible == true && ValidateUtility.getLookupValueID(this.lookupText1, this.errorProvider1, out customerID) == false)
            {
                return(false);
            }

            circulation.CustomerID = customerID;

            circulation.CirculationTime = this.dateTime_sellTime.Value;
            circulation.Comment         = this.textBox_comment.Text;
            circulation.Oper            = this.textBox_operator.Text;
            circulation.LastPayReceipt  = this.label_lastPayReceipt.Text;

            if (dataGridView2[1, 0].Value == null || dataGridView2[1, 0].Value.ToString() == "")
            {
                circulation.Total = 0;
            }
            else
            {
                circulation.Total = (double)dataGridView2[1, 0].Value;
            }

            circulation.CustomerName = this.lookupText1.Text_Lookup;

            double total, backFreightPerPiece, cutoff, realTotal, previousArrears, thisPayed, freight;

            if (ValidateUtility.getPrice(this.dataGridView2[1, 0], true, out total) &&
                ValidateUtility.getDouble(this.textBox_cutoff, this.errorProvider1, false, true, out cutoff) &&
                ValidateUtility.getPrice(this.textBox_backFreightPerPiece, this.errorProvider1, false, true, out backFreightPerPiece) &&
                ValidateUtility.getPrice(this.textBox_realTotal, this.errorProvider1, true, true, out realTotal) &&
                ValidateUtility.getPrice(this.textBox_previousArrears, this.errorProvider1, false, false, out previousArrears) &&
                ValidateUtility.getPrice(this.textBox_thisPayed, this.errorProvider1, false, true, out thisPayed) &&
                ValidateUtility.getPrice(this.textBox_freight, this.errorProvider1, false, true, out freight))
            {
                circulation.Total = total;
                circulation.BackFreightPerPiece = backFreightPerPiece;
                circulation.RealTotal           = realTotal;
                circulation.PreviousArrears     = previousArrears;
                circulation.ThisPayed           = thisPayed;
                circulation.Freight             = freight;
            }
            else
            {
                return(false);
            }

            return(true);
        }