private void bntSave_Click(object sender, EventArgs e) { try { BO.ProductCategory ObjProductCategory = new BO.ProductCategory(); ObjProductCategory.Name = txtCategoryName.Text; ObjProductCategory.Description = txtDescription.Text; if (bntSave.Text == "Update" && txtCategoryName.Text != "") { ObjProductCategory.Id = ID; if (_IProductCategory.Update(ObjProductCategory) > 0) { MessageBox.Show("Successfully Update"); Reset(); } } else if (ObjProductCategory.Name != "") { if (_IProductCategory.Insert(ObjProductCategory) > 0) { MessageBox.Show("Operation Success"); Reset(); } else { lblMessageBox.Text = "Operation Failed"; lblMessageBox.ForeColor = System.Drawing.Color.Red; } } else { MsgBox msgbox = new MsgBox(); msgbox.Show(); txtCategoryName.Focus(); lblMessageBox.ForeColor = System.Drawing.Color.Red; } } catch (Exception ex) { throw ex; } }
public IList <BO.ProductCategory> GetProductCategoryList() { try { SqlConnection con = CreateCon(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand(); da.SelectCommand.CommandText = "[POS_SP_GET_SET_ProductCategory]"; da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Connection = con; if (con.State == ConnectionState.Closed) { con.Open(); } DataSet ds = new DataSet(); da.Fill(ds); if (con.State == ConnectionState.Open) { con.Close(); } DataTable dt = ds.Tables[0]; List <BO.ProductCategory> objDoctorList = new List <POS.BO.ProductCategory>(); int index = 1; POS.BO.ProductCategory obj = null; foreach (DataRow row in dt.Rows) { obj = new BO.ProductCategory(); obj.Sln = index++; obj.Id = Convert.ToInt32(row["ProductCategoryID"]); obj.Name = row["CategoryName"].ToString(); obj.Description = row["Description"].ToString(); objDoctorList.Add(obj); } return(objDoctorList); } catch (Exception) { throw; } }
public int Update(BO.ProductCategory objProductCategory, int Id) { try { int returnStatus = 0; SqlConnection con = CreateCon(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand(); da.SelectCommand.CommandText = "[POS_SP_Update_SET_ProductCategory]"; da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Connection = con; da.SelectCommand.Parameters.Add("@CategoryName", SqlDbType.VarChar, 100).Value = objProductCategory.Name; da.SelectCommand.Parameters.Add("@Description", SqlDbType.VarChar, 200).Value = objProductCategory.Description; if (con.State == ConnectionState.Closed) { con.Open(); } if (da.SelectCommand.ExecuteNonQuery() == 1) { returnStatus = 1; } else { returnStatus = 0; } if (con.State == ConnectionState.Open) { con.Close(); } return(returnStatus); } catch (Exception ex) { throw ex; } }
public IList <BO.ProductCategory> GetProductCategoryByObject(BO.ProductCategory objProductCategory, int pageIndex, int pageSize, string orderBy, string sortindex) { return(_iProductCategory.GetProductCategoryByObject(objProductCategory, pageIndex, pageSize, orderBy, sortindex)); }
public int Update(BO.ProductCategory objProductCategory, int Id) { return(_iProductCategory.Update(objProductCategory, Id)); }
public int Insert(BO.ProductCategory objProductCategory) { return(_iProductCategory.Insert(objProductCategory)); }
public IList <BO.ProductCategory> GetProductCategoryByObject(BO.ProductCategory objProductCategory, int pageIndex, int pageSize, string orderBy, string sortindex) { return(new List <POS.BO.ProductCategory>()); }