Esempio n. 1
0
 private void lnkCategory_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     this.Hide();
     Items.Categories go = new Items.Categories();
     go.MdiParent = this.ParentForm;
     go.Show();
 }
Esempio n. 2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtCategoryName.Text == "")
         {
             MessageBox.Show("Please Fill  Category Name");
             txtCategoryName.Focus();
         }
         else
         {
             if (lblID.Text == "-")
             {
                 string sqlCmd = " insert into tbl_category (category_name)  values ('" + txtCategoryName.Text + "'  )";
                 DataAccess.ExecuteSQL(sqlCmd);
                 txtCategoryName.Text = "";
                 lblMsg.Visible       = true;
                 lblMsg.Text          = "Successfully saved";
             }
             else   //Update
             {
                 string sqlUpdateCmd = " update tbl_category set category_name = '" + txtCategoryName.Text + "'   where ID = '" + lblID.Text + "'";
                 DataAccess.ExecuteSQL(sqlUpdateCmd);
                 // lblMsg.Visible = true;
                 // lblMsg.Text = "Successfully Updated";
                 this.Hide();
                 Items.Categories mkc = new Items.Categories();
                 mkc.MdiParent = this.ParentForm;
                 mkc.Show();
             }
         }
     }
     catch (Exception exp)
     {
         MessageBox.Show("Sorry\r\n this id already added \n\n " + exp.Message);
     }
 }