Example #1
0
        public void SetMenuPower()
        {
            int i;

            dalTaskGrant dal = new dalTaskGrant();
            BindingCollection <modTaskGrant> grantlist = dal.GetUserGrantData(true, false, Util.UserId, string.Empty, string.Empty, out Util.emsg);

            if (grantlist != null)
            {
                for (i = 0; i < menuMain.Items.Count; i++)
                {
                    GetSubMenu((ToolStripMenuItem)menuMain.Items[i], grantlist);
                }
            }

            //toolPieceworkCreate.Enabled = OPA_PIECEWORK_LIST_CREATE.Enabled;
            //toolPieceworkWorkAudit.Enabled = OPA_PIECEWORK_LIST_AUDIT.Enabled;
            //toolPieceworkBatchAdd.Enabled = OPA_PIECEWORK_BATCH_ADD.Enabled;
            if (Util.UserId.CompareTo("READ") != 0)
            {
                SEC_CHANGE_PASSWORD.Enabled = true;
            }
            else
            {
                SEC_CHANGE_PASSWORD.Enabled = false;
            }
        }
Example #2
0
        public static void SetFormStatus(Form frm)
        {
            dalTaskGrant bll = new dalTaskGrant();
            BindingCollection <modTaskGrant> grantlist = bll.GetUserGrantData(true, false, Util.UserId, string.Empty, string.Empty, out Util.emsg);

            foreach (Control ctl in frm.Controls)
            {
                if (ctl.GetType().ToString() == "LXMS.ButtonEx" || ctl.GetType().ToString() == "System.Windows.Forms.LinkLabel")
                {
                    ctl.Enabled = false;
                    foreach (modTaskGrant mod in grantlist)
                    {
                        if (mod.Url.CompareTo(ctl.Name) == 0)
                        {
                            ctl.Enabled = true;
                            break;
                        }
                    }
                }
                else
                {
                    SetSubControlStatus(ctl, grantlist);
                }
            }
        }
Example #3
0
 private void tvUser2_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (DBGrid2.RowCount == 0)
     {
         return;
     }
     this.Cursor = Cursors.WaitCursor;
     for (int j = 0; j < DBGrid2.RowCount; j++)
     {
         DBGrid2.Rows[j].Cells[0].Value = 0;
     }
     if (e.Node.Level == 1)
     {
         //toolSave2.Enabled = true;
         DBGrid2.ReadOnly            = false;
         DBGrid2.Columns[0].ReadOnly = false;
         BindingCollection <modTaskGrant> grantlist = _dal.GetUserGrantData(true, false, e.Node.Name.ToString(), string.Empty, string.Empty, out Util.emsg);
         if (grantlist != null)
         {
             foreach (modTaskGrant mod in grantlist)
             {
                 for (int j = 0; j < DBGrid2.RowCount; j++)
                 {
                     if (mod.TaskCode == DBGrid2.Rows[j].Cells[1].Value.ToString())
                     {
                         DBGrid2.Rows[j].Cells[0].Value = 1;
                         break;
                     }
                 }
             }
         }
     }
     else
     {
         DBGrid2.ReadOnly = true;
         //toolSave2.Enabled = false;
         BindingCollection <modTaskGrant> grantlist = _dal.GetGrantData(true, false, e.Node.Name.ToString(), out Util.emsg);
         if (grantlist != null)
         {
             foreach (modTaskGrant mod in grantlist)
             {
                 for (int j = 0; j < DBGrid2.RowCount; j++)
                 {
                     if (mod.TaskCode == DBGrid2.Rows[j].Cells[1].Value.ToString())
                     {
                         DBGrid2.Rows[j].Cells[0].Value = 1;
                         break;
                     }
                 }
             }
         }
     }
     this.Cursor = Cursors.Default;
 }
Example #4
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;
        }