Esempio n. 1
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 { }
        }
Esempio n. 2
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 { }
        }