Пример #1
0
        private bool getProduct(out ProductStainless product)
        {
            double price_purchase, price_sell, price_cost, num, quantityPerPiece;
            string name;
            int    categoryID;

            if (ValidateUtility.getName(this.textBox_name, this.errorProvider1, out name) &&
                ValidateUtility.getDouble(this.textBox_purchasePrice, this.errorProvider1, true, true, out price_purchase) &&
                ValidateUtility.getDouble(this.textBox_sellPrice, this.errorProvider1, true, true, out price_sell) &&
                ValidateUtility.getDouble(this.textBox_cost, this.errorProvider1, false, false, out price_cost) &&
                ValidateUtility.getDouble(this.textBox_quantityPerPiece, this.errorProvider1, false, true, out quantityPerPiece) &&
                ValidateUtility.getDouble(this.textBox_libNum, this.errorProvider1, false, false, out num) &&
                this.getCategoryID(out categoryID))
            {
                product    = new ProductStainless(this.textBox_serial.Text, name, categoryID, price_purchase, price_sell, this.comboBox_unit.Text, quantityPerPiece, this.textBox_comment.Text, this.radioButton2.Checked);
                product.ID = productID;
                //2018-4-16修正bug
                product.PriceCost = price_cost;
                product.Num       = num;
                return(true);
            }
            else
            {
                product = null;
                return(false);
            }
        }
Пример #2
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);
        }
Пример #3
0
 /// <summary>
 /// event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void toolStripButton3_Click(object sender, EventArgs e)
 {
     string path = null;
     if (ValidateUtility.getName(this.textBox_oldPs, this.errorProvider1, out path) == false)
         return;
     ConfDao.getInstance().Update(13, path);
     MessageBox.Show("保存路径成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     this.Close();
     
 }
Пример #4
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);
        }
Пример #5
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);
        }
Пример #6
0
        private bool getCustomer(out Customer customer)
        {
            string name;
            int    categoryID;
            double arrear;

            bool isNameCorrect     = ValidateUtility.getName(this.textBox_name, this.errorProvider1, out name);
            bool isCategoryCorrect = this.getCategoryID(out categoryID);
            bool isArrearCorrent   = ValidateUtility.getDouble(this.textBox_arrear, this.errorProvider1, false, false, out arrear);

            if (isNameCorrect && isCategoryCorrect && isArrearCorrent)
            {
                customer = new Customer(name, this.textBox_comment.Text, this.textBox_tel.Text,
                                        this.textBox_phone.Text, this.textBox_address.Text, categoryID, arrear);
                customer.ID = customerID;
                return(true);
            }
            else
            {
                customer = null;
                return(false);
            }
        }
Пример #7
0
        private void textBox_serial_Validating(object sender, CancelEventArgs e)
        {
            string temp;

            ValidateUtility.getName(this.textBox_code, this.errorProvider1, out temp);
        }
        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);
        }