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; } }
private void OPA_CUSTOMER_ORDER_LIST_Load(object sender, EventArgs e) { DBGrid.ContextMenuStrip.Items.Add("-"); DBGrid.ContextMenuStrip.Items.Add(clsTranslate.TranslateString("Sales Shipment"), LXMS.Properties.Resources.Plugin, new System.EventHandler(this.mnuSalesShipment_Click)); DBGrid.ContextMenuStrip.Items.Add(clsTranslate.TranslateString("Sales Design Form"), LXMS.Properties.Resources.Plugin, new System.EventHandler(this.mnuDesignForm_Click)); DBGrid.ContextMenuStrip.Items.Add(clsTranslate.TranslateString("Purchase List"), LXMS.Properties.Resources.Plugin, new System.EventHandler(this.mnuPurchaseList_Click)); DBGrid.ContextMenuStrip.Items.Add("-"); DBGrid.ContextMenuStrip.Items.Add(clsTranslate.TranslateString("Copy Item"), LXMS.Properties.Resources.Copy, new System.EventHandler(this.mnuCopyItem_Click)); DBGrid.ContextMenuStrip.Items.Add("-"); DBGrid.ContextMenuStrip.Items.Add(clsTranslate.TranslateString("Generate ") + clsTranslate.TranslateString("Sales Shipment"), LXMS.Properties.Resources.new_med, new System.EventHandler(this.mnuNewSalesShipment_Click)); DBGrid.ContextMenuStrip.Items.Add(clsTranslate.TranslateString("Generate ") + clsTranslate.TranslateString("Sales Design Form"), LXMS.Properties.Resources.new_med, new System.EventHandler(this.mnuNewDesignForm_Click)); dalTaskGrant dalgrant = new dalTaskGrant(); if (dalgrant.CheckAccess(Util.UserId, "OPA_011")) { DBGrid.ContextMenuStrip.Items.Add(clsTranslate.TranslateString("Generate ") + clsTranslate.TranslateString("Vendor Order List"), LXMS.Properties.Resources.new_med, new System.EventHandler(this.mnuNewVendorOrderList_Click)); } if (dalgrant.CheckAccess(Util.UserId, "OPA_015")) { DBGrid.ContextMenuStrip.Items.Add(clsTranslate.TranslateString("Generate ") + clsTranslate.TranslateString("Purchase List"), LXMS.Properties.Resources.new_med, new System.EventHandler(this.mnuNewPurchaseList_Click)); } clsTranslate.InitLanguage(this); FillControl.FillCustomerList(cboCustomer, true); DBGrid.Tag = this.Name; dtpFrom.Value = Util.modperiod.StartDate; dtpTo.Value = Util.modperiod.EndDate; if (dtpTo.Value < DateTime.Today) { dtpTo.Value = DateTime.Today.AddDays(1); } //LoadData(); }
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); } } }
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; }