예제 #1
0
        /// <summary>
        /// 新增价格版本
        /// </summary>
        protected override void custom1()
        {
            T_ProductbasicPrice pv = new T_ProductbasicPrice();
            var verstring          = m_client.getPriceVersion(m_pid);

            pv.version = DateTime.Now.Date.ToString("yyyyMMdd") + verstring;
            cmbpriceName.Properties.Items.Insert(0, pv.version);
            (cmbpriceName.Tag as List <T_ProductbasicPrice>).Insert(0, pv);
            cmbpriceName.SelectedIndex = 0;
            base.readonlytxtbox(this.Controls, false);
            newversion           = true;
            base.barbtn1.Enabled = false;
            List <T_CraftsPrice> newcraftpricelst = new List <T_CraftsPrice>();

            foreach (var craft in m_craftlst)
            {
                var craftprice = new T_CraftsPrice();
                craftprice.pid         = craft.pid;
                craftprice.processid   = craft.id;
                craftprice.processidx  = craft.processindex;
                craftprice.processname = craft.processname;
                newcraftpricelst.Add(craftprice);
            }
            gccraftprice.DataSource = newcraftpricelst;
            gvcraftprice.Columns["processprice"].OptionsColumn.AllowEdit = true;
            txttotalprice.Properties.ReadOnly = true;
        }
예제 #2
0
 public bool AddNewProductPrice(T_ProductbasicPrice price, List <T_CraftsPrice> newcplist)
 {
     try
     {
         ph = new ProductHelper();
         int pbid = ph.AddProductPrice(price);
         return(ph.AddNewCraftPricelst(newcplist, pbid));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #3
0
 /// <summary>
 /// 返回pricebasicid
 /// </summary>
 /// <param name="price"></param>
 /// <returns></returns>
 public int AddProductPrice(T_ProductbasicPrice price)
 {
     using (MEMSContext db = new MEMSContext())
     {
         db.Entry(price).State = EntityState.Added;
         var success = db.SaveChanges() > 0 ? true : false;
         if (success)
         {
             return(price.id);
         }
         else
         {
             return(0);
         }
     }
 }
예제 #4
0
 /// <summary>
 /// 设置价格信息放入txtbox
 /// </summary>
 /// <param name="pv"></param>
 private void setData(T_ProductbasicPrice pv)
 {
     try
     {
         txtmanageprice.Text       = pv.manageprice.HasValue ? pv.manageprice.Value.ToString() : "";
         txtmaterialprice.Text     = pv.materialprice.HasValue ? pv.materialprice.Value.ToString() : "";
         txtmaterialpricedesc.Text = pv.materialpricedesc;
         txtmgrpricedesc.Text      = pv.mgrpricedesc;
         txtotherprice.Text        = pv.otherprice.HasValue ? pv.otherprice.Value.ToString() : "";
         txtotherpricedesc.Text    = pv.otherpricedesc;
         txtreturnpricedesc.Text   = pv.returnpricedesc;
         txtreturnmatprice.Text    = pv.returnmatprice.HasValue ? pv.returnmatprice.Value.ToString() : "";
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message);
     }
 }
예제 #5
0
 /// <summary>
 /// 保存价格
 /// </summary>
 protected override void EditObject()
 {
     if (newversion)
     {
         m_pv           = getDataFromTxt((cmbpriceName.Tag as List <T_ProductbasicPrice>)[0]);
         m_pv.productid = m_pid;
         var newcraftpricelst = (List <T_CraftsPrice>)gccraftprice.DataSource;
         gvcraftprice.CloseEditor();
         foreach (var newcraftprice in newcraftpricelst)
         {
             if (!newcraftprice.processprice.HasValue)
             {
                 throw new Exception("工序" + newcraftprice.processname + "未输入值");
             }
         }
         var success = m_client.AddNewProductPrice(m_pv, newcraftpricelst);
     }
     base.EditObject();
 }
예제 #6
0
 /// <summary>
 /// 从txtbox获取价格信息
 /// </summary>
 /// <param name="pv"></param>
 /// <returns></returns>
 private T_ProductbasicPrice getDataFromTxt(T_ProductbasicPrice pv)
 {
     try
     {
         pv.manageprice       = txtmanageprice.Text == string.Empty ? 0 : Convert.ToDecimal(txtmanageprice.Text);
         pv.materialprice     = txtmaterialprice.Text == string.Empty ? 0 : Convert.ToDecimal(txtmaterialprice.Text);
         pv.materialpricedesc = txtmaterialpricedesc.Text;
         pv.mgrpricedesc      = txtmgrpricedesc.Text;
         pv.otherprice        = txtotherprice.Text == "" ? 0 : Convert.ToDecimal(txtotherprice.Text);
         pv.otherpricedesc    = txtotherpricedesc.Text;
         pv.returnmatprice    = txtreturnmatprice.Text == "" ? 0 : Convert.ToDecimal(txtreturnmatprice.Text);
         pv.returnpricedesc   = txtreturnpricedesc.Text;
         return(pv);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }