Ejemplo n.º 1
0
 private void BtnAddStocks_Click(object sender, EventArgs e)
 {
     try
     {
         if (lblstockproID.Text == "" || txtProCode.Text == "" || txtProName.Text == "" || txtProPrice.Text == "" || txtStockQuantity.Text == "")
         {
             MessageBox.Show("Please select a product to add stocks", "STOP", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
         else
         {
             db.sp_add_stocks(int.Parse(lblstockproID.Text), int.Parse(txtStockQuantity.Text), int.Parse(lblUser_id.Text), DateTime.Now);
             db.sp_add_inventory(int.Parse(lblstockproID.Text), int.Parse(txtStockQuantity.Text), int.Parse(lblUser_id.Text), DateTime.Now);
             AdminMainForm amf = new AdminMainForm();
             lblstockproID.Text       = "";
             txtProCode.Text          = "";
             txtProName.Text          = "";
             txtProPrice.Text         = "";
             lblUser_id.Text          = "";
             txtStockQuantity.Text    = "";
             amf.dgvStocks.DataSource = db.sp_view_stocks();
             this.Hide();
             MessageBox.Show("Product Stocks successfully Added!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     { MessageBox.Show(ex.Message); }
 }
Ejemplo n.º 2
0
 private void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (lblProductID.Text == "" || txtpro_code.Text == "" || txtpro_name.Text == "" || cmbProCategory.Text == "" || txtpro_price.Text == "")
         {
             MessageBox.Show("Please enter product information", "STOP", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
         else
         {
             db.sp_update_products(int.Parse(lblProductID.Text), txtpro_code.Text, txtpro_name.Text, cmbProCategory.Text, int.Parse(txtpro_price.Text), txtpro_desc.Text, DateTime.Now);
             lblProductID.Text   = "";
             txtpro_code.Text    = "";
             txtpro_name.Text    = "";
             cmbProCategory.Text = "";
             txtpro_price.Text   = "";
             txtpro_desc.Text    = "";
             MessageBox.Show("Product successfully Updated!", "information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             AdminMainForm amf = new AdminMainForm();
             amf.dgvProducts.DataSource = db.sp_view_products();
             this.Hide();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 3
0
 private void BtnAddStocks_Click(object sender, EventArgs e)
 {
     try
     {
         if (lblProductID.Text == "" || txtpro_code.Text == "" || txtpro_name.Text == "" || txtPro_Cat.Text == "" || txtpro_price.Text == "" || txtpro_quantity.Text == "")
         {
             MessageBox.Show("Please enter product information", "STOP", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
         else
         {
             int Stock       = int.Parse(lblStock.Text);
             int Pquantity   = int.Parse(txtpro_quantity.Text);
             int StocksAdded = Stock + Pquantity;
             lblStockOut.Text = "0";
             db.spUpdateStocks(txtpro_code.Text, int.Parse(txtpro_quantity.Text), decimal.Parse(txtBox.Text));
             db.spAddInventory(txtpro_code.Text, StocksAdded, int.Parse(txtpro_quantity.Text), int.Parse(lblStockOut.Text), decimal.Parse(txtBox.Text), DateTime.Now);
             MessageBox.Show("Product successfully Updated!", "information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             AdminMainForm amf = new AdminMainForm();
             amf.dgvProducts.DataSource = db.spViewProducts();
             this.Hide();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void BtnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtName.Text == "" || txtAddress.Text == "" || txtContact.Text == "" || cmbuCType.Text == "")
         {
             MessageBox.Show("Please input all fields", "STOP", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
         else
         {
             db.sp_add_customer(int.Parse(lblUserID.Text), txtName.Text, txtTin.Text, txtAddress.Text, txtBstyle.Text, txtContact.Text, cmbuCType.Text, DateTime.Now);
             txtName.Text    = "";
             txtAddress.Text = "";
             txtContact.Text = "";
             cmbuCType.Text  = "";
             MessageBox.Show("Customer uccessfully Added", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             AdminMainForm amf = new AdminMainForm();
             amf.dgvCustomersAcc.DataSource = db.sp_view_customer();
             this.Hide();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void BtnAddUser_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtuname.Text.Trim() == "" || txtpass.Text.Trim() == "" ||
             txtlname.Text.Trim() == "" || txtfname.Text.Trim() == "" || txtemail.Text.Trim() == "" ||
             cmbQuest.Text.Trim() == "" || txtans.Text.Trim() == "")
         {
             MessageBox.Show("Please complete the fields!", "STOP", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
         else
         {
             AdminMainForm amf = new AdminMainForm();
             amf.txtusertype.Text   = "Staff";
             amf.txtuserstatus.Text = "Active";
             db.sp_add_acc(txtuname.Text, txtpass.Text, amf.txtusertype.Text, txtfname.Text, txtlname.Text,
                           txtemail.Text, amf.txtuserstatus.Text, cmbQuest.Text, txtans.Text, DateTime.Now);
             txtuname.Text = "";
             txtpass.Text  = "";
             txtfname.Text = "";
             txtlname.Text = "";
             txtemail.Text = "";
             cmbQuest.Text = "";
             txtans.Text   = "";
             MessageBox.Show("User successfully Registered!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
             amf.pnlAdminMenu.Hide();
             this.Hide();
             amf.dgvUsersAcc.DataSource = db.sp_view_acc();
         }
     }
     catch (Exception ex)
     { MessageBox.Show(ex.Message); }
 }
Ejemplo n.º 6
0
        public AdminChangeUser(AdminMainForm F, long Id)
        {
            InitializeComponent();
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            //this.WindowState = FormWindowState.Maximized;
            back    = F;
            this.Id = Id;

            List <JobModel> joblist = job.List();

            foreach (var j in joblist)
            {
                JobBox.Items.Add(j.Name.ToString());
            }
            string[] Level = new string[] { "0. Регистратор", "1. Врач", "2. Медработник", "3. Администратор" };
            foreach (string lv in Level)
            {
                LevelBox.Items.Add(lv);
            }

            model = user.Get_Item("Id", Id.ToString(), Kpo.BL.Filter.ConditionType.Equal);

            NameText.Text          = model.Name;
            SurnameText.Text       = model.Surname;
            PatronymicText.Text    = model.Patronymic;
            LoginText.Text         = model.Login;
            PasswordText.Text      = model.Password;
            LevelBox.SelectedIndex = (int)model.Permition_Level;
            JobBox.SelectedItem    = job.Get_Item("Id", model.Job_Id.ToString(), ConditionType.Equal).Name;
        }
Ejemplo n.º 7
0
        private void adminButton_Click(object sender, EventArgs e)
        {
            AdminMainForm adminMainForm = new AdminMainForm();

            adminMainForm.WindowState = FormWindowState.Maximized;
            adminMainForm.ShowDialog();
        }
Ejemplo n.º 8
0
        private void BtnUpdateUser_Click(object sender, EventArgs e)
        {
            try
            {
                if (lblUser_ID.Text.Trim() == "" || txtuname.Text.Trim() == "" || txtpass.Text.Trim() == "" || txtuserType.Text.Trim() == "" ||
                    txtlname.Text.Trim() == "" || txtfname.Text.Trim() == "" || txtemail.Text.Trim() == "" || cmbstatus.Text == "" ||
                    cmbQuest.Text.Trim() == "" || txtans.Text.Trim() == "")
                {
                    MessageBox.Show("Please input fields to update user account!", "STOP", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                else
                {
                    AdminMainForm amf = new AdminMainForm();
                    db.sp_update_acc(int.Parse(lblUser_ID.Text), txtuname.Text, txtpass.Text, txtuserType.Text, txtfname.Text, txtlname.Text,
                                     txtemail.Text, cmbstatus.Text, cmbQuest.Text, txtans.Text, DateTime.Now);
                    lblUser_ID.Text        = "";
                    txtuname.Text          = "";
                    txtpass.Text           = "";
                    txtuserType.Text       = "";
                    txtfname.Text          = "";
                    txtlname.Text          = "";
                    txtemail.Text          = "";
                    amf.txtuserstatus.Text = "";
                    cmbQuest.Text          = "";
                    txtans.Text            = "";
                    MessageBox.Show("User successfully Updated!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    amf.dgvUsersAcc.DataSource = db.sp_view_acc();
                    this.Hide();
                }
            }
            catch (Exception ex)
            { MessageBox.Show(ex.Message); }
        }
Ejemplo n.º 9
0
 private void BtnAddProduct_Click(object sender, EventArgs e)
 {
     try
     {
         if (cmbProCategory.Text == "" || txtpro_code.Text == "" || txtpro_name.Text == "" || txtpro_price.Text == "" || txtpro_desc.Text == "")
         {
             MessageBox.Show("Please enter product information", "STOP", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
         else
         {
             if (cmbProCategory.Text == "Soap")
             {
                 catSoap++;
                 db.sp_add_products(int.Parse(lblUserID.Text), txtpro_code.Text, txtpro_name.Text, cmbProCategory.Text, int.Parse(txtpro_price.Text), txtpro_desc.Text, DateTime.Now);
                 txtpro_code.Text    = "";
                 txtpro_name.Text    = "";
                 cmbProCategory.Text = "";
                 txtpro_price.Text   = "";
                 txtpro_desc.Text    = "";
                 MessageBox.Show("Product successfully Added", "information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 AdminMainForm amf = new AdminMainForm();
                 amf.dgvProducts.DataSource = db.sp_view_products();
                 this.Hide();
             }
             else if (cmbProCategory.Text == "Dog Food")
             {
                 catDogFood++;
                 db.sp_add_products(int.Parse(lblUserID.Text), txtpro_code.Text, txtpro_name.Text, cmbProCategory.Text, int.Parse(txtpro_price.Text), txtpro_desc.Text, DateTime.Now);
                 txtpro_code.Text    = "";
                 txtpro_name.Text    = "";
                 cmbProCategory.Text = "";
                 txtpro_price.Text   = "";
                 txtpro_desc.Text    = "";
                 MessageBox.Show("Product successfully Added", "information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 AdminMainForm amf = new AdminMainForm();
                 amf.dgvProducts.DataSource = db.sp_view_products();
                 this.Hide();
             }
             else if (cmbProCategory.Text == "Herbal Medicine")
             {
                 catHerbal++;
                 db.sp_add_products(int.Parse(lblUserID.Text), txtpro_code.Text, txtpro_name.Text, cmbProCategory.Text, int.Parse(txtpro_price.Text), txtpro_desc.Text, DateTime.Now);
                 txtpro_code.Text    = "";
                 txtpro_name.Text    = "";
                 cmbProCategory.Text = "";
                 txtpro_price.Text   = "";
                 txtpro_desc.Text    = "";
                 MessageBox.Show("Product successfully Added", "information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 AdminMainForm amf = new AdminMainForm();
                 amf.dgvProducts.DataSource = db.sp_view_products();
                 this.Hide();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 10
0
 private void btnClickme_Click(object sender, EventArgs e)
 {
     MessageBox.Show("Dear teacher, I am sorry that I could not give you a decent job", "Apoligize", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     using (var frm = new AdminMainForm())
     {
         frm.ShowDialog();
     }
 }
Ejemplo n.º 11
0
        private void ShowAdminUIMainForm(ApplicationUser user)
        {
            AdminMainForm adminMainForm = new AdminMainForm(user);

            Hide();
            adminMainForm.FormClosed += (s, args) => HandleChildFormClosed(s, args);
            adminMainForm.Show();
        }
Ejemplo n.º 12
0
        private void CheckAdmin()
        {
            if (nameBox.Text == Admin.Name && passwordBox.Text == Admin.Password)
            {
                var adminApp = new AdminMainForm(Directory, Admin);
                this.Hide();
                adminApp.ShowDialog();

                this.Close();
            }
        }
Ejemplo n.º 13
0
        private void btnAuthenticate_Click(object sender, EventArgs e)
        {
            var model = new UserModel
            {
                Username = txtUsername.Text,
                Password = txtPassword.Text
            };

            var result = _accountController.Authenticate(model);

            if (!result.Success)
            {
                lblError.Text = (string)result.Data;
            }
            else
            {
                var user = (UserModel)result.Data;
                if (!user.IsAdmin && !user.IsActiveEO)
                {
                    MessageBox.Show($@"Contact the admin of the software to authorize your acccout",
                                    "Account Issue",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);

                    return;
                }

                if (user.IsAdmin)
                {
                    AdminMainForm adminMainForm = new AdminMainForm();
                    adminMainForm.Show();
                    Hide();
                }

                if (user.IsActiveEO)
                {
                    var eoMainForm = new EoMainForm();
                    eoMainForm.Show();
                    Hide();
                }
            }
        }
Ejemplo n.º 14
0
        /**************************************************************************************************/
        private void UsersReadyForParagraphEditor(HraListLoadedEventArgs e)
        {
            User u = (User)SessionManager.Instance.MetaData.Users
                     .FirstOrDefault(l => ((User)l).userLogin == userLogin);

            this.Hide();

            if (u != null)
            {
                SessionManager.Instance.ActiveUser = u;
                AdminMainForm amf = new AdminMainForm();
                amf.ShowDialog();
            }
            else
            {
                MessageBox.Show(
                    "User " + userLogin + " is not in the riskApps database.",
                    "Unable to login.");
            }

            this.Close();
        }
        private void SelectButton_Click(object sender, EventArgs e)
        {
            SelectAutodealer();

            if (_Selected)
            {
                this.Hide();

                GetCurrentUser();

                if (_CurrentUser.SuperUser)
                {
                    var AdminMainForm = new AdminMainForm();

                    AdminMainForm.Show();
                }
                else
                {
                    var UserMainForm = new UserMainForm();

                    UserMainForm.Show();
                }
            }
        }
Ejemplo n.º 16
0
 public AdminMainController(AdminMainForm adminMainForm)
 {
     this.adminMainForm = adminMainForm;
 }
Ejemplo n.º 17
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            if (txtUser.Text == "" || txtPass.Text == "")
            {
                MessageBox.Show("Please input details!", "STOP", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            else
            {
                int result;
                result = db.sp_login_acc(txtUser.Text, txtPass.Text).Count();
                dgvLogin.DataSource = db.sp_login_acc(txtUser.Text, txtPass.Text);
                if (result > 0)
                {
                    ClsLogin.User       = (from user in db.User_accs where txtUser.Text == user.user_uname && txtPass.Text == user.user_pass select user).First();
                    ClsLogin.userID     = dgvLogin.Rows[0].Cells[0].Value.ToString();
                    ClsLogin.username   = dgvLogin.Rows[0].Cells[1].Value.ToString();
                    ClsLogin.usertype   = dgvLogin.Rows[0].Cells[3].Value.ToString();
                    ClsLogin.Firstname  = dgvLogin.Rows[0].Cells[4].Value.ToString();
                    ClsLogin.userstatus = dgvLogin.Rows[0].Cells[7].Value.ToString();
                    if (ClsLogin.usertype == "Administrator")
                    {
                        if (ClsLogin.userstatus == "Active")
                        {
                            MessageBox.Show("Welcome Administrator", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            AdminMainForm amf = new AdminMainForm();
                            amf.pnlAdminMenu.Show();
                            amf.lblUserID.Text    = ClsLogin.usertype = dgvLogin.Rows[0].Cells[0].Value.ToString();
                            amf.lblUsertype.Text  = ClsLogin.usertype = dgvLogin.Rows[0].Cells[3].Value.ToString();
                            amf.lblFirstname.Text = ClsLogin.Firstname = dgvLogin.Rows[0].Cells[4].Value.ToString();
                            this.Hide();
                            amf.Show();
                        }
                        else
                        {
                            MessageBox.Show("Please ask the Administrator!", "STOP", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        }
                    }

                    else if (ClsLogin.userstatus == "Active")
                    {
                        MessageBox.Show("Welcome Staff", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        AdminMainForm amf = new AdminMainForm();
                        amf.pnlStaffMainMenu.Show();
                        amf.lblUserID.Text    = ClsLogin.usertype = dgvLogin.Rows[0].Cells[0].Value.ToString();
                        amf.lblUsertype.Text  = ClsLogin.usertype = dgvLogin.Rows[0].Cells[3].Value.ToString();
                        amf.lblFirstname.Text = ClsLogin.username = dgvLogin.Rows[0].Cells[4].Value.ToString();
                        this.Hide();
                        amf.Show();
                    }

                    else
                    {
                        MessageBox.Show("Please ask the Administrator!", "STOP", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    }
                }
                else
                {
                    MessageBox.Show("Incorrect Username or Password", "STOP", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
        }
Ejemplo n.º 18
0
 private void BtnAddProduct_Click(object sender, EventArgs e)
 {
     try
     {
         if (cmbProCategory.Text == "" || txtpro_code.Text == "" || txtpro_name.Text == "" || txtpro_price.Text == "" || txtpro_desc.Text == "")
         {
             MessageBox.Show("Please enter product information", "STOP", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
         else
         {
             if (cmbProCategory.Text == "Agricultural Products")
             {
                 catAgriculturalProducts++;
                 lblStockOut.Text = "0";
                 db.spAddProducts(txtpro_code.Text, txtpro_name.Text, cmbProCategory.Text, decimal.Parse(txtpro_price.Text), int.Parse(txtPro_Quantity.Text), int.Parse(txtQuanPerBox.Text), decimal.Parse(txtBox.Text), txtpro_desc.Text, int.Parse(lblUserID.Text), DateTime.Now);
                 db.spAddInventory(txtpro_code.Text, int.Parse(txtPro_Quantity.Text), int.Parse(txtPro_Quantity.Text), int.Parse(lblStockOut.Text), decimal.Parse(txtBox.Text), DateTime.Now);
                 txtpro_code.Text     = "";
                 txtpro_name.Text     = "";
                 cmbProCategory.Text  = "";
                 txtpro_price.Text    = "";
                 txtPro_Quantity.Text = "";
                 txtpro_desc.Text     = "";
                 MessageBox.Show("Product successfully Added", "information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 AdminMainForm amf = new AdminMainForm();
                 amf.dgvProducts.DataSource = db.spViewProducts();
                 this.Hide();
             }
             else if (cmbProCategory.Text == "Food Suppliments")
             {
                 catFoodSuppliments++;
                 lblStockOut.Text = "0";
                 db.spAddProducts(txtpro_code.Text, txtpro_name.Text, cmbProCategory.Text, decimal.Parse(txtpro_price.Text), int.Parse(txtPro_Quantity.Text), int.Parse(txtQuanPerBox.Text), decimal.Parse(txtBox.Text), txtpro_desc.Text, int.Parse(lblUserID.Text), DateTime.Now);
                 db.spAddInventory(txtpro_code.Text, int.Parse(txtPro_Quantity.Text), int.Parse(txtPro_Quantity.Text), int.Parse(lblStockOut.Text), decimal.Parse(txtBox.Text), DateTime.Now);
                 txtpro_code.Text     = "";
                 txtpro_name.Text     = "";
                 cmbProCategory.Text  = "";
                 txtpro_price.Text    = "";
                 txtPro_Quantity.Text = "";
                 txtpro_desc.Text     = "";
                 MessageBox.Show("Product successfully Added", "information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 AdminMainForm amf = new AdminMainForm();
                 amf.dgvProducts.DataSource = db.spViewProducts();
                 this.Hide();
             }
             else if (cmbProCategory.Text == "Cosmetics")
             {
                 catCosmetics++;
                 lblStockOut.Text = "0";
                 db.spAddProducts(txtpro_code.Text, txtpro_name.Text, cmbProCategory.Text, decimal.Parse(txtpro_price.Text), int.Parse(txtPro_Quantity.Text), int.Parse(txtQuanPerBox.Text), decimal.Parse(txtBox.Text), txtpro_desc.Text, int.Parse(lblUserID.Text), DateTime.Now);
                 db.spAddInventory(txtpro_code.Text, int.Parse(txtPro_Quantity.Text), int.Parse(txtPro_Quantity.Text), int.Parse(lblStockOut.Text), decimal.Parse(txtBox.Text), DateTime.Now);
                 txtpro_code.Text     = "";
                 txtpro_name.Text     = "";
                 cmbProCategory.Text  = "";
                 txtpro_price.Text    = "";
                 txtPro_Quantity.Text = "";
                 txtpro_desc.Text     = "";
                 MessageBox.Show("Product successfully Added", "information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 AdminMainForm amf = new AdminMainForm();
                 amf.dgvProducts.DataSource = db.spViewProducts();
                 this.Hide();
             }
             else if (cmbProCategory.Text == "Cape")
             {
                 catCape++;
                 lblStockOut.Text = "0";
                 db.spAddProducts(txtpro_code.Text, txtpro_name.Text, cmbProCategory.Text, decimal.Parse(txtpro_price.Text), int.Parse(txtPro_Quantity.Text), int.Parse(txtQuanPerBox.Text), decimal.Parse(txtBox.Text), txtpro_desc.Text, int.Parse(lblUserID.Text), DateTime.Now);
                 db.spAddInventory(txtpro_code.Text, int.Parse(txtPro_Quantity.Text), int.Parse(txtPro_Quantity.Text), int.Parse(lblStockOut.Text), decimal.Parse(txtBox.Text), DateTime.Now);
                 txtpro_code.Text     = "";
                 txtpro_name.Text     = "";
                 cmbProCategory.Text  = "";
                 txtpro_price.Text    = "";
                 txtPro_Quantity.Text = "";
                 txtpro_desc.Text     = "";
                 MessageBox.Show("Product successfully Added", "information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 AdminMainForm amf = new AdminMainForm();
                 amf.dgvProducts.DataSource = db.spViewProducts();
                 this.Hide();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }