コード例 #1
0
        void IOrder.Save()
        {
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                //
                if (txtbranch.Text.Trim().Contains("/") == false)
                {
                    throw new Exception("机构必填!");
                }
                if (txtoper_date.Text.Trim() == "")
                {
                    throw new Exception("单据日期必填!");
                }
                pm_t_flow_main ord = new pm_t_flow_main();
                List <pm_t_price_flow_detial> lines = new List <pm_t_price_flow_detial>();
                ord.sheet_no     = txtsheet_no.Text.Trim();
                ord.branch_no    = txtbranch.Text.Trim().Split('/')[0];
                ord.vip_type     = "";
                ord.price_type   = "1";
                ord.oper_date    = Helper.Conv.ToDateTime(txtoper_date.Text.Trim());
                ord.oper_id      = txtoper_man.Text.Split('/')[0];
                ord.approve_flag = "0";
                ord.memo         = txtmemo.Text.Trim();
                ord.other1       = "";
                ord.other2       = "";
                ord.other3       = "";
                ord.cm_branch    = "00";
                ord.start_date   = System.DateTime.MinValue;
                ord.end_date     = System.DateTime.MinValue;
                ord.start_time   = "";
                ord.end_time     = "";
                ord.buy_amt      = 0;
                ord.add_amt      = 0;
                ord.deal_man     = txtpeople.Text.Split('/')[0];
                ord.approve_man  = txtapprove_man.Text.Split('/')[0];
                ord.approve_date = System.DateTime.MinValue;
                ord.num1         = 0;
                ord.num2         = 0;
                ord.num3         = 0;
                int flag = 0;
                foreach (DataRow row in editGrid1.DataSource.Rows)
                {
                    if (row["item_no"].ToString() != "")
                    {
                        pm_t_price_flow_detial line = new pm_t_price_flow_detial();
                        lines.Add(line);
                        line.sheet_no   = ord.sheet_no;
                        line.item_no    = row["item_no"].ToString();
                        line.price_type = ord.price_type;
                        line.start_date = ord.start_date;
                        line.end_date   = ord.end_date;
                        line.old_price  = Helper.Conv.ToDecimal(row["old_price"].ToString());
                        line.new_price  = Helper.Conv.ToDecimal(row["new_price"].ToString());
                        line.discount   = 0;
                        line.buy_qnty   = 0;
                        line.other1     = "";
                        line.other2     = "";
                        line.other3     = "";
                        line.start_time = "";
                        line.end_time   = "";
                        line.stock_qty  = 0;
                        line.num1       = 0;
                        line.num2       = 0;
                        line.num3       = 0;
                        line.old_price2 = Helper.Conv.ToDecimal(row["old_price2"].ToString());
                        line.old_price3 = Helper.Conv.ToDecimal(row["old_price3"].ToString());

                        line.new_price2 = Helper.Conv.ToDecimal(row["new_price2"].ToString());
                        line.new_price3 = Helper.Conv.ToDecimal(row["new_price3"].ToString());

                        flag = 1;
                    }
                }
                if (flag == 0)
                {
                    throw new Exception("表体无合法数据!");
                }
                if (runType == 1)
                {
                    IBLL.ICusPriceOrder bll = new BLL.CusPriceOrderBLL();
                    bll.Add(ord, lines);
                    IOrder ins = this;
                    ins.ShowOrder(ord.sheet_no);
                }
                else if (runType == 2)
                {
                    IBLL.ICusPriceOrder bll = new BLL.CusPriceOrderBLL();
                    bll.Change(ord, lines);
                    IOrder ins = this;
                    ins.ShowOrder(ord.sheet_no);
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }
コード例 #2
0
        void IOrder.Save()
        {
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                //
                if (txtbranch.Text.Trim().Contains("/") == false)
                {
                    throw new Exception("机构必填!");
                }
                if (txtoper_date.Text.Trim() == "")
                {
                    throw new Exception("单据日期必填!");
                }
                pm_t_flow_main ord = new pm_t_flow_main();
                List <pm_t_price_flow_detial> lines = new List <pm_t_price_flow_detial>();
                ord.sheet_no     = txtsheet_no.Text.Trim();
                ord.branch_no    = txtbranch.Text.Trim().Split('/')[0];
                ord.vip_type     = "";
                ord.price_type   = "1";
                ord.oper_date    = Helper.Conv.ToDateTime(txtoper_date.Text.Trim());
                ord.oper_id      = txtoper_man.Text.Split('/')[0];
                ord.approve_flag = "0";
                ord.memo         = txtmemo.Text.Trim();
                ord.other1       = "";
                ord.other2       = "";
                ord.other3       = "";
                ord.cm_branch    = "00";
                ord.start_date   = System.DateTime.MinValue;
                ord.end_date     = System.DateTime.MinValue;
                ord.start_time   = "";
                ord.end_time     = "";
                ord.buy_amt      = 0;
                ord.add_amt      = 0;
                ord.deal_man     = txtpeople.Text.Split('/')[0];
                ord.approve_man  = txtapprove_man.Text.Split('/')[0];
                ord.approve_date = System.DateTime.MinValue;
                ord.num1         = 0;
                ord.num2         = 0;
                ord.num3         = 0;
                int flag = 0;
                foreach (DataRow row in editGrid1.DataSource.Rows)
                {
                    if (row["item_no"].ToString() != "")
                    {
                        pm_t_price_flow_detial line = new pm_t_price_flow_detial();
                        lines.Add(line);
                        line.sheet_no   = ord.sheet_no;
                        line.item_no    = row["item_no"].ToString();
                        line.price_type = ord.price_type;
                        line.start_date = ord.start_date;
                        line.end_date   = ord.end_date;
                        line.discount   = 0;
                        line.buy_qnty   = 0;
                        line.other1     = "";
                        line.other2     = "";
                        line.other3     = "";
                        line.start_time = "";
                        line.end_time   = "";
                        line.stock_qty  = 0;
                        line.num1       = 0;
                        line.num2       = 0;
                        line.num3       = 0;

                        line.old_price  = Helper.Conv.ToDecimal(row["old_price"].ToString());
                        line.old_price2 = Helper.Conv.ToDecimal(row["old_price2"].ToString());
                        line.old_price3 = Helper.Conv.ToDecimal(row["old_price3"].ToString());

                        line.new_price  = string.IsNullOrEmpty(row["new_price"].ToString()) ? line.old_price : Helper.Conv.ToDecimal(row["new_price"].ToString());
                        line.new_price2 = string.IsNullOrEmpty(row["new_price2"].ToString()) ? line.old_price2 : Helper.Conv.ToDecimal(row["new_price2"].ToString());
                        line.new_price3 = string.IsNullOrEmpty(row["new_price3"].ToString()) ? line.old_price3 : Helper.Conv.ToDecimal(row["new_price3"].ToString());

                        flag = 1;
                    }
                }
                if (flag == 0)
                {
                    throw new Exception("表体无合法数据!");
                }
                if (runType == 1)
                {
                    IBLL.ICusPriceOrder bll = new BLL.CusPriceOrderBLL();
                    string sheet_no;
                    bll.Add(ord, lines, out sheet_no);
                    IOrder ins = this;
                    ins.ShowOrder(sheet_no);
                }
                else if (runType == 2)
                {
                    IBLL.ICusPriceOrder bll = new BLL.CusPriceOrderBLL();
                    bll.Change(ord, lines);
                    IOrder ins = this;
                    ins.ShowOrder(ord.sheet_no);
                }

                Dictionary <string, object> dic = this.Tag as Dictionary <string, object>;
                this.Tag = Helper.Conv.ControlsAdds(this, dic);

                IBLL.ISys sys       = new BLL.SysBLL();
                string    isApprove = sys.Read("approve_at_ones");
                if ("1".Equals(isApprove))
                {
                    if (YesNoForm.ShowFrom("保存成功!是否立即审核") == DialogResult.Yes)
                    {
                        tsbCheck_Click(new object(), new EventArgs());
                    }
                }
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }