private void NewSB_Click(object sender, EventArgs e) { Wares.Category.CategoryData form = new Wares.Category.CategoryData("new", null); form.ShowDialog(); manager.CloseContext(); manager = new ContextManager(); Fill(); }
private void EditSB_Click(object sender, EventArgs e) { Wares.Price.PriceData form = new Wares.Price.PriceData("edit", Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value)); form.ShowDialog(); manager.Save(); manager.CloseContext(); manager = new ContextManager(); Fill(); }
private void EditSB_Click(object sender, EventArgs e) { DocumentData form = new DocumentData("edit", Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value), null); form.ShowDialog(); manager.Save(); manager.CloseContext(); manager = new ContextManager(); documentsLogic = new DocumentsLogic(manager); Fill(); }
private void EditSB_Click(object sender, EventArgs e) { if (DataGV.SelectedRows.Count > 0) { EmployeeSalaryData form = new EmployeeSalaryData("edit", Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value), Convert.ToInt32(employeeId)); form.ShowDialog(); manager.Save(); manager.CloseContext(); manager = new ContextManager(); Fill(); } }
private void EditSB_Click(object sender, EventArgs e) { int selectedIndex = DataGV.SelectedRows[0].Index; Wares.Ware.WareData form = new Wares.Ware.WareData("edit", Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value), null); form.ShowDialog(); manager.Save(); manager.CloseContext(); manager = new ContextManager(); Fill("Name"); wareFilterUC1.Fill(); DataGV.Rows[selectedIndex].Selected = true; }
public ActionEdit(int _ID) { ID = _ID; InitializeComponent(); ContextManager manager = new ContextManager(); SecurityActionsLogic logic = new SecurityActionsLogic(manager); SecurityAction action = logic.Get(ID); NameTB.Text = action.Name; CodeTB.Text = action.Code; DescriptionTB.Text = action.Description; SecurityCategoriesLogic categoriesLogic = new SecurityCategoriesLogic(manager); //role.SecurityCategory.Name var categories = categoriesLogic.GetAll(); int i = 0; foreach (var category in categories) { Helpers.Item item = new Helpers.Item(); item.ID = category.ID.ToString(); item.Name = category.Name; CategoriesCB.Items.Add(item); if (action.CategoryID == category.ID) { CategoriesCB.SelectedIndex = i; } i++; } manager.CloseContext(); }
private void FillGrid() { ContextManager manager = new ContextManager(); StaffStructureObjectsLogic StructureObjects = new StaffStructureObjectsLogic(manager); DataGV.AutoGenerateColumns = false; DataGV.DataSource = StructureObjects.GetAll(); BindingSource bs = new BindingSource(); //bs.DataSource = StructureObjects.GetAll().Select(x => new { // x.ID, // x.Name, // x.Active, // x.AllowServices, // ParrentStructureObjectName = (x.StaffStructureObject1 == null ? "" : x.StaffStructureObject1.Name) // }); bs.DataSource = StructureObjects.GetHeirarchyView(); DataGV.DataSource = bs; //ataGridView1.DataSource = StructureObjects.GetAll();//.Select(x => new { x.ID, x.Name, x.Active, x.AllowServices, ParrentStructureObjectName = (x.StaffStructureObject1 == null ? "" : x.StaffStructureObject1.Name) }); //foreach (var a in StructureObjects.GetAll().Select(x => new { x.ID, x.Name, x.Active, x.AllowServices, ParentStructureObjectName = (x.StaffStructureObject1 == null ? "" : x.StaffStructureObject1.Name) })) //{ // MessageBox.Show(a.ParentStructureObjectName /* + (a.StaffStructureObject1 == null ? "" : a.StaffStructureObject1.Name)*/); //} DataGV.Update(); manager.CloseContext(); }
private void FillActions() { ContextManager manager = new ContextManager(); SecurityActionsLogic actions = new SecurityActionsLogic(manager); if (RolesCB.SelectedIndex >= 0) { int categoryId = Convert.ToInt32(CategoriesCB.SelectedValue); ActionsGV.DataSource = actions.GetByCategory(categoryId); } else { ActionsGV.DataSource = actions.GetAll(); } //ContextManager manager = new ContextManager(); DataGridViewCheckBoxCell ch1 = new DataGridViewCheckBoxCell(); SecurityRoleActionsLogic roleActions = new SecurityRoleActionsLogic(manager); foreach (DataGridViewRow row in ActionsGV.Rows) { ch1 = (DataGridViewCheckBoxCell)row.Cells["AllowAction"]; int actionId = Convert.ToInt32(row.Cells["ID"].Value.ToString()); int roleId = Convert.ToInt32(RolesCB.SelectedValue); bool actionAllow = roleActions.Exists(roleId, actionId, true); ch1.Value = actionAllow; } manager.CloseContext(); }
public StructureObjectsList() { InitializeComponent(); ContextManager manager = new ContextManager(); manager.CloseContext(); FillGrid(); }
private void FillGrid() { ContextManager manager = new ContextManager(); SecurityRolesLogic sr = new SecurityRolesLogic(manager); RolesGV.DataSource = sr.GetAll(); manager.CloseContext(); }
private void SaveBt_Click(object sender, EventArgs e) { ContextManager manager = new ContextManager(); SecurityCategoriesLogic logic = new SecurityCategoriesLogic(manager); logic.Update(ID, NameTB.Text); manager.Save(); manager.CloseContext(); this.Close(); }
private void SaveBt_Click(object sender, EventArgs e) { ContextManager manager = new ContextManager(); SecurityActionsLogic logic = new SecurityActionsLogic(manager); logic.Create(NameTB.Text, CodeTB.Text, Convert.ToInt32(CategoriesCB.SelectedValue), DescriptionTB.Text); manager.Save(); manager.CloseContext(); this.Close(); }
private void DeleteSB_Click(object sender, EventArgs e) { ContextManager manager = new ContextManager(); StaffStructureObjectsLogic StructureObjects = new StaffStructureObjectsLogic(manager); StructureObjects.Delete(Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value)); manager.Save(); manager.CloseContext(); FillGrid(); }
private void SaveBt_Click(object sender, EventArgs e) { ContextManager manager = new ContextManager(); SecurityRolesLogic sr = new SecurityRolesLogic(manager); sr.Create(NameTB.Text, DescriptionTB.Text); manager.Save(); manager.CloseContext(); this.Close(); }
private void DeleteSB_Click(object sender, EventArgs e) { ContextManager manager = new ContextManager(); SecurityRolesLogic sr = new SecurityRolesLogic(manager); sr.Delete(Convert.ToInt32(RolesGV.SelectedRows[0].Cells[0].FormattedValue)); manager.Save(); FillGrid(); manager.CloseContext(); }
private void SaveBt_Click(object sender, EventArgs e) { ContextManager manager = new ContextManager(); SecurityActionsLogic logic = new SecurityActionsLogic(manager); int categoryId = Convert.ToInt32(((Helpers.Item)(CategoriesCB.SelectedItem)).ID); logic.Update(ID, NameTB.Text, categoryId, CodeTB.Text, DescriptionTB.Text); manager.Save(); manager.CloseContext(); this.Close(); }
private void FillCategories() { ContextManager manager = new ContextManager(); SecurityCategoriesLogic categories = new SecurityCategoriesLogic(manager); CategoriesLB.DataSource = categories.GetAll(); if (CategoriesLB.Items.Count > 0) { CategoriesLB.SelectedIndex = 0; } manager.CloseContext(); }
public RoleEdit(int _ID) { ID = _ID; InitializeComponent(); ContextManager manager = new ContextManager(); SecurityRolesLogic sr = new SecurityRolesLogic(manager); SecurityRole role = sr.Get(ID); NameTB.Text = role.Name; DescriptionTB.Text = role.Description; manager.CloseContext(); }
public CategoryEdit(int _ID) { ID = _ID; InitializeComponent(); ContextManager manager = new ContextManager(); SecurityCategoriesLogic logic = new SecurityCategoriesLogic(manager); SecurityCategory role = logic.Get(ID); NameTB.Text = role.Name; manager.CloseContext(); }
private void DeleteComponentBt_Click(object sender, EventArgs e) { if (WareComponentsGV.SelectedRows.Count > 0) { int wareComponentId = Convert.ToInt32(WareComponentsGV.SelectedRows[0].Cells["WareComponentID"].Value); WareComponentsLogic wareComponentsLogic = new WareComponentsLogic(manager); wareComponentsLogic.Delete(wareComponentId); manager.Save(); manager.CloseContext(); manager = new ContextManager(); FillComponentWares(); } }
public RoleActionsF() { InitializeComponent(); //створюэмо грід з можливістю групування GroupByGrid grid = new GroupByGrid(); ContextManager manager = new ContextManager(); SecurityActionsLogic actions = new Logic.Security.SecurityActionsLogic(manager); SecurityCategoriesLogic categories = new SecurityCategoriesLogic(manager); SecurityRolesLogic roles = new SecurityRolesLogic(manager); ActionsGV.AutoGenerateColumns = false; RolesCB.DataSource = roles.GetAll(); CategoriesCB.DataSource = categories.GetAll(); manager.CloseContext(); }
private void FillGrid() { ContextManager manager = new ContextManager(); SecurityActionsLogic logic = new SecurityActionsLogic(manager); if (CategoriesLB.SelectedItems.Count > 0) { Compas.Model.SecurityCategory item = ((Compas.Model.SecurityCategory)(CategoriesLB.SelectedItems[0])); int categoryId = Convert.ToInt32(item.ID); DataGV.DataSource = logic.GetByCategory(categoryId); } else { DataGV.DataSource = logic.GetAll(); } manager.CloseContext(); }
public ActionNew() { InitializeComponent(); ContextManager manager = new ContextManager(); SecurityCategoriesLogic cl = new SecurityCategoriesLogic(manager); CategoriesCB.DataSource = cl.GetAll(); CategoriesCB.Update(); //CategoriesCB.Items.AddRange(cl.GetAll()); //foreach (var c in cl.GetAll()) //{ // CategoriesCB.Items.Add( //} manager.CloseContext(); }
private void SaveBt_Click(object sender, EventArgs e) { DateTime month = new DateTime(dateTimePicker1.Value.Year, dateTimePicker1.Value.Month, 1, 0, 0, 0); int structureObjectId = 0; if (StructureObjectsCB.SelectedIndex >= 0) { structureObjectId = Convert.ToInt32(((Item)(StructureObjectsCB.SelectedItem)).ID); } StaffEmployeeSalariesLogic employeeSalariesLogic = new StaffEmployeeSalariesLogic(manager); employeeSalariesLogic.Recalculate(month, structureObjectId); manager.Save(); manager.CloseContext(); manager = new ContextManager(); Fill(); }
/// <summary> /// Проверяем, существует ли имя пользователя в базе данных — файле XML. /// </summary> /// <param name="name">Имя пользователя.</param> /// <returns>ID пользователя.</returns> private int AuthUser(string name, string Hash) { // Считываем и сравниваем имя пользователя. ContextManager manager = new ContextManager(); SecurityUsersLogic users = new SecurityUsersLogic(manager); int userId = users.Get(name, Hash); if (userId >= 0) { this._isAuth = true; } else { this._isAuth = false; } manager.CloseContext(); return(userId); // Если пользователь не найден, генерируем исключение. throw new System.Security.SecurityException(String.Format("Пользователь {0} не найден в базе данных.", name)); }
private void SaveBt_Click(object sender, EventArgs e) { ContextManager manager = new ContextManager(); SecurityRoleActionsLogic actions = new SecurityRoleActionsLogic(manager); int roleId = Convert.ToInt32(RolesCB.SelectedValue); int categoryId = Convert.ToInt32(CategoriesCB.SelectedValue); foreach (DataGridViewRow r in ActionsGV.Rows) { DataGridViewCheckBoxCell chk = r.Cells["AllowAction"] as DataGridViewCheckBoxCell; int actionId = Convert.ToInt32(r.Cells["ID"].Value.ToString()); bool allow = false; if (Convert.ToBoolean(chk.Value) == true) //MessageBox.Show("this cell checked" + r.Cells["ID"].Value.ToString()); { allow = true; } else { allow = false; } SecurityRoleAction actionExists = actions.Get(roleId, actionId); if (actionExists == null) { actions.Create(roleId, actionId, allow); } else { actions.Update(actionExists.ID, roleId, actionId, allow); } } manager.Save(); manager.CloseContext(); MsgL.Text = "Дані збережено."; }
private void MainMDI_Load(object sender, EventArgs e) { //Початковий запуск - перевіряємо чи заповнений довідник типівдокументів ContextManager manager = new ContextManager(); CompasDataContext context = manager.Context; DocumentTypesLogic documentTypes = new DocumentTypesLogic(manager); var existTypes = documentTypes.GetAll(); if (existTypes.Count == 0) { documentTypes.Create(1, "Прихідна накладна", true, false); documentTypes.Create(2, "Розхідна накладна", false, true); documentTypes.Create(3, "Чек", false, true); documentTypes.Create(4, "Переміщення товару", false, false); documentTypes.Create(5, "Замовлення", false, false); manager.Save(); } ConfigurationParametersLogic config = new ConfigurationParametersLogic(manager); ConfigurationParameter param0 = config.Get(ParametersLogic.Parameter.MENUITEM_CARDS_VISIBLE.ToString()); if (param0 != null) { if (param0.Value == "FALSE") { foreach (ToolStripMenuItem mainMenu in menuStrip.Items) { if (mainMenu.Text == @"Довідники") { foreach (ToolStripItem subMenu in mainMenu.DropDownItems) { if (subMenu.Name == "CardsToolStripMenuItem") { subMenu.Visible = false; } } } } } } ConfigurationParameter param1 = config.Get(ParametersLogic.Parameter.MENUITEM_CARWASH_VISIBLE.ToString()); if (param1 != null) { if (param1.Value == "FALSE") { foreach (ToolStripMenuItem mainMenu in menuStrip.Items) { if (mainMenu.Text == @"Довідники") { foreach (ToolStripItem subMenu in mainMenu.DropDownItems) { if (subMenu.Name == "CarWashToolStripMenuItem") { subMenu.Visible = false; } } } } } } ConfigurationParameter param2 = config.Get(ParametersLogic.Parameter.MENUITEM_SECURITY_ENABLED.ToString()); if (param2 != null) { if (param2.Value == "FALSE") { menuStrip.Items["SecurityToolStripMenuItem"].Enabled = false; } } manager.CloseContext(); }
private void EmployeesList_FormClosed(object sender, FormClosedEventArgs e) { manager.CloseContext(); }