예제 #1
0
파일: RolesForm.cs 프로젝트: rymarrv/Compas
 private void FillGrid()
 {
     ContextManager manager = new ContextManager();
     SecurityRolesLogic sr = new SecurityRolesLogic(manager);
     RolesGV.DataSource = sr.GetAll();
     manager.CloseContext();
 }
예제 #2
0
파일: ActionNew.cs 프로젝트: rymarrv/Compas
 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();
 }
예제 #3
0
파일: RolesForm.cs 프로젝트: rymarrv/Compas
 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();
 }
예제 #4
0
 private void SaveBt_Click(object sender, EventArgs e)
 {
     ContextManager manager = new ContextManager();
     SecurityCategoriesLogic logic = new SecurityCategoriesLogic(manager);
     logic.Create(NameTB.Text);
     manager.Save();
     manager.CloseContext();
     this.Close();
 }
예제 #5
0
파일: RoleNew.cs 프로젝트: rymarrv/Compas
 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();
 }
예제 #6
0
        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();
        }
예제 #7
0
파일: ActionNew.cs 프로젝트: rymarrv/Compas
        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();
        }
예제 #8
0
 private void DataGV_DoubleClick_1(object sender, EventArgs e)
 {
     DocumentData form = new DocumentData("edit", Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value), cashRegister);
     form.ShowDialog();
     manager.Save();
     manager.CloseContext();
     manager = new ContextManager();
     documentsLogic = new DocumentsLogic(manager);
     manager.Save();
     manager.CloseContext();
     manager = new ContextManager();
     Fill();
 }
예제 #9
0
        /// <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));
        }
예제 #10
0
파일: MainMDI.cs 프로젝트: rymarrv/Compas
        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();
        }