示例#1
0
        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            string      userid = "READ";
            string      strPwd = Util.Encrypt("READ", Util.PWD_MASK);
            dalUserList bll    = new dalUserList();
            bool        ret    = bll.Login(userid, strPwd, out Util.emsg);

            if (ret)
            {
                modUserList mod = bll.GetItem(userid);
                Util.UserId       = mod.UserId;
                Util.UserName     = mod.UserName;
                Util.RoleId       = mod.RoleId;
                Util.UserStatus   = mod.Status;
                this.DialogResult = DialogResult.OK;
                this.Cursor       = Cursors.Default;
                return;
            }
            else
            {
                //this.DialogResult = DialogResult.Cancel;
                this.Cursor = Cursors.Default;
                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
示例#2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            dalUserList dal = new dalUserList();

            txtSystemTime.Text = DateTime.Now.ToString("MM-dd-yyyy HH:mm");
            txtServerTime.Text = dal.GetServerTime(out Util.emsg).ToString("MM-dd-yyyy HH:mm");
        }
示例#3
0
        private void Login()
        {
            if (txtUserId.Text.Trim().Length == 0)
            {
                MessageBox.Show("User Id can not be null!");
                txtUserId.Focus();
                return;
            }
            if (txtPwd.Text.Trim().Length == 0)
            {
                MessageBox.Show("Password can not be null!");
                txtPwd.Focus();
                return;
            }

            this.Cursor = Cursors.WaitCursor;
            string      userid = txtUserId.Text.Trim().ToString();
            string      strPwd = Util.Encrypt(txtPwd.Text.Trim().ToString(), Util.PWD_MASK);
            dalUserList dal    = new dalUserList();
            bool        ret    = dal.Login(userid, strPwd, out Util.emsg);

            if (ret)
            {
                modUserList mod = dal.GetItem(userid);
                Util.UserId   = mod.UserId;
                Util.UserName = mod.UserName;
                Util.RoleId   = mod.RoleId;
                dalRoleList role    = new dalRoleList();
                modRoleList modrole = role.GetItem(mod.RoleId, out Util.emsg);
                Util.RoleDesc   = modrole.RoleDesc;
                Util.UserStatus = mod.Status;
                ini.IniWriteValue("login", "userid", userid);

                dalLogLoginHost bllhost = new dalLogLoginHost();
                modLogLoginHost modhost = new modLogLoginHost();
                modhost.HostName = Environment.MachineName;

                modhost.HostCode   = Util.HOST_CODE;
                modhost.UpdateUser = Util.UserId;
                if (bllhost.Exists(modhost.HostName, out Util.emsg))
                {
                    bllhost.Update(modhost.HostName, modhost, out Util.emsg);
                }
                else
                {
                    bllhost.Insert(modhost, out Util.emsg);
                }

                this.DialogResult = DialogResult.OK;
                this.Cursor       = Cursors.Default;
                return;
            }
            else
            {
                //this.DialogResult = DialogResult.Cancel;
                this.Cursor = Cursors.Default;
                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
示例#4
0
        /// <summary>
        /// get all already granted data
        /// <summary>
        /// <param name=roleid>roleid</param>
        ///<returns>Details about all TaskGrant</returns>
        public BindingCollection <modTaskGrant> GetAllUserTask(string userid, out string emsg)
        {
            try
            {
                dalUserList daluser = new dalUserList();
                modUserList moduser = daluser.GetItem(userid);

                BindingCollection <modTaskGrant> modellist = new BindingCollection <modTaskGrant>();
                string sql = string.Format("select a.task_code,b.task_name,b.form_name,b.group_id,b.task_type,b.url,b.web_url from sys_task_grant a,sys_task_list b where a.task_code=b.task_code and a.role_id= '{0}' and b.status=1 order by a.task_code", userid);
                using (SqlDataReader rdr = SqlHelper.ExecuteReader(sql))
                {
                    while (rdr.Read())
                    {
                        modTaskGrant model = new modTaskGrant();
                        model.TaskCode = rdr["task_code"].ToString();
                        model.TaskName = rdr["task_name"].ToString();
                        model.TaskType = rdr["task_type"].ToString();
                        model.FormName = rdr["form_name"].ToString();
                        model.GroupId  = rdr["group_id"].ToString();
                        model.Url      = rdr["url"].ToString();
                        model.WebUrl   = rdr["web_url"].ToString();
                        model.Checked  = true;
                        modellist.Add(model);
                    }
                }
                sql = string.Format("select a.task_code,a.task_name,a.form_name,a.group_id,a.task_type,a.url,a.web_url from sys_task_list a where a.status=1 and not exists (select '#' from sys_task_grant where task_code =a.task_code and (role_id='{0}' or role_id='{1}'))", moduser.RoleId, userid);
                using (SqlDataReader rdr = SqlHelper.ExecuteReader(sql))
                {
                    while (rdr.Read())
                    {
                        modTaskGrant model = new modTaskGrant();
                        model.TaskCode = rdr["task_code"].ToString();
                        model.TaskName = rdr["task_name"].ToString();
                        model.TaskType = rdr["task_type"].ToString();
                        model.FormName = rdr["form_name"].ToString();
                        model.GroupId  = rdr["group_id"].ToString();
                        model.Url      = rdr["url"].ToString();
                        model.WebUrl   = rdr["web_url"].ToString();
                        model.Checked  = false;
                        modellist.Add(model);
                    }
                }
                emsg = string.Empty;
                return(modellist);
            }
            catch (Exception ex)
            {
                emsg = dalUtility.ErrorMessage(ex.Message);
                return(null);
            }
        }
示例#5
0
        /// <summary>
        /// delete a customerlog
        /// <summary>
        /// <param name=id>id</param>
        /// <param name=out emsg>return error message</param>
        /// <returns>true/false</returns>
        public bool Delete(int id, out string emsg)
        {
            try
            {
                modCustomerLog mod = GetItem(id, out emsg);
                if (mod == null)
                {
                    emsg = null;
                    return(true);
                }
                dalUserList dalu    = new dalUserList();
                DateTime    svrtime = dalu.GetServerTime(out emsg);
                TimeSpan    ts1     = new TimeSpan(svrtime.Ticks);
                TimeSpan    ts2     = new TimeSpan(DateTime.Parse(mod.ToTime).Ticks);
                TimeSpan    ts      = ts1.Subtract(ts2).Duration();
                if (ts.Days < 0)
                {
                    emsg = "您不能删除未来的工作日志!";
                    return(false);
                }
                dalSysParameters dalp = new dalSysParameters();
                int delaydays         = Convert.ToInt32(dalp.GetParaValue("CUSTOMER_LOG_DELAY_DAYS"));
                if (ts.Days >= delaydays)
                {
                    emsg = "您提交的日期不能超过" + delaydays.ToString() + "天";
                    return(false);
                }

                string sql = string.Format("delete customer_log where id={0} ", id);
                int    i   = SqlHelper.ExecuteNonQuery(sql);
                if (i > 0)
                {
                    emsg = null;
                    return(true);
                }
                else
                {
                    emsg = "Unknown error when ExecuteNonQuery!";
                    return(false);
                }
            }
            catch (Exception ex)
            {
                emsg = dalUtility.ErrorMessage(ex.Message);
                return(false);
            }
        }
示例#6
0
        private void txtFind_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13 || e.KeyChar == 32)
            {
                if (string.IsNullOrEmpty(txtFind2.Text.Trim()))
                {
                    MessageBox.Show("Please enter the text you want to find!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                dalUserList bll = new dalUserList();
                modUserList mod = bll.GetItem(txtFind2.Text.Trim().ToUpper());
                if (mod == null)
                {
                    MessageBox.Show("No data found!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    for (int i = 0; i < tvUser2.Nodes.Count; i++)
                    {
                        if (tvUser2.Nodes[i].GetNodeCount(false) > 0)
                        {
                            for (int j = 0; j < tvUser2.Nodes[i].GetNodeCount(false); j++)
                            {
                                if (mod.UserId == tvUser2.Nodes[i].Nodes[j].Name)
                                {
                                    tvUser2.Nodes[i].Expand();
                                    tvUser2.SelectedNode = tvUser2.Nodes[i].Nodes[j];
                                    TreeViewEventArgs ea = new TreeViewEventArgs(tvUser2.SelectedNode);
                                    tvUser2_AfterSelect(null, ea);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                e.KeyChar = Convert.ToChar(e.KeyChar.ToString().ToUpper());
            }
        }
示例#7
0
        /// <summary>
        /// update a customerlog
        /// <summary>
        /// <param name=id>id</param>
        /// <param name=mod>model object of customerlog</param>
        /// <param name=out emsg>return error message</param>
        /// <returns>true/false</returns>
        public bool Update(int id, modCustomerLog mod, out string emsg)
        {
            try
            {
                dalUserList dalu    = new dalUserList();
                DateTime    svrtime = dalu.GetServerTime(out emsg);
                TimeSpan    ts1     = new TimeSpan(svrtime.Ticks);
                TimeSpan    ts2     = new TimeSpan(DateTime.Parse(mod.ToTime).Ticks);
                TimeSpan    ts      = ts1.Subtract(ts2).Duration();
                if (ts.Days < 0)
                {
                    emsg = "您不能更新未来的工作日志!";
                    return(false);
                }

                dalSysParameters dalp = new dalSysParameters();
                int delaydays         = Convert.ToInt32(dalp.GetParaValue("CUSTOMER_LOG_DELAY_DAYS"));
                if (ts.Days >= delaydays)
                {
                    emsg = "你提交的日期不能超过" + delaydays.ToString() + "天";
                    return(false);
                }

                string sql = string.Format("update customer_log set cust_id='{0}',cust_name='{1}',action_code='{2}',action_type='{3}',action_man='{4}',form_id='{5}',action_subject='{6}',action_content='{7}',object_name='{8}',venue='{9}',from_time='{10}',to_time='{11}',scores={12},ad_flag={13},update_user='******',update_time=getdate() where id={15}", mod.CustId, mod.CustName, mod.ActionCode, mod.ActionType, mod.ActionMan, mod.FormId, mod.ActionSubject, mod.ActionContent, mod.ObjectName, mod.Venue, mod.FromTime, mod.ToTime, mod.Scores, mod.AdFlag, mod.UpdateUser, id);
                int    i   = SqlHelper.ExecuteNonQuery(sql);
                if (i > 0)
                {
                    emsg = null;
                    return(true);
                }
                else
                {
                    emsg = "Unknown error when ExecuteNonQuery!";
                    return(false);
                }
            }
            catch (Exception ex)
            {
                emsg = dalUtility.ErrorMessage(ex.Message);
                return(false);
            }
        }
示例#8
0
        /// <summary>
        /// insert a crmactionschedule
        /// <summary>
        /// <param name=mod>model object of crmactionschedule</param>
        /// <param name=out emsg>return error message</param>
        /// <returns>true/false</returns>
        public bool Insert(modCrmActionSchedule mod, out string emsg)
        {
            try
            {
                dalUserList dalu    = new dalUserList();
                DateTime    svrtime = dalu.GetServerTime(out emsg);
                TimeSpan    ts1     = new TimeSpan(svrtime.Ticks);
                TimeSpan    ts2     = new TimeSpan(mod.ActionDate.Ticks);
                TimeSpan    ts      = ts2.Subtract(ts1).Duration();
                if (ts.Days < 0)
                {
                    emsg = "您不能新增过去的工作计划!";
                    return(false);
                }
                dalSysParameters dalp = new dalSysParameters();
                int aheaddays         = Convert.ToInt32(dalp.GetParaValue("ACTION_SCHEDULE_AHEAD_DAYS"));
                if (ts.Days > aheaddays)
                {
                    emsg = "您不能提交" + aheaddays.ToString() + "天后的工作计划";
                    return(false);
                }

                string sql = string.Format("insert into crm_action_schedule(action_man,action_date,action_content,status,status_desc,update_user,update_time)values('{0}','{1}','{2}','{3}','{4}','{5}',getdate())", mod.ActionMan, mod.ActionDate, mod.ActionContent, mod.Status, mod.StatusDesc, mod.UpdateUser);
                int    i   = SqlHelper.ExecuteNonQuery(sql);
                if (i > 0)
                {
                    emsg = null;
                    return(true);
                }
                else
                {
                    emsg = "Unknown error when ExecuteNonQuery!";
                    return(false);
                }
            }
            catch (Exception ex)
            {
                emsg = dalUtility.ErrorMessage(ex.Message);
                return(false);
            }
        }
示例#9
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
            clsTranslate.InitLanguage(this);
            FillControl.FillPeriodList(cboPeriodList);
            frmMain.bLogined = false;
            timer1_Tick(null, null);
            timer1.Enabled = true;
            //string strHostName = Dns.GetHostName();
            string strHostName = Environment.MachineName;

            if (strHostName.ToUpper() == "KAIFA0007" || strHostName.ToUpper() == "LUCJ" || strHostName.ToUpper() == "QUWEIQIN")
            {
                //if (strHostName.ToUpper() == "30-0001-14544")
                //    pictureBox1.Visible = false;
                txtUserId.Text = "SYSADMIN";
                txtPwd.Text    = "PPT123";
                txtPwd.Focus();
            }
            else
            {
                txtUserId.Text = ini.IniReadValue("login", "userid");
                if (string.IsNullOrEmpty(txtUserId.Text.Trim()))
                {
                    txtUserId.Focus();
                }
                else
                {
                    txtPwd.Focus();
                }
            }
            RWReg reg = new RWReg("LOCAL_MACHINE");
            bool  ret = reg.SetRegValue(@"SOFTWARE\ORACLE", "NLS_LANG", "SIMPLIFIED CHINESE_CHINA.ZHS16GBK", "STRING");

            dalUserList bll = new dalUserList();

            if (!bll.UpdateDatabaseObject(Application.StartupPath, out Util.emsg))
            {
                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
示例#10
0
 /// <summary>
 /// delete a crmactionschedule
 /// <summary>
 /// <param name=salesman>salesman</param>
 /// <param name=actiondate>actiondate</param>
 /// <param name=out emsg>return error message</param>
 /// <returns>true/false</returns>
 public bool Delete(string salesman, DateTime actiondate, out string emsg)
 {
     try
     {
         modCrmActionSchedule mod = GetItem(salesman, actiondate, out emsg);
         if (mod == null)
         {
             emsg = null;
             return(true);
         }
         dalUserList dalu    = new dalUserList();
         DateTime    svrtime = dalu.GetServerTime(out emsg);
         TimeSpan    ts1     = new TimeSpan(svrtime.Ticks);
         TimeSpan    ts2     = new TimeSpan(mod.ActionDate.Ticks);
         TimeSpan    ts      = ts1.Subtract(ts2).Duration();
         if (ts.Days > 0)
         {
             emsg = "您不能删除过去的工作计划!";
             return(false);
         }
         string sql = string.Format("delete crm_action_schedule where action_man='{0}' and action_date='{1}' ", salesman, actiondate);
         int    i   = SqlHelper.ExecuteNonQuery(sql);
         if (i > 0)
         {
             emsg = null;
             return(true);
         }
         else
         {
             emsg = "Unknown error when ExecuteNonQuery!";
             return(false);
         }
     }
     catch (Exception ex)
     {
         emsg = dalUtility.ErrorMessage(ex.Message);
         return(false);
     }
 }
示例#11
0
        private void Login()
        {
            if (txtSystemTime.Text.Trim() != txtServerTime.Text.Trim())
            {
                DateTime dt1 = DateTime.Parse(txtSystemTime.Text);
                DateTime dt2 = DateTime.Parse(txtServerTime.Text);
                TimeSpan ts  = new TimeSpan(dt1.Ticks - dt2.Ticks);
                if (Math.Abs(ts.Days) > 1 || Math.Abs(ts.Minutes) > 2 || Math.Abs(ts.Hours) > 1 || Math.Abs(ts.Days) > 1)
                {
                    MessageBox.Show(clsTranslate.TranslateString("local time must equal to server time,please adjust your system time first!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtSystemTime.Focus();
                    return;
                }
            }
            if (cboPeriodList.Items.Count == 0)
            {
                btnNew_Click(null, null);
                return;
            }
            if (txtUserId.Text.Trim().Length == 0)
            {
                MessageBox.Show("User Id can not be null!");
                txtUserId.Focus();
                return;
            }
            if (txtPwd.Text.Trim().Length == 0)
            {
                MessageBox.Show("Password can not be null!");
                txtPwd.Focus();
                return;
            }

            this.Cursor = Cursors.WaitCursor;
            string      userid = txtUserId.Text.Trim().ToString();
            string      strPwd = Util.Encrypt(txtPwd.Text.Trim().ToString(), Util.PWD_MASK);
            dalUserList dal    = new dalUserList();
            bool        ret    = dal.Login(userid, strPwd, out Util.emsg);

            if (ret)
            {
                modUserList mod = dal.GetItem(userid);
                Util.UserId   = mod.UserId;
                Util.UserName = mod.UserName;
                Util.RoleId   = mod.RoleId;
                dalRoleList role    = new dalRoleList();
                modRoleList modrole = role.GetItem(mod.RoleId, out Util.emsg);
                Util.RoleDesc   = modrole.RoleDesc;
                Util.UserStatus = mod.Status;
                ini.IniWriteValue("login", "userid", userid);

                dalAccCurrencyList dalcur = new dalAccCurrencyList();
                modAccCurrencyList modcur = dalcur.GetOwnerItem(out Util.emsg);
                Util.Currency = modcur.Currency;
                dalLogLoginHost bllhost = new dalLogLoginHost();
                modLogLoginHost modhost = new modLogLoginHost();
                modhost.HostName = Environment.MachineName;
                Util.modperiod   = (modAccPeriodList)cboPeriodList.SelectedItem;
                clsLxms.CheckSoftwareRegister();
                if (Util.SOFT_REGISTER)
                {
                    modhost.RegisterCode = Util.REGISTER_CODE;
                }
                else
                {
                    modhost.RegisterCode = string.Empty;
                    if (cboPeriodList.Items.Count >= 7)
                    {
                        frmSoftRegister frm = new frmSoftRegister();
                        if (frm.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                    }
                }
                modhost.HostCode   = Util.HOST_CODE;
                modhost.UpdateUser = Util.UserId;
                if (bllhost.Exists(modhost.HostName, out Util.emsg))
                {
                    bllhost.Update(modhost.HostName, modhost, out Util.emsg);
                }
                else
                {
                    bllhost.Insert(modhost, out Util.emsg);
                }

                this.DialogResult = DialogResult.OK;
                this.Cursor       = Cursors.Default;
                return;
            }
            else
            {
                //this.DialogResult = DialogResult.Cancel;
                this.Cursor = Cursors.Default;
                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
示例#12
0
        private void LoadData()
        {
            DBGrid.Columns.Clear();
            ArrayList arrHeader = new ArrayList();
            ArrayList arrTitle  = new ArrayList();

            arrHeader.Add(clsTranslate.TranslateString("GroupId"));
            arrHeader.Add(clsTranslate.TranslateString("TaskCode"));
            arrHeader.Add(clsTranslate.TranslateString("TaskName"));
            arrTitle.Add(clsTranslate.TranslateString("GroupId"));
            arrTitle.Add(clsTranslate.TranslateString("TaskCode"));
            arrTitle.Add(clsTranslate.TranslateString("TaskName"));
            dalUserList blluser = new dalUserList();
            BindingCollection <modUserList> listuser = blluser.GetIList(true, out Util.emsg);

            if (listuser != null && listuser.Count > 0)
            {
                foreach (modUserList mod in listuser)
                {
                    arrHeader.Add(mod.UserId);
                    arrTitle.Add(mod.UserName);
                }
            }
            for (int i = 0; i < arrHeader.Count; i++)
            {
                //if (i <= 1)
                //{
                DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn();
                col.HeaderText       = arrTitle[i].ToString();
                col.DataPropertyName = arrHeader[i].ToString();
                col.Name             = arrHeader[i].ToString();
                if (i == 1)
                {
                    col.Visible = false;
                }
                else if (i == 0 || i == 2)
                {
                    col.Width = 120;
                }
                else
                {
                    col.Width = 30;
                }
                col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                DBGrid.Columns.Add(col);
                col.Dispose();
                //}
                //else
                //{
                //    DataGridViewCheckBoxColumn col = new DataGridViewCheckBoxColumn();
                //    col.HeaderText = arrTitle[i].ToString();
                //    col.DataPropertyName = arrHeader[i].ToString();
                //    col.Width = 70;
                //    DBGrid.Columns.Add(col);
                //    col.Dispose();
                //}
            }

            DataGridViewRow row;
            dalTaskList     bll = new dalTaskList();
            BindingCollection <modTaskList> list = bll.GetIList(string.Empty, false, false, out Util.emsg);

            if (list != null && list.Count > 0)
            {
                foreach (modTaskList mod in list)
                {
                    row = new DataGridViewRow();
                    row.CreateCells(DBGrid);
                    row.Cells[0].Value = clsTranslate.TranslateString(mod.GroupId);
                    row.Cells[1].Value = mod.TaskCode;
                    row.Cells[2].Value = clsTranslate.TranslateString(mod.TaskName);
                    DBGrid.Rows.Add(row);
                    row.Dispose();
                }
            }
            for (int iCol = 3; iCol < DBGrid.ColumnCount; iCol++)
            {
                dalTaskGrant blltg = new dalTaskGrant();
                BindingCollection <modTaskGrant> listtg = blltg.GetUserGrantData(false, false, DBGrid.Columns[iCol].Name, string.Empty, string.Empty, out Util.emsg);
                if (listtg != null && listtg.Count > 0)
                {
                    foreach (modTaskGrant mod in listtg)
                    {
                        for (int iRow = 0; iRow < DBGrid.RowCount; iRow++)
                        {
                            if (mod.TaskCode.CompareTo(DBGrid.Rows[iRow].Cells[1].Value.ToString()) == 0)
                            {
                                DBGrid.Rows[iRow].Cells[iCol].Value = "√";
                                break;
                            }
                        }
                    }
                }
            }
            DBGrid.Columns[2].Frozen = true;
            DBGrid.AlternatingRowsDefaultCellStyle.BackColor = Color.Empty;
            DBGrid.Columns[0].DefaultCellStyle.BackColor     = frmOptions.ALTERNATING_BACKCOLOR;
            DBGrid.Columns[1].DefaultCellStyle.BackColor     = frmOptions.ALTERNATING_BACKCOLOR;
            DBGrid.Columns[2].DefaultCellStyle.BackColor     = frmOptions.ALTERNATING_BACKCOLOR;
            DBGrid.MergeColumnNames.Add(arrHeader[0].ToString());
            DBGrid.ColumnHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.True;
        }
示例#13
0
        private void SEC_TASK_GRANT_Load(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                dalRoleList bll = new dalRoleList();
                //DataSet ds = bll.GetRoleList(true, out Util.emsg);
                tvUser2.ImageList = Util.GetImageList();
                BindingCollection <modRoleList> rolelist = new BindingCollection <modRoleList>();
                rolelist = bll.GetIList(true, out Util.emsg);
                if (rolelist != null)
                {
                    comboBox1.ValueMember   = "RoleId";
                    comboBox1.DisplayMember = "RoleDesc";
                    comboBox1.DataSource    = rolelist;
                    if (comboBox1.Items.Count > 0)
                    {
                        comboBox1.SelectedIndex = 0;
                        //LoadListBox();
                    }

                    foreach (modRoleList role in rolelist)
                    {
                        dalUserList _ubll = new dalUserList();
                        BindingCollection <modUserList> userlist = _ubll.GetIList(role.RoleId, out Util.emsg);
                        if (userlist != null)
                        {
                            TreeNode tn = tvUser2.Nodes.Add(role.RoleId, role.RoleDesc, 0, 1);
                            foreach (modUserList user in userlist)
                            {
                                TreeNode node = tn.Nodes.Add(user.UserId, user.UserName, 2, 3);
                                node.ToolTipText = node.Name;
                            }
                        }
                    }
                    tvUser2.ShowNodeToolTips = true;
                    dalTaskList task = new dalTaskList();
                    BindingCollection <modTaskList> tasklist = task.GetIList(string.Empty, true, false, out Util.emsg);
                    DBGrid2.DataSource = tasklist;
                    for (int j = 0; j < DBGrid2.RowCount; j++)
                    {
                        DBGrid2.Rows[j].Cells["Taskname"].Value = clsTranslate.TranslateString(DBGrid2.Rows[j].Cells["Taskname"].Value.ToString());
                    }

                    DataGridViewCheckBoxColumn checkboxColumn = new DataGridViewCheckBoxColumn();
                    checkboxColumn.HeaderText       = clsTranslate.TranslateString("Select");
                    checkboxColumn.DataPropertyName = "Select";
                    DBGrid2.Columns.Insert(0, checkboxColumn);

                    DBGrid2.Columns[9].Visible = false;
                    DBGrid2.Columns[8].Visible = false;
                    DBGrid2.Columns[7].Visible = false;
                    DBGrid2.Columns[6].Visible = false;
                    DBGrid2.Columns[5].Visible = false;
                    DBGrid2.Columns[4].Visible = false;
                    DBGrid2.Columns[3].Visible = false;

                    //DBGrid2.Columns[8].ReadOnly = true;
                    //DBGrid2.Columns[7].ReadOnly = true;
                    //DBGrid2.Columns[6].ReadOnly = true;
                    //DBGrid2.Columns[5].ReadOnly = true;
                    //DBGrid2.Columns[4].ReadOnly = true;
                    //DBGrid2.Columns[3].ReadOnly = true;
                    DBGrid2.Columns[2].ReadOnly = true;
                    DBGrid2.Columns[1].ReadOnly = true;
                    //Util.AutoSetColWidth(1, DBGrid2);
                    DBGrid2.AllowUserToAddRows = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }