コード例 #1
0
        public static void ExistsParam(ComboBox cmb, ParamParentCode parent, string title)
        {
            bool tmpExists = false;

            try
            {
                Ctrls.CbbItem item;

                for (int index = 0; index < cmb.Items.Count; index++)
                {
                    item = (Ctrls.CbbItem)cmb.Items[index];

                    if (item.Text.Trim().ToLower() == title.ToLower().Trim())
                    {
                        tmpExists = true;
                        break;
                    }
                }//end for
                //不存在,新增
                if (!tmpExists)
                {
                    AddParam(cmb, parent, title);
                }
            }
            catch (Exception ex)
            {
                Error.ErrorMsg(ex);
            }
        }
コード例 #2
0
 public static void BindComboBox(ComboBox cmb, ParamParentCode parentCode)
 {
     if (ParamDataSet == null || ParamDataSet.Tables[0].Rows.Count == 0)
     {
         InitParamDataSet();
     }
     cmb.Items.Clear();
     Ctrls.CbbItem item;
     DataRow[]     rows = ParamDataSet.Tables[0].Select(" pcode='" + parentCode.ToString() + "'");
     foreach (DataRow dr in rows)
     {
         item       = new Ctrls.CbbItem();
         item.Text  = dr["title"].ToString().Trim();
         item.Value = dr["code"].ToString().Trim();
         item.Name  = dr["code"].ToString().Trim();
         cmb.Items.Add(item);
     }
 }
コード例 #3
0
ファイル: ModuleData.cs プロジェクト: TjcJose/Hi
 public static void BindComboBox(ComboBox cmb, ParamParentCode parentCode)
 {
     if (ParamDataSet == null || ParamDataSet.Tables[0].Rows.Count == 0)
     {
         InitParamDataSet();
     }
     cmb.Items.Clear();
     Ctrls.CbbItem item;
     DataRow[] rows = ParamDataSet.Tables[0].Select(" pcode='" + parentCode.ToString() + "'");
     foreach (DataRow dr in rows)
     {
         item = new Ctrls.CbbItem();
         item.Text = dr["title"].ToString().Trim();
         item.Value = dr["code"].ToString().Trim();
         item.Name = dr["code"].ToString().Trim();
         cmb.Items.Add(item);
     }
 }
コード例 #4
0
        private static void AddParam(ComboBox cmb, ParamParentCode parent, string title)
        {
            try
            {
                Hi.BLL.SysAdmin bll = new Hi.BLL.SysAdmin();
                DataRow[]       rows = ParamDataSet.Tables[0].Select(" pcode='" + parent.ToString() + "'", "code desc");
                int             count = rows.Length;
                int             tmpCount = count;
                string          pid = "", code = "";
                foreach (DataRow dr in rows)//降次排序,取第一条记录,循环一次退出
                {
                    code = dr["code"].ToString();
                    pid  = dr["parent_id"].ToString();
                    int.TryParse(code, out tmpCount);
                    break;
                }
                if (count == tmpCount)
                {
                    tmpCount++;
                }
                Hi.Model.BasParam model = new Model.BasParam();
                model.Code       = tmpCount.ToString();
                model.ParentId   = pid;
                model.Title      = title;
                model.EnableFlag = "1";

                bool blFlag = bll.ParamAdd(model);
                if (blFlag)
                {
                    Ctrls.CbbItem item = new Ctrls.CbbItem();
                    item.Text  = title;
                    item.Name  = model.Code;
                    item.Value = model.Code;
                    cmb.Items.Insert(0, item);
                    InitParamDataSet();
                }
            }
            catch { }
        }
コード例 #5
0
ファイル: ModuleData.cs プロジェクト: TjcJose/Hi
        public static void ExistsParam(ComboBox cmb, ParamParentCode parent, string title)
        {
            bool tmpExists = false;
            try
            {
                Ctrls.CbbItem item;

                for (int index = 0; index < cmb.Items.Count; index++)
                {
                    item = (Ctrls.CbbItem)cmb.Items[index];

                    if (item.Text.Trim().ToLower() == title.ToLower().Trim())
                    {
                        tmpExists = true;
                        break;
                    }
                }//end for
                //不存在,新增
                if (!tmpExists)
                {
                    AddParam(cmb, parent, title);
                }
            }
            catch (Exception ex)
            {
                Error.ErrorMsg(ex);
            }
        }
コード例 #6
0
ファイル: ModuleData.cs プロジェクト: TjcJose/Hi
        private static void AddParam(ComboBox cmb, ParamParentCode parent, string title)
        {
            try
            {
                Hi.BLL.SysAdmin bll =new Hi.BLL.SysAdmin();
                DataRow[] rows = ParamDataSet.Tables[0].Select(" pcode='" + parent.ToString() + "'", "code desc");
                int count = rows.Length;
                int tmpCount = count;
                string pid = "", code = "";
                foreach (DataRow dr in rows)//降次排序,取第一条记录,循环一次退出
                {
                    code = dr["code"].ToString();
                    pid = dr["parent_id"].ToString();
                    int.TryParse(code, out tmpCount);
                    break;
                }
                if (count == tmpCount)
                    tmpCount++;
                Hi.Model.BasParam model = new Model.BasParam();
                model.Code = tmpCount.ToString();
                model.ParentId = pid;
                model.Title = title;
                model.EnableFlag = "1";

                bool blFlag = bll.ParamAdd(model);
                if (blFlag)
                {
                    Ctrls.CbbItem item = new Ctrls.CbbItem();
                    item.Text = title;
                    item.Name = model.Code;
                    item.Value = model.Code;
                    cmb.Items.Insert(0, item);
                    InitParamDataSet();
                }
            }
            catch { }
        }