COperator GetCOperator(DamaiDataSet.OperatorRow r) { COperator op = new COperator(); if (!r.IsEditAccountingTitleNull()) { op.EditAccountingTitle = r.EditAccountingTitle; } if (!r.IsEditBankNull()) { op.EditBank = r.EditBank; } if (!r.IsEditEmployeeNull()) { op.EditEmployee = r.EditEmployee; } if (!r.IsEditExpenseNull()) { op.EditExpense = r.EditExpense; } if (!r.IsEditIngredientNull()) { op.EditIngredient = r.EditIngredient; } if (!r.IsEditInventoryNull()) { op.EditInventory = r.EditInventory; } if (!r.IsEditOnDutyNull()) { op.EditOnDuty = r.EditOnDuty; } if (!r.IsEditOperatorNull()) { op.EditOperator = r.EditOperator; } if (!r.IsEditProductNull()) { op.EditProduct = r.EditProduct; } if (!r.IsEditRecipeNull()) { op.EditRecipe = r.EditRecipe; } if (!r.IsEditSalaryNull()) { op.EditSalary = r.EditSalary; } if (!r.IsEditShipmentNull()) { op.EditShipment = r.EditShipment; } if (!r.IsEditVendorNull()) { op.EditVendor = r.EditVendor; } if (!r.IsEditVoucherNull()) { op.EditVoucher = r.EditVoucher; } if (!r.IsIsManagerNull()) { op.IsManager = r.IsManager; } if (!r.IsIsSuperNull()) { op.IsSuper = r.IsSuper; } if (!r.IsLockAccVoucherNull()) { op.LockAccVoucher = r.LockAccVoucher; } if (!r.IsLockExpenseNull()) { op.LockExpense = r.LockExpense; } if (!r.IsLockHRNull()) { op.LockHR = r.LockHR; } if (!r.IsLockInventoryNull()) { op.LockInventory = r.LockInventory; } if (!r.IsLockShipmentNull()) { op.LockShipment = r.LockShipment; } if (!r.IsLockVoucherNull()) { op.LockVoucher = r.LockVoucher; } if (!r.IsRevenueOperateNull()) { op.RevenueOperate = r.RevenueOperate; } if (!r.IsStopAccountNull()) { op.StopAccount = r.StopAccount; } if (!r.IsEditCustomerNull()) { op.EditCustomer = r.EditCustomer; } op.LoginName = r.LoginName; if (r.IsNameNull()) { op.Name = "操作員" + r.OperatorID.ToString(); } else { op.Name = r.Name; } op.OperatorID = r.OperatorID; return(op); }
public FormHome(COperator Op, HardwareConfig cfg, DamaiDataSet.ApartmentRow apartment, DamaiDataSet.ApartmentDataTable authorizedApartment) { InitializeComponent(); Operator = Op; MyFunction.OperatorID = Op.OperatorID; MyFunction.HardwareCfg = m_Config = cfg; m_DefaultApartment = apartment; m_AuthorizedApartment = authorizedApartment; SetFormTitle(); ToolStripMenuItem basic, accounting, bank, it; basic = (ToolStripMenuItem)menu1.Items["基本資料MenuItem"]; accounting = (ToolStripMenuItem)menu1.Items["會計MenuItem"]; it = (ToolStripMenuItem)menu1.Items["IT維護MenuItem"]; bank = (ToolStripMenuItem)menu1.Items["銀行MenuItem"]; basic.Enabled = (Op.EditEmployee | Op.EditOperator | Op.EditIngredient | Op.EditVendor); accounting.Enabled = Op.EditAccountingTitle; it.Enabled = Op.IsSuper; bank.Enabled = Op.EditBank; bool manager = Op.IsManager; MyFunction.IsManager = manager; MyFunction.LockHR = Op.LockHR; MyFunction.LockInventory = Op.LockInventory; basic.DropDownItems["食材表MenuItem"].Enabled = Op.EditIngredient; basic.DropDownItems["配方表MenuItem"].Enabled = Op.EditRecipe; basic.DropDownItems["產品表MenuItem"].Enabled = Op.EditProduct; basic.DropDownItems["产品类别ToolStripMenuItem"].Enabled = Op.EditProduct; basic.DropDownItems["編修菜單MenuItem"].Enabled = Op.EditProduct; basic.DropDownItems["供應商MenuItem"].Enabled = Op.EditVendor; basic.DropDownItems["客户MenuItem"].Visible = Op.EditCustomer; 轉帳傳票MenuItem.Enabled = Op.EditAccountingTitle; // 傳票和會計科目 accounting.DropDownItems["會計科目MenuItem"].Enabled = Op.LockAccVoucher && Op.EditAccountingTitle; accounting.DropDownItems["傳票設定MenuItem"].Visible = Op.LockAccVoucher && Op.EditAccountingTitle; // 核傳票+編修科目 bank.DropDownItems["銀行帳號MenuItem"].Enabled = Op.EditBank; bank.DropDownItems["銀行帳號MenuItem"].Visible = Op.EditBank; it.DropDownItems["操作員MenuItem"].Enabled = Op.EditOperator; it.DropDownItems["硬體環境MenuItem"].Enabled = Op.IsSuper; it.DropDownItems["年初開帳MenuItem"].Visible = Op.IsSuper; it.DropDownItems["編修部門MenuItem"].Visible = Op.IsSuper; menu1.Items["庫存MenuItem"].Enabled = Op.EditInventory; menu1.Items["費用MenuItem"].Enabled = Op.EditExpense; menu1.Items["進貨MenuItem"].Enabled = Op.EditVoucher; menu1.Items["收入MenuItem"].Enabled = Op.RevenueOperate; menu1.Items["報表MenuItem"].Enabled = manager; ToolStripMenuItem i = (ToolStripMenuItem)menu1.Items["查核MenuItem"]; i.Enabled = Op.LockExpense || Op.LockVoucher || Op.LockAccVoucher; 查核費用MenuItem.Enabled = Op.LockExpense; 查核進貨MenuItem.Enabled = Op.LockVoucher; 查核傳票MenuItem.Enabled = Op.LockAccVoucher; 人事MenuItem.Enabled = Op.EditSalary || Op.EditOnDuty || Op.LockHR; 考勤MenuItem.Enabled = Op.EditOnDuty; 排班表MenuItem.Enabled = Op.EditOnDuty; 資料卡MenuItem.Enabled = Op.EditSalary; 出货MenuItem.Enabled = Op.EditShipment || Op.LockShipment; if (m_AuthorizedApartment.Rows.Count <= 1) // 只有一家店可登入的就不顯示了 { 切換門店MenuItem.Enabled = false; } if (MyFunction.LockAll) { i.DropDownItems["鎖定資料庫MenuItem"].Text = "解鎖資料庫"; } else { i.DropDownItems["鎖定資料庫MenuItem"].Text = "鎖定資料庫"; } foreach (ToolStripMenuItem item in menu1.Items) { if (!item.Enabled) { item.Visible = false; } else { foreach (ToolStripMenuItem its in item.DropDownItems) { if (!its.Enabled) { its.Visible = false; } } } } }