public bool UpdateQuotation(T_quotation qt) { try { ph = new ProductHelper(); return ph.UpdateQuotation(qt); } catch (Exception) { throw; } }
public bool AddNewQtAndQtprice(T_quotation newqt, List<QtProduct> qtpricelst) { try { ph = new ProductHelper(); ph.AddNewQuotation(newqt); foreach (var qp in qtpricelst) { qp.qp.quotationid = newqt.id; } return ph.AddNewQtPriceList(qtpricelst); } catch (Exception) { throw; } }
/// <summary> /// 添加新报价单 /// </summary> /// <param name="newqt"></param> /// <returns></returns> public bool AddNewQuotation(T_quotation newqt) { try { ph = new ProductHelper(); return ph.AddNewQuotation(newqt); } catch (Exception) { throw; } }
/// <summary> /// 添加新的报价单 /// </summary> /// <param name="newqt"></param> /// <returns></returns> public bool AddNewQuotation(T_quotation newqt) { using (MEMSContext db = new MEMSContext()) { db.Entry(newqt).State = EntityState.Added; return db.SaveChanges() > 0 ? true : false; } }
/// <summary> /// 修改报价单 /// </summary> /// <param name="qt"></param> /// <returns></returns> public bool UpdateQuotation(T_quotation qt) { using (MEMSContext db = new MEMSContext()) { db.Entry(qt).State = EntityState.Modified; return db.SaveChanges() > 0 ? true : false; } }
protected override void FormLoad() { gcQtprice.DataSource = m_QtProductlst; barbtn1.Visibility = BarItemVisibility.Always; barbtn1.LargeImageIndex = 9; barbtn1.Caption = "添加产品"; txtQtPrice.Properties.ReadOnly = true; txtCustomer.Properties.ReadOnly = true; if (formmode == frmmodetype.add) { m_Qinfo = new T_quotation(); } else if (formmode==frmmodetype.edit) { m_Qinfo = m_crmclient.getQuotationbyId(m_qid); SetData(m_Qinfo); m_QtProductlst = m_crmclient.getQtProduct(m_qid); gcQtprice.DataSource = m_QtProductlst; barbtn1.Enabled = false; } else if (formmode == frmmodetype.delete) { m_Qinfo = m_crmclient.getQuotationbyId(m_qid); SetData(m_Qinfo); base.readonlytxtbox(this.Controls, true); m_QtProductlst = m_crmclient.getQtProduct(m_qid); gcQtprice.DataSource = m_QtProductlst; barbtn1.Enabled = false; } base.FormLoad(); }
/// <summary> /// 设置实体属性至窗体控件 /// </summary> /// <param name="qinfo"></param> private void SetData(T_quotation qinfo) { txtQuno.Text = qinfo.qutationno; txtQtPrice.Text = qinfo.quotationprice.HasValue ? qinfo.quotationprice.Value.ToString() : ""; txtProductRemark.Text = qinfo.productremark; txtQuremark.Text = qinfo.quremark; txtTheme.Text = qinfo.theme; dateQu.DateTime = qinfo.quotationdate.Value; if (qinfo.customerid.HasValue) { txtCustomer.Text = m_crmclient.getCustomerbyid(qinfo.customerid.Value).customername; } }
private void GetData(T_quotation qinfo) { qinfo.qutationno = txtQuno.Text; qinfo.theme = txtTheme.Text; qinfo.quotationprice = txtQtPrice.Text == "" ? 0 : Convert.ToDecimal(txtQtPrice.Text); qinfo.productremark = txtProductRemark.Text; qinfo.quremark = txtQuremark.Text; if (dateQu.Text == "") { qinfo.quotationdate = null; } else { qinfo.quotationdate = dateQu.DateTime; } }