Exemplo n.º 1
0
 private void Updatecategory()
 {
     try
     {
         CONNECTION.open_connection();
         using (MySqlCommand da = new MySqlCommand("UPDATE category SET caegory_name=@caegory_name WHERE categry_id=@categry_id", CONNECTION.CON))
         {
             da.Parameters.Clear();
             da.Parameters.AddWithValue("@categry_id", lbl_category.Text);
             da.Parameters.AddWithValue("@caegory_name", txt_category_name.Text);
             if (da.ExecuteNonQuery() > 0)
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "CATEGORY UPDATED SUCCESFULLY!", MessageAlertImage.Success());
                 mdg.ShowDialog();
             }
             else
             {
                 MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "CATEGORY UPDATED SUCCESFULLY!", MessageAlertImage.Alert());
                 mdg.ShowDialog();
             }
         }
     }
     catch (Exception ex)
     {
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error());
         mdg.ShowDialog();
     }
     finally
     {
         CONNECTION.close_connection();
     }
 }
        private async Task ImportAsync()
        {
            string res = string.Empty;

            loadingCircle1.Visible = true;
            loadingCircle1.Size    = new Size(75, 75);
            loadingCircle1.Active  = true;
            btn_login.Enabled      = false;
            await Task.Run(() => {
                res = login();
            });

            loadingCircle1.Active  = false;
            loadingCircle1.Visible = false;
            loadingCircle1.Size    = new Size(1, 1);
            btn_login.Enabled      = true;
            if (res == "1")
            {
                UPDATE_LOGIN();
                DASHBOARD d = new DASHBOARD();
                d.Show();
                this.Hide();
            }
            else if (res == "0")
            {
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), "username or password invalied!", MessageAlertImage.Error());
                mdg.ShowDialog();
            }
            else
            {
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), login(), MessageAlertImage.Alert());
                mdg.ShowDialog();
            }
        }
Exemplo n.º 3
0
        //private async Task lOADgRIDVIEW()
        //{

        //    loadingCircle1.Visible = true;
        //    loadingCircle1.Size = new Size(75, 75);
        //    loadingCircle1.Active = true;
        //    await Task.Run(() => {
        //         LOADCATEGORYlIST();
        //    });
        //    loadingCircle1.Active = false;
        //    loadingCircle1.Visible = false;
        //    loadingCircle1.Size = new Size(1, 1);


        //}
        //private async Task SAVECATEGORY()
        //{

        //    loadingCircle1.Visible = true;
        //    loadingCircle1.Size = new Size(75, 75);
        //    loadingCircle1.Active = true;
        //    btn_save.Enabled = false;
        //    await Task.Run(() => {
        //        res = saveCategory();
        //    });
        //    loadingCircle1.Active = false;
        //    loadingCircle1.Visible = false;
        //    loadingCircle1.Size = new Size(1, 1);
        //    btn_save.Enabled = true;
        //    BTN_NEW.Focus();
        //    txt_category_name.Clear();
        //    if (res == "1")
        //    {
        //        lbl_category.Text = GETMAXID();
        //        MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "CATEGORY ADDED SUCCESFULLY!", MessageAlertImage.Warning());
        //        mdg.ShowDialog();
        //    }
        //    else if (res == "0")
        //    {
        //        MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "CATEGORY ADDED FAILED!", MessageAlertImage.Warning());
        //        mdg.ShowDialog();
        //    }
        //    else
        //    {
        //        MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), saveCategory(), MessageAlertImage.Alert());
        //        mdg.ShowDialog();
        //    }

        //}
        //private async Task UPDATE_CATEGORY_NAME()
        //{

        //    loadingCircle1.Visible = true;
        //    loadingCircle1.Size = new Size(75, 75);
        //    loadingCircle1.Active = true;
        //    btn_save.Enabled = false;
        //    await Task.Run(() => {
        //        res = updatecategory();
        //        // LOADCATEGORYlIST();
        //    });
        //    loadingCircle1.Active = false;
        //    loadingCircle1.Visible = false;
        //    loadingCircle1.Size = new Size(1, 1);
        //    btn_save.Enabled = true;
        //    BTN_NEW.Focus();
        //    txt_category_name.Clear();
        //    lbl_category.Text = "N/A";
        //    btn_save.Text = "SAVE";
        //    if (res == "1")
        //    {
        //        lbl_category.Text = GETMAXID();
        //        MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "CATEGORY UPDATED SUCCESFULLY!", MessageAlertImage.Warning());
        //        mdg.ShowDialog();
        //    }
        //    else if (res == "0")
        //    {
        //        MSGBOX mdg = new MSGBOX(MessageAlertHeder.Warning(), "CATEGORY UPDATED FAILED!", MessageAlertImage.Warning());
        //        mdg.ShowDialog();
        //    }
        //    else
        //    {
        //        MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), saveCategory(), MessageAlertImage.Alert());
        //        mdg.ShowDialog();
        //    }

        //}
        private void saveCategory()
        {
            try
            {
                CONNECTION.open_connection();
                using (MySqlCommand da = new MySqlCommand("INSERT INTO category(caegory_name) VALUES(@caegory_name)", CONNECTION.CON))
                {
                    da.Parameters.Clear();
                    da.Parameters.AddWithValue("@caegory_name", txt_category_name.Text);
                    if (da.ExecuteNonQuery() > 0)
                    {
                        lbl_category.Text = GETMAXID();
                        MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "CATEGORY ADDED SUCCESFULLY!", MessageAlertImage.Success());
                        mdg.ShowDialog();
                    }
                    else
                    {
                        MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "CATEGORY ADDED FAILED!", MessageAlertImage.Alert());
                        mdg.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MSGBOX mdg = new MSGBOX(MessageAlertHeder.Error(), ex.Message, MessageAlertImage.Error());
                mdg.ShowDialog();
            }
            finally
            {
                CONNECTION.close_connection();
            }
        }
 private async void shapedButton1_Click(object sender, EventArgs e)
 {
     if (txt_uname.Text.Length == 0)
     {
         pb_u_warning.Visible = true;
         txt_uname.Focus();
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Success(), "Please enter username", MessageAlertImage.Success());
         mdg.ShowDialog();
     }
     else if (txt_pass.Text.Length == 0)
     {
         pb_p_warning.Visible = true;
         txt_pass.Focus();
         MSGBOX mdg = new MSGBOX(MessageAlertHeder.Alert(), "Please enter password", MessageAlertImage.Alert());
         mdg.ShowDialog();
     }
     else
     {
         pb_u_warning.Visible = false;
         pb_u_warning.Visible = false;
         await ImportAsync();
     }
 }