/// <summary> /// 创建配件分类树节点 /// </summary> /// <param name="parentNode">父节点</param> /// <param name="parentID">父编码</param> private void CreateTreeViewChildNode(TreeNode parentNode, string parentID) { try { if (parentID.Length == 0) { return; } DataTable dt = CommonCtrl.GetDictByCode(parentID, false); if (dt == null || dt.Rows.Count == 0) { return; } foreach (DataRow dr in dt.Rows) { TreeNode node = new TreeNode(); node.Text = CommonCtrl.IsNullToString(dr["dic_name"]); node.Name = CommonCtrl.IsNullToString(dr["dic_id"]); parentNode.Nodes.Add(node); string dicCode = CommonCtrl.IsNullToString(dr["dic_Code"]); CreateTreeViewChildNode(node, dicCode);//递归调用添加子分类节点 } } catch (Exception ex) { MessageBoxEx.Show(ex.Message, "异常提示", MessageBoxButtons.OK, MessageBoxIcon.Question); } }
/// <summary> /// 绑定宇通旧件回收单状态 /// </summary> private void BindStatusYT() { DataTable dot = CommonCtrl.GetDictByCode("oldpart_recycle_status_yt", true); cobYTStatus.DataSource = dot; cobYTStatus.ValueMember = "dic_id"; cobYTStatus.DisplayMember = "dic_name"; }
/// <summary> /// 绑定宇通单据处理方式 /// </summary> private void BindModeYT() { DataTable dot = CommonCtrl.GetDictByCode("set_mode_yt", true); process_mode.DataSource = dot; process_mode.ValueMember = "dic_id"; process_mode.DisplayMember = "dic_name"; }
/// <summary> /// 绑定宇通单据处理方式 /// </summary> private void BindModeYT() { try { DataTable dot = CommonCtrl.GetDictByCode("set_mode_yt", true); process_mode.DataSource = dot; process_mode.ValueMember = "dic_id"; process_mode.DisplayMember = "dic_name"; } catch (Exception ex) { HXCPcClient.GlobalStaticObj.GlobalLogService.WriteLog(ex); } }
/// <summary> /// 设置底部DataGridView的Anchor属性 /// </summary> private void SetDgvAnchor() { #region 其他收费项目 dgvOther.Dock = DockStyle.Fill; dgvOther.ReadOnly = false; dgvOther.Rows.Add(3); dgvOther.AllowUserToAddRows = true; ControlsConfig.NumberLimitdgv(dgvproject, new List <string>() { "other_expense_amount" }); DataTable dot = CommonCtrl.GetDictByCode("sys_other_expense_type", true); other_expense_type.DataSource = dot; other_expense_type.ValueMember = "dic_id"; other_expense_type.DisplayMember = "dic_name"; #endregion #region 维修项目信息设置 dgvproject.Dock = DockStyle.Fill; dgvproject.ReadOnly = false; dgvproject.Rows.Add(3); dgvproject.AllowUserToAddRows = true; dgvproject.Columns["project_num"].ReadOnly = true; dgvproject.Columns["project_name"].ReadOnly = true; dgvproject.Columns["repair_type"].ReadOnly = true; dgvproject.Columns["whours_type"].ReadOnly = true; dgvproject.Columns["tax_amount"].ReadOnly = true; ControlsConfig.NumberLimitdgv(dgvproject, new List <string>() { "whours_counts", "whours_price", }); #endregion #region 维修用料设置 dgvMaterials.Dock = DockStyle.Fill; dgvMaterials.ReadOnly = false; dgvMaterials.Rows.Add(3); dgvMaterials.AllowUserToAddRows = true; dgvMaterials.Columns["parts_code"].ReadOnly = true; dgvMaterials.Columns["parts_name"].ReadOnly = true; dgvMaterials.Columns["unit"].ReadOnly = true; dgvMaterials.Columns["original_price"].ReadOnly = true; ControlsConfig.NumberLimitdgv(dgvMaterials, new List <string>() { "number", "preferential_price" }); #endregion }
/// <summary> /// 创建绑定树节点 /// </summary> /// <param name="parentNode">父节点</param> /// <param name="parentID">父编码</param> private void CreateTreeViewChildNode(TreeNode parentNode, string parentID) { if (parentID.Length == 0) { return; } DataTable dt = CommonCtrl.GetDictByCode(parentID, false); if (dt == null || dt.Rows.Count == 0) { return; } foreach (DataRow dr in dt.Rows) { TreeNode node = new TreeNode(CommonCtrl.IsNullToString(dr["dic_name"])); node.Name = CommonCtrl.IsNullToString(dr["dic_id"]); parentNode.Nodes.Add(node); string dicCode = CommonCtrl.IsNullToString(dr["dic_Code"]); CreateTreeViewChildNode(node, dicCode); } }
static void CreateTreeViewChildNode(List <string> list_dic_id, string dic_Code) { if (dic_Code.Length == 0) { return; } DataTable dt = CommonCtrl.GetDictByCode(dic_Code, false); if (dt == null || dt.Rows.Count == 0) { return; } foreach (DataRow dr in dt.Rows) { if (dr["enable_flag"] != null && dr["enable_flag"].ToString() == "1") { string dic_id = CommonCtrl.IsNullToString(dr["dic_id"]); string dicCode = CommonCtrl.IsNullToString(dr["dic_Code"]); list_dic_id.Add(dic_id); CreateTreeViewChildNode(list_dic_id, dicCode); } } }