private void tsbDel_Click(object sender, EventArgs e) { try { if (!MyLove.PermissionsBalidation(this.Text, "02")) { return; } if (tvRegion.SelectedNode != null) { if (YesNoForm.ShowFrom("确认要删除吗?") == DialogResult.Yes) { IBLL.IRegion bll = new BLL.RegionBLL(); bll.Del(tvRegion.SelectedNode.Tag as bi_t_region_info); tvRegion.SelectedNode.Remove(); } } } catch (Exception ex) { LogHelper.writeLog("frmRegion=>Del", ex.ToString()); MsgForm.ShowFrom(ex); } }
private void myButtonOk_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(this.txtItemCls.Text)) { this.txtItemCls.Focus(); MsgForm.ShowFrom("请输入名称!"); return; } IBLL.IRegion bll = new BLL.RegionBLL(); if (ord_region == null || string.IsNullOrEmpty(ord_region.region_no)) { bi_t_region_info item = new bi_t_region_info() { region_name = this.txtItemCls.Text.Trim(), display_flag = "1", region_no = bll.GetMaxCode(), region_parent = par_code, update_time = DateTime.Now, }; bll.Add(item); } else { ord_region.region_name = this.txtItemCls.Text; ord_region.update_time = DateTime.Now; bll.Upload(ord_region); } if (ord_region != null) { this.Close(); } this.txtItemCls.Text = ""; this.txtItemCls.Focus(); } catch (Exception ex) { ord_region = null; LogHelper.writeLog("ItemRegionUpload=>Add", ex.ToString()); MsgForm.ShowFrom(ex); } }
private void LoadTv() { if (region_lis != null && region_lis.Count > 0) { this.region_lis.Clear(); } this.tv.Nodes.Clear(); int cb_index = Conv.ToInt(cb.SelectedValue); TreeNode tn = new TreeNode("所有"); if (cb_index == 1) { tn = new TreeNode("所有区域"); IBLL.IRegion bll = new BLL.RegionBLL(); region_lis = bll.GetAllList(); } else if (cb_index == 2) { tn = new TreeNode("所有分类"); } else if (cb_index == 3) { if (_runType == 0) { tn = new TreeNode("所有经销"); } else if (_runType == 1) { tn = new TreeNode("所有客户组"); } } this.tv.Nodes.Add(tn); LoadTreeView(); this.tv.Nodes[0].Expand(); }
private void LoadCb() { Thread th = new Thread(() => { Cursor.Current = Cursors.WaitCursor; Helper.GlobalData.windows.ShowLoad(this); try { IBLL.IRegion bll = new BLL.RegionBLL(); sup_tb = bll.GetDataTable(); IBLL.IPeople pbll = new BLL.PeopleBLL(); int count; peo_tb = pbll.GetDataTable("", "", 1, 1, 99999, out count); this.Invoke((MethodInvoker) delegate { //货商区域 this.txtRegion.Bind(sup_tb, 300, 200, "region_no", "region_no:编号:80,region_name:区域:150", "region_no/region_name->Text"); //货商分类 Dictionary <string, string> dic = new Dictionary <string, string>() { { "00", "不定" } }; this.cbSupType.DisplayMember = "Value"; this.cbSupType.ValueMember = "Key"; this.cbSupType.DataSource = new BindingSource(dic, null); //业务员 this.txtPeo.Bind(peo_tb, 250, 200, "oper_id", "oper_id:编号:80,oper_name:名字:150", "oper_id/oper_name->Text"); //价格等级 Dictionary <string, string> dic3 = new Dictionary <string, string>() { { "1", "一级批发价" }, { "2", "二级批发价" }, { "3", "三级批发价" }, }; this.cbPriceLevel.DisplayMember = "Value"; this.cbPriceLevel.ValueMember = "Key"; this.cbPriceLevel.DataSource = new BindingSource(dic3, null); //客户组 IBLL.ISupcustGroup gbll = new BLL.SupcustGroupBLL(); DataTable flag = new DataTable(); if (_runType == 0) { flag = gbll.GetSupGroup(); } else if (_runType == 1) { flag = gbll.GetCusGroup(); } if (flag.Columns.Count < 1) { flag = Conv.Assign <bi_t_supcust_group>(); } DataRow dr = flag.NewRow(); dr["SupCust_GroupNo"] = "0"; dr["SupCust_GroupName"] = "不定"; flag.Rows.InsertAt(dr, 0); this.cb_supcust_group.DisplayMember = "SupCust_GroupName"; this.cb_supcust_group.ValueMember = "SupCust_GroupNo"; this.cb_supcust_group.DataSource = flag; LoadSup(); }); } catch (Exception ex) { LogHelper.writeLog("LoadCb", ex.ToString()); MsgForm.ShowFrom(ex); } Cursor.Current = Cursors.Default; Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); }
public void LoadItemCls() { try { Thread th = new Thread(() => { Helper.GlobalData.windows.ShowLoad(this); try { IBLL.IRegion bll = new BLL.RegionBLL(); region_lis = bll.GetAllList(); this.Invoke((MethodInvoker) delegate { Cursor.Current = Cursors.WaitCursor; string key = ""; if (tvRegion.SelectedNode != null) { if (tvRegion.SelectedNode.Tag != null) { var item = (Model.bi_t_region_info)tvRegion.SelectedNode.Tag; key = item.region_no; } } // this.tvRegion.Nodes[0].Nodes.Clear(); LoadTreeView(); // if (key == "") { this.tvRegion.SelectedNode = this.tvRegion.Nodes[0]; this.tvRegion.SelectedNode.Expand(); } else { foreach (TreeNode n in GetNodes(this.tvRegion.Nodes[0])) { var item = (Model.bi_t_region_info)n.Tag; if (key == item.region_no) { this.tvRegion.SelectedNode = n; this.tvRegion.SelectedNode.Expand(); break; } } } Cursor.Current = Cursors.Default; }); } catch (Exception ex) { LogHelper.writeLog("LoadItemCls", "获取分类出错!"); MsgForm.ShowFrom(ex); } Helper.GlobalData.windows.CloseLoad(this); }); th.Start(); } catch (Exception ex) { LogHelper.writeLog("LoadItemCls", "获取分类出错!"); MsgForm.ShowFrom(ex); } }