void EncryptCopyApartment(DamaiDataSet.ApartmentRow plainRow, DamaiDataSet.ApartmentDataTable encryptedTable) { var row = encryptedTable.FindByApartmentID(plainRow.ApartmentID); bool isNew = (row == null); if (isNew) { row = encryptedTable.NewApartmentRow(); row.ApartmentID = plainRow.ApartmentID; } if (!plainRow.IsApartmentAllNameNull()) { row.ApartmentAllName = plainRow.ApartmentAllName; } if (!plainRow.IsApartmentNameNull()) { row.ApartmentName = plainRow.ApartmentName; } if (!plainRow.IsAppartementCodeNull()) { row.AppartementCode = plainRow.AppartementCode; } DataRow encR = (DataRow)row; DataRow plainR = (DataRow)plainRow; foreach (string col in ColumnsEncryted) // 這種寫法不檢查 IsNull, 所以這欄不准Null { try { string str = plainR[col].ToString().Trim(); if (str == "") { encR[col] = ""; continue; } byte[] buf = Encoder.RC2Encrypt(Encoding.Unicode.GetBytes(str), Key); encR[col] = Convert.ToBase64String(buf); } catch (Exception ex) { } // 資料有問題不處理 } if (isNew) { encryptedTable.AddApartmentRow(row); } }
public FormSwitchApartment(DamaiDataSet.ApartmentDataTable authorizedApartment, DelegateApartmentSwitchTo apartmentSwitchTo) { m_AuthorizedApartment = authorizedApartment; m_ApartmentSwitchTo = apartmentSwitchTo; InitializeComponent(); }
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; } } } } }