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; } }
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; } }
void IBLL.ICusPriceOrder.Add(pm_t_flow_main ord, List <pm_t_price_flow_detial> lines, out string sheet_no) { ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("sheet_no", ord.sheet_no); w.Append("branch_no", ord.branch_no); w.Append("vip_type", ord.vip_type); w.Append("price_type", ord.price_type); w.Append("oper_date", ord.oper_date.ToString("yyyy-MM-dd HH:mm:ss")); w.Append("oper_id", ord.oper_id); w.Append("approve_flag", ord.approve_flag); w.Append("memo", ord.memo); w.Append("other1", ord.other1); w.Append("other2", ord.other2); w.Append("other3", ord.other3); w.Append("cm_branch", ord.cm_branch); w.Append("start_date", ord.start_date.ToString("yyyy-MM-dd HH:mm:ss")); w.Append("end_date", ord.end_date.ToString("yyyy-MM-dd HH:mm:ss")); w.Append("start_time", ord.start_time); w.Append("end_time", ord.end_time); w.Append("buy_amt", ord.buy_amt.ToString()); w.Append("add_amt", ord.add_amt.ToString()); w.Append("deal_man", ord.deal_man); w.Append("approve_man", ord.approve_man); w.Append("approve_date", ""); w.Append("num1", ord.num1.ToString()); w.Append("num2", ord.num2.ToString()); w.Append("num3", ord.num3.ToString()); var tb = new DataTable(); tb.Columns.Add("sheet_no"); tb.Columns.Add("item_no"); tb.Columns.Add("price_type"); tb.Columns.Add("start_date", typeof(DateTime)); tb.Columns.Add("end_date", typeof(DateTime)); tb.Columns.Add("old_price", typeof(decimal)); tb.Columns.Add("new_price", typeof(decimal)); tb.Columns.Add("discount", typeof(decimal)); tb.Columns.Add("buy_qnty", typeof(decimal)); tb.Columns.Add("other1"); tb.Columns.Add("other2"); tb.Columns.Add("other3"); tb.Columns.Add("start_time"); tb.Columns.Add("end_time"); tb.Columns.Add("stock_qty", typeof(decimal)); tb.Columns.Add("num1", typeof(decimal)); tb.Columns.Add("num2", typeof(decimal)); tb.Columns.Add("num3", typeof(decimal)); tb.Columns.Add("old_price2", typeof(decimal)); tb.Columns.Add("old_price3", typeof(decimal)); tb.Columns.Add("new_price2", typeof(decimal)); tb.Columns.Add("new_price3", typeof(decimal)); foreach (pm_t_price_flow_detial line in lines) { tb.Rows.Add( line.sheet_no, line.item_no, line.price_type, line.start_date, line.end_date, line.old_price, line.new_price, line.discount, line.buy_qnty, line.other1, line.other2, line.other3, line.start_time, line.end_time, line.stock_qty, line.num1, line.num2, line.num3, line.old_price2, line.old_price3, line.new_price2, line.new_price3 ); } w.Append("lines", tb); Helper.IRequest req = new Helper.Request(); var json = req.request("/cus_price_order?t=add", w.ToString()); ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(json); if (r.Read("errId") != "0") { throw new Exception(r.Read("errMsg")); } sheet_no = r.Read("sheet_no"); }