public void GetSerialNoTest()
        {
            for (int i = 0; i < 10; i++)
            {
                Assert.IsTrue(SerialNoGenerator.GetSerialNo(SerialNoGenerator.Type.Type01Purchase).Length == 20);
                Assert.IsTrue(string.Compare("1.5.1", "1.5") > 0);
                Assert.IsTrue(string.Compare("1.5.1", "1.5") > 0);
                Assert.IsTrue(string.Compare("1.5.1", "1.4.8.7") > 0);

                int j = Convert.ToInt32("0xf", 16);
            }
        }
Пример #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (_is4Modify)
            {
                try
                {
                    _model.Corporation = txtCorporation.Text;
                    if (string.IsNullOrEmpty(txtProject.Text))
                    {
                        MessageBoxEx.Show("必须填写项目名称!");
                        return;
                    }
                    _model.Project  = txtProject.Text;
                    _model.Supplier = txtSupplier.Text;
                    _model.Amount   = DecimalHandler.Parse(txtAmount.Text);
                    _model.DuiZhang = DecimalHandler.Parse(txtDuiZhang.Text);


                    _model.InvoiceDate = DateTime.Parse(txtInvoiceDate.Text);
                    _model.ReceiptDate = DateTime.Parse(txtReceiptDate.Text);
                    _model.InvoiceNum  = DecimalHandler.Parse(txtInvoiceNum.Text);
                    _model.ReceiptNum  = DecimalHandler.Parse(txtReceiptNum.Text);

                    //下面的字段暂时不进行修改
                    //_model.EntryTime = DateTime.Now;
                    //_model.SerialNo = SerialNoGenerator.GetSerialNo(SerialNoGenerator.Type.Type03Receipt);
                    //_model.OperatorId = GlobalUtils.LoginUser.Id;
                    if (!_bllSaleBill.Update(_model))
                    {
                        MessageBoxEx.Show("更新失败,请稍后重试!");
                        return;
                    }
                    MessageBoxEx.Show("更新成功!");
                    _updateDel(_curPage);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                catch (Exception)
                {
                    MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!");
                    //throw;
                }
            }
            else
            {
                SteelManagement.Model.SaleBill model = new SteelManagement.Model.SaleBill();
                try
                {
                    model.Corporation = txtCorporation.Text;
                    if (string.IsNullOrEmpty(txtProject.Text))
                    {
                        MessageBoxEx.Show("必须填写项目名称!");
                        return;
                    }
                    model.Project  = txtProject.Text;
                    model.Supplier = txtSupplier.Text;
                    model.Amount   = DecimalHandler.Parse(txtAmount.Text);
                    model.DuiZhang = DecimalHandler.Parse(txtDuiZhang.Text);

                    model.InvoiceDate = DateTime.Parse(txtInvoiceDate.Text);
                    model.ReceiptDate = DateTime.Parse(txtReceiptDate.Text);
                    model.InvoiceNum  = DecimalHandler.Parse(txtInvoiceNum.Text);
                    model.ReceiptNum  = DecimalHandler.Parse(txtReceiptNum.Text);
                    model.EntryTime   = DateTime.Now;
                    model.SerialNo    = SerialNoGenerator.GetSerialNo(SerialNoGenerator.Type.Type05SaleBill);
                    model.OperatorId  = GlobalUtils.LoginUser.Id;

                    if (_bllSaleBill.Add(model) <= 0)
                    {
                        MessageBoxEx.Show("添加失败,请稍后重试!");
                        return;
                    }
                    MessageBoxEx.Show("添加成功");
                    _updateDel(_curPage);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                catch (Exception)
                {
                    MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!");
                    //throw;
                }
            }
        }
Пример #3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (_is4Modify)
            {
                try
                {
                    _model.DiaoZhuang  = DecimalHandler.Parse(txtDiaoZhuang.Text);
                    _model.LiXi        = DecimalHandler.Parse(txtLiXi.Text);
                    _model.ChengDui    = DecimalHandler.Parse(txtChengDui.Text);
                    _model.OtherCost   = DecimalHandler.Parse(txtOtherCost.Text);
                    _model.TieXi       = DecimalHandler.Parse(txtTieXi.Text);
                    _model.Corporation = txtCorporation.Text;


                    if (string.IsNullOrEmpty(txtProject.Text))
                    {
                        MessageBoxEx.Show("必须填写项目名称!");
                        return;
                    }

                    _model.Project       = txtProject.Text;
                    _model.Dateline      = DateTime.Parse(txtDateline.Text);
                    _model.Supplier      = txtSupplier.Text;
                    _model.Brand         = txtBrand.Text;
                    _model.TransportWay  = txtTransportWay.Text;
                    _model.Size          = txtSize.Text;
                    _model.Texture       = txtTexture.Text;
                    _model.Amount        = DecimalHandler.Parse(txtAmount.Text);
                    _model.Quote         = DecimalHandler.Parse(txtQuote.Text);
                    _model.Fluctuation1  = DecimalHandler.Parse(txtFluctuation1.Text);
                    _model.TransportCost = DecimalHandler.Parse(txtTransportCost.Text);
                    _model.Price         = DecimalHandler.Parse(txtPrice.Text);
                    _model.TotalMoney    = DecimalHandler.Parse(txtTotalMoney.Text);
                    _model.FuYuDate      = DateTime.Parse(txtFuYuDate.Text);
                    _model.Money1        = DecimalHandler.Parse(txtMoney1.Text);
                    _model.InvoiceDate   = DateTime.Parse(txtInvoiceDate.Text);
                    _model.Money2        = DecimalHandler.Parse(txtMoney2.Text);
                    if (!_bllPurchaseInfo.Update(_model))
                    {
                        MessageBoxEx.Show("更新失败,请稍后重试!");
                        return;
                    }
                    MessageBoxEx.Show("更新成功!");
                    _updateDel(_curPage);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                catch (Exception)
                {
                    MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!");
                    //throw;
                }
            }
            else
            {
                SteelManagement.Model.PurchaseInfo model = new SteelManagement.Model.PurchaseInfo();
                try
                {
                    model.Corporation = txtCorporation.Text;

                    if (string.IsNullOrEmpty(txtProject.Text))
                    {
                        MessageBoxEx.Show("必须填写项目名称!");
                        return;
                    }
                    model.Project = txtProject.Text;

                    model.Dateline      = DateTime.Parse(txtDateline.Text);
                    model.Supplier      = txtSupplier.Text;
                    model.Brand         = txtBrand.Text;
                    model.TransportWay  = txtTransportWay.Text;
                    model.Size          = txtSize.Text;
                    model.Texture       = txtTexture.Text;
                    model.Amount        = DecimalHandler.Parse(txtAmount.Text);
                    model.Quote         = DecimalHandler.Parse(txtQuote.Text);
                    model.Fluctuation1  = DecimalHandler.Parse(txtFluctuation1.Text);
                    model.TransportCost = DecimalHandler.Parse(txtTransportCost.Text);
                    model.Price         = DecimalHandler.Parse(txtPrice.Text);
                    model.TotalMoney    = DecimalHandler.Parse(txtTotalMoney.Text);
                    model.FuYuDate      = DateTime.Parse(txtFuYuDate.Text);
                    model.Money1        = DecimalHandler.Parse(txtMoney1.Text);
                    model.InvoiceDate   = DateTime.Parse(txtInvoiceDate.Text);
                    model.Money2        = DecimalHandler.Parse(txtMoney2.Text);
                    model.EntryTime     = DateTime.Now;
                    model.SerialNo      = SerialNoGenerator.GetSerialNo(SerialNoGenerator.Type.Type01Purchase);//生成流水号
                    model.OperatorId    = GlobalUtils.LoginUser.Id;

                    model.DiaoZhuang = DecimalHandler.Parse(txtDiaoZhuang.Text);
                    model.LiXi       = DecimalHandler.Parse(txtLiXi.Text);
                    model.ChengDui   = DecimalHandler.Parse(txtChengDui.Text);
                    model.OtherCost  = DecimalHandler.Parse(txtOtherCost.Text);
                    model.TieXi      = DecimalHandler.Parse(txtTieXi.Text);

                    if (_bllPurchaseInfo.Add(model) <= 0)
                    {
                        MessageBoxEx.Show("添加失败,请稍后重试!");
                        return;
                    }
                    MessageBoxEx.Show("添加成功");
                    _updateDel(_curPage);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                catch (Exception)
                {
                    MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!");
                    //throw;
                }
            }
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (_is4Modify)
            {
                try
                {
                    //_model.JianChiLv = DecimalHandler.Parse(txtJianChiLv.Text);
                    //_model.ArrivalTime = DateTime.Parse(txtArrivalTime.Text);
                    //_model.SettleTime = DateTime.Parse(txtSettleTime.Text);
                    //_model.Supplier = txtSupplier.Text;
                    //_model.Brand = txtBrand.Text;
                    //_model.TransportWay = txtTransportWay.Text;
                    //_model.Size = txtSize.Text;
                    //_model.Texture = txtTexture.Text;
                    //_model.Amount = DecimalHandler.Parse(txtAmount.Text);
                    //_model.Margin = DecimalHandler.Parse(txtMargin.Text);
                    //_model.OnlinePrice = DecimalHandler.Parse(txtOnlinePrice.Text);
                    //_model.Fluctuation1 = DecimalHandler.Parse(txtFluctuation1.Text);
                    //_model.Fluctuation2 = DecimalHandler.Parse(txtFluctuation2.Text);
                    //_model.SalePrice = DecimalHandler.Parse(txtSalePrice.Text);
                    //_model.TotalSale = DecimalHandler.Parse(txtTotalSale.Text);
                    //_model.MarginRate = DecimalHandler.Parse(txtMarginRate.Text);
                    if (!_bllReceiptInfo.Update(_model))
                    {
                        MessageBoxEx.Show("更新失败,请稍后重试!");
                        return;
                    }
                    MessageBoxEx.Show("更新成功!");
                    _updateDel(_curPage);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                catch (Exception)
                {
                    MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!");
                    //throw;
                }
            }
            else
            {
                SteelManagement.Model.ReceiptInfo model = new SteelManagement.Model.ReceiptInfo();
                try
                {
                    model.InvoiceDate = DateTime.Parse(txtInvoiceDate.Text);
                    model.ReceiptDate = DateTime.Parse(txtReceiptDate.Text);
                    model.InvoiceNum  = DecimalHandler.Parse(txtInvoiceNum.Text);
                    model.ReceiptNum  = DecimalHandler.Parse(txtReceiptNum.Text);
                    model.EntryTime   = DateTime.Now;
                    model.SerialNo    = SerialNoGenerator.GetSerialNo(SerialNoGenerator.Type.Type03Receipt);
                    model.OperatorId  = GlobalUtils.LoginUser.Id;

                    //上传图像
                    proPictureBox1.Image?.Save(GlobalUtils.LocalReceiptPicPath + "\\" + model.SerialNo + ".jpg");

                    if (_bllReceiptInfo.Add(model) <= 0)
                    {
                        MessageBoxEx.Show("添加失败,请稍后重试!");
                        return;
                    }
                    MessageBoxEx.Show("添加成功");
                    _updateDel(_curPage);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                catch (Exception)
                {
                    MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!");
                    //throw;
                }
            }
        }
Пример #5
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (_is4Modify)
            {
                try
                {
                    _model.Corporation = txtCorporation.Text;
                    if (string.IsNullOrEmpty(txtProject.Text))
                    {
                        MessageBoxEx.Show("项目名称不能为空!");
                        return;
                    }
                    _model.Project = txtProject.Text;
                    _model.TieXi   = DecimalHandler.Parse(txtTieXi.Text);
                    _model.LiXi    = DecimalHandler.Parse(txtLiXi.Text);

                    _model.JianChiLv    = DecimalHandler.Parse(txtJianChiLv.Text);
                    _model.ArrivalTime  = DateTime.Parse(txtArrivalTime.Text);
                    _model.SettleTime   = DateTime.Parse(txtSettleTime.Text);
                    _model.Supplier     = txtSupplier.Text;
                    _model.Brand        = txtBrand.Text;
                    _model.TransportWay = txtTransportWay.Text;
                    _model.Size         = txtSize.Text;
                    _model.Texture      = txtTexture.Text;
                    _model.Amount       = DecimalHandler.Parse(txtAmount.Text);
                    _model.Margin       = DecimalHandler.Parse(txtMargin.Text);
                    _model.OnlinePrice  = DecimalHandler.Parse(txtOnlinePrice.Text);
                    _model.Fluctuation1 = DecimalHandler.Parse(txtFluctuation1.Text);
                    _model.Fluctuation2 = DecimalHandler.Parse(txtFluctuation2.Text);
                    _model.SalePrice    = DecimalHandler.Parse(txtSalePrice.Text);
                    _model.TotalSale    = DecimalHandler.Parse(txtTotalSale.Text);
                    _model.MarginRate   = DecimalHandler.Parse(txtMarginRate.Text);
                    if (!_bllSaleInfo.Update(_model))
                    {
                        MessageBoxEx.Show("更新失败,请稍后重试!");
                        return;
                    }
                    MessageBoxEx.Show("更新成功!");
                    _updateDel(_curPage);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                catch (Exception)
                {
                    MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!");
                    //throw;
                }
            }
            else
            {
                SteelManagement.Model.SaleInfo model = new SteelManagement.Model.SaleInfo();
                try
                {
                    model.Corporation = txtCorporation.Text;
                    if (string.IsNullOrEmpty(txtProject.Text))
                    {
                        MessageBoxEx.Show("项目名称不能为空!");
                        return;
                    }
                    model.Project = txtProject.Text;
                    model.TieXi   = DecimalHandler.Parse(txtTieXi.Text);
                    model.LiXi    = DecimalHandler.Parse(txtLiXi.Text);

                    model.JianChiLv    = DecimalHandler.Parse(txtJianChiLv.Text);
                    model.ArrivalTime  = DateTime.Parse(txtArrivalTime.Text);
                    model.SettleTime   = DateTime.Parse(txtSettleTime.Text);
                    model.Supplier     = txtSupplier.Text;
                    model.Brand        = txtBrand.Text;
                    model.TransportWay = txtTransportWay.Text;
                    model.Size         = txtSize.Text;
                    model.Texture      = txtTexture.Text;
                    model.Amount       = DecimalHandler.Parse(txtAmount.Text);
                    model.Margin       = DecimalHandler.Parse(txtMargin.Text);
                    model.OnlinePrice  = DecimalHandler.Parse(txtOnlinePrice.Text);
                    model.Fluctuation1 = DecimalHandler.Parse(txtFluctuation1.Text);
                    model.Fluctuation2 = DecimalHandler.Parse(txtFluctuation2.Text);
                    model.SalePrice    = DecimalHandler.Parse(txtSalePrice.Text);
                    model.TotalSale    = DecimalHandler.Parse(txtTotalSale.Text);
                    model.MarginRate   = DecimalHandler.Parse(txtMarginRate.Text);
                    model.EntryTime    = DateTime.Now;
                    model.SerialNo     = SerialNoGenerator.GetSerialNo(SerialNoGenerator.Type.Type02Sale);
                    model.OperatorId   = GlobalUtils.LoginUser.Id;
                    if (_bllSaleInfo.Add(model) <= 0)
                    {
                        MessageBoxEx.Show("添加失败,请稍后重试!");
                        return;
                    }
                    MessageBoxEx.Show("添加成功");
                    _updateDel(_curPage);
                    this.DialogResult = DialogResult.OK;
                    this.Close();
                }
                catch (Exception)
                {
                    MessageBoxEx.Show("请检查输入是否有误,价格为0请填入0!");
                    //throw;
                }
            }
        }