Ejemplo n.º 1
0
 /// <summary>
 /// 删除销售订单主表
 /// </summary>
 /// <param name="so">销售订单主表</param>
 /// <returns></returns>
 public bool DeleteSaleOrder(T_saleorder so)
 {
     using (MEMSContext db = new MEMSContext())
     {
         db.Entry(so).State = EntityState.Deleted;
         return db.SaveChanges() > 0 ? true : false;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 添加新销售订单主从表信息
 /// </summary>
 /// <param name="so">主表对象</param>
 /// <param name="sdlist">从表对象</param>
 /// <returns></returns>
 public bool AddNewSaleOrder(T_saleorder so, List<T_saledetail> sdlist)
 {
     using (MEMSContext db = new MEMSContext())
     {
         db.Entry(so).State = EntityState.Added;
         db.SaveChanges();
         foreach (var sd in sdlist)
         {
             sd.soid = so.id;
             db.Entry(sd).State = EntityState.Added;
         }
         return db.SaveChanges() > 0 ? true : false;
     }
 }
Ejemplo n.º 3
0
        protected override void FormLoad()
        {
            base.FormLoad();
            InitCustomerCmb();
            //DisPlayEnum.ExtGetEnumDS(lkpPeriodUnit, typeof(periodUnit));
            var pUds = DisPlayEnum.getEnumDS(typeof(periodUnit));
            lkpPeriodUnit.ExtBindingDataSource(pUds, "key", "value");
            //DisPlayEnum.ExtGetEnumDS(lkpRevType, typeof(receiveType));
            var rtds = DisPlayEnum.getEnumDS(typeof(receiveType));
            lkpRevType.ExtBindingDataSource(rtds, "key", "value");
            this.barbtn1.Visibility = BarItemVisibility.Always;
            this.barbtn1.LargeImageIndex = 8;
            gcSaledetail.DataSource = m_saleProducts;
            if (formmode == frmmodetype.add)
            {
                m_saleorder = new T_saleorder();
            }
            else if (formmode == frmmodetype.edit)
            {
                m_saleorder = m_ssclient.getSaleOrderbyId(m_soid);
                SetData(m_saleorder);
                m_saleProducts = m_ssclient.getSaleProductbysoid(m_soid);
                gcSaledetail.DataSource = m_saleProducts;
                gvSaledetail.RefreshData();

                colpcode.OptionsColumn.AllowEdit = false;
                colpname.OptionsColumn.AllowEdit = false;
                colpspec.OptionsColumn.AllowEdit = false;
                colpmodelprice.OptionsColumn.AllowEdit = false;
                colpunitprice.OptionsColumn.AllowEdit = false;
                colptotalprice.OptionsColumn.AllowEdit = false;
            }
            else if (formmode == frmmodetype.delete)
            {
                m_saleorder = m_ssclient.getSaleOrderbyId(m_soid);
                SetData(m_saleorder);
                readonlytxtbox(this.Controls, true);
                gvSaledetail.OptionsBehavior.Editable = false;
                m_saleProducts = m_ssclient.getSaleProductbysoid(m_soid);
                gcSaledetail.RefreshDataSource();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 设置数据至控件
        /// </summary>
        /// <param name="saleOrder"></param>
        private void SetData(T_saleorder saleOrder)
        {
            txtSono.Text = saleOrder.saleno;
            txtOrderAmt.Text = saleOrder.saletotalamount.HasValue ? saleOrder.saletotalamount.Value.ToString() : "";
            txtPeriod.Text = saleOrder.receiveperiod.HasValue ? saleOrder.receiveperiod.Value.ToString() : "";
            txtremarks.Text = saleOrder.remarks;
            if (saleOrder.receiveamount.HasValue)
            {
                txtRevAmt.Text = saleOrder.receiveamount.Value.ToString();
            }

            //txtRevAmt.Text = saleOrder.receiveamount.HasValue ? saleOrder.receiveamount.Value.ToString() : "";
            //txtRevRatio.Text = (saleOrder.receiveratio.HasValue ? saleOrder.receiveratio.Value.ToString() : "0") + "%";
            txtRevRatio.Text = saleOrder.receiveratio;
            //txtRevStatus.Text = DisPlayEnum.getEnumName(typeof(receiveState), saleOrder.receivestate);
            txtRevStatus.Text = ((receiveState)saleOrder.receivestate).ToString();
            //txtOrderStatus.Text = DisPlayEnum.getEnumName(typeof(orderState), saleOrder.orderstate);
            txtOrderStatus.Text = ((orderState)saleOrder.orderstate).ToString();
            dateSaleOrder.DateTime = saleOrder.saledate;
            lkpPeriodUnit.EditValue = saleOrder.receiveperiodtype;

            lkpRevType.EditValue = saleOrder.receivetype;
            lkpcustomer.EditValue = saleOrder.customerid;
            InitQt(saleOrder.customerid);
            lkpqtno.EditValue = saleOrder.quotationid;
        }
Ejemplo n.º 5
0
 private void getData(T_saleorder saleOrder)
 {
     saleOrder.saleno = txtSono.Text;
     if (lkpcustomer.EditValue == null)
     {
         throw new Exception("请选择客户");
     }
     saleOrder.customerid = (int)lkpcustomer.EditValue;
     if (lkpqtno.EditValue == null)
     {
         throw new Exception("请选择报价单");
     }
     saleOrder.quotationid = (int)lkpqtno.EditValue;
     saleOrder.saledate = dateSaleOrder.DateTime;
     saleOrder.saletotalamount = txtOrderAmt.Text == "" ? 0 : Convert.ToDecimal(txtOrderAmt.Text);
     //saleOrder.receiveamount = Convert.ToDecimal(txtRevAmt.Text);
     //saleOrder.receiveratio = Convert.ToDecimal(txtRevRatio.Text);
     if (lkpRevType.EditValue == null)
     {
         throw new Exception("请选择收款类型");
     }
     saleOrder.receivetype = (int)lkpRevType.EditValue;
     if (lkpPeriodUnit.EditValue == null)
     {
         throw new Exception("请选择账期类型");
     }
     saleOrder.receiveperiodtype = (int)lkpPeriodUnit.EditValue;
     saleOrder.receiveperiod = txtPeriod.Text == "" ? 0 : Convert.ToInt32(txtPeriod.Text);
     saleOrder.remarks = txtremarks.Text;
 }
Ejemplo n.º 6
0
        protected override void FormLoad()
        {
            base.FormLoad();
            var customerlst = m_crmclient.getCustomerList();
            lkpcustomer.ExtBindingDataSource<T_Customer>(customerlst, "id", "customername");

            var pUds = DisPlayEnum.getEnumDS(typeof(periodUnit));
            lkpPeriodUnit.ExtBindingDataSource(pUds, "key", "value");

            var rtds = DisPlayEnum.getEnumDS(typeof(receiveType));
            lkpRevType.ExtBindingDataSource(rtds, "key", "value");

            readonlytxtbox(this.Controls, true);

            m_saleorder = m_ssclient.getSaleOrderbyId(m_soid);
            SetData(m_saleorder);
            if (m_saleorder.receivetype == (int)receiveType.按产品明细收款)
            {
                m_saleProducts = m_ssclient.getSaleProductbysoid(m_soid);
                gcRecieve.DataSource = m_saleProducts;
                gcRecieve.MainView = gvSaledetail;
                //gvSaledetail.RefreshData();
                colpcount.OptionsColumn.AllowEdit = false;
                colpcode.OptionsColumn.AllowEdit = false;
                colpname.OptionsColumn.AllowEdit = false;
                colpspec.OptionsColumn.AllowEdit = false;
                colpmodelprice.OptionsColumn.AllowEdit = false;
                colpunitprice.OptionsColumn.AllowEdit = false;
                colptotalprice.OptionsColumn.AllowEdit = false;
                colpcount.OptionsColumn.AllowEdit = false;

            }
            else
            {
                this.barbtn1.Visibility = BarItemVisibility.Always;
                this.barbtn1.LargeImageIndex = 8;
                this.barbtn1.Caption = "收款登记";
                this.ribbonPageGroup2.Visible = true;
                m_saleRev = m_ssclient.getSaleRevbySoid(m_soid);
                gcRecieve.DataSource = m_saleRev;
                gcRecieve.MainView = gvSaleRev;
                colsrid.Visible = false;
                colsoid.Visible = false;
                coluid.OptionsColumn.AllowEdit = false;
            }
        }