Пример #1
0
 private void bttnModify_Click(object sender, EventArgs e)
 {
     if (clsFunctions.recordExist("SELECT tblusers.usercode, tblusers.usertype FROM tblusers WHERE (tblusers.usertype=1 && tblusers.usercode='" + clsVariables.sUsercode + "') ORDER BY tblusers.autoid ASC", "tblusers") == true)
     {
         if (lvSupplier.Items.Count > 0)
         {
             try
             {
                 FormSupplier_Modify.ADD_STATE     = false;
                 FormSupplier_Modify.sSupplierKode = lvSupplier.Items[lvSupplier.FocusedItem.Index].SubItems[0].Text;
                 FormSupplier_Modify sForm = new FormSupplier_Modify();
                 sForm.ShowDialog();
             }
             catch (ArgumentOutOfRangeException aooreE) { MessageBox.Show("" + aooreE.Message); }
             catch (NullReferenceException nreE) { }
         }
         else
         {
             MessageBox.Show("No record to edit.", clsVariables.sMSGBOX, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     else
     {
         MessageBox.Show("Anda perlu hak akses administrator untuk menggunakan fitur ini!", clsVariables.sMSGBOX, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #2
0
        private void FormSupplier_Modify_Load(object sender, EventArgs e)
        {
            cmbStatus.Items.Add("ACTIVE");
            cmbStatus.Items.Add("INACTIVE");

            if (ADD_STATE == true)
            {
                txtSupplierCode.Text = "SUPP-" + clsFunctions.GenerateCD("SELECT MAX(autoid) FROM tblsupplier", "tblsupplier");

                cmdAddSupplier = new MySqlCommand("INSERT INTO tblsupplier( suppliercode , suppliername, discription, contactperson, bussinessno, email, address, status, dateadded)" +
                                                  "VALUES (@getSupplierCode,@getSupplierName,@getDiscription,@getContactPerson,@getBussinesNo,@getEmail,@getAddress,@getStatus,@getDateAdded)", clsConnection.CN);
                this.Text = "Add New";
            }
            else
            {
                txtSupplierCode.ReadOnly = true;

                //Set Edit OleDbCommand
                cmdAddSupplier = new MySqlCommand("UPDATE tblsupplier SET suppliercode=@getSupplierCode, suppliername=@getSupplierName, discription=@getDiscription, contactperson=@getContactPerson, bussinessno=@getBussinesNo, email=@getEmail, address=@getAddress, status=@getStatus, dateadded=@getDateAdded WHERE suppliercode LIKE '" + sSupplierKode + "' ", clsConnection.CN);
                FillFields();
                this.Text = "Edit Existing";
            }

            cmdAddSupplier.Parameters.Add("@getSupplierCode", MySqlDbType.VarChar);
            cmdAddSupplier.Parameters.Add("@getSupplierName", MySqlDbType.VarChar);
            cmdAddSupplier.Parameters.Add("@getDiscription", MySqlDbType.Text);
            cmdAddSupplier.Parameters.Add("@getContactPerson", MySqlDbType.VarChar);
            cmdAddSupplier.Parameters.Add("@getBussinesNo", MySqlDbType.VarChar);
            cmdAddSupplier.Parameters.Add("@getEmail", MySqlDbType.VarChar);
            cmdAddSupplier.Parameters.Add("@getAddress", MySqlDbType.VarChar);
            cmdAddSupplier.Parameters.Add("@getStatus", MySqlDbType.VarChar);
            cmdAddSupplier.Parameters.Add("@getDateAdded", MySqlDbType.Date);

            publcFormSupplier_Modify = this;
        }
Пример #3
0
 private void bttnAddNew_Click(object sender, EventArgs e)
 {
     if (clsFunctions.recordExist("SELECT tblusers.usercode, tblusers.usertype FROM tblusers WHERE (tblusers.usertype=1 && tblusers.usercode='" + clsVariables.sUsercode + "') ORDER BY tblusers.autoid ASC", "tblusers") == true)
     {
         FormSupplier_Modify.ADD_STATE = true;
         FormSupplier_Modify sForm = new FormSupplier_Modify();
         sForm.ShowDialog();
     }
     else
     {
         MessageBox.Show("Anda perlu hak akses administrator untuk menggunakan fitur ini!", clsVariables.sMSGBOX, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }