internal int InsertBillCategory(HMS_BillCategory objBillCtg) { try { _context.HMS_BillCategory.AddObject(objBillCtg); _context.SaveChanges(); return(1); } catch (Exception ex) { throw ex; } }
internal int UpdateBillCategory(HMS_BillCategory objCtg, int catId) { try { HMS_BillCategory obj = _context.HMS_BillCategory.First(x => x.HMS_CategoryId == catId); obj.CategoryName = objCtg.CategoryName; obj.Edit_User = objCtg.Edit_User; obj.Edit_Date = objCtg.Edit_Date; _context.SaveChanges(); return(1); } catch (Exception ex) { throw ex; } }
internal int UpdateBillCategory(HMS_BillCategory objCtg, int catId) { return(objCategory_DAL.UpdateBillCategory(objCtg, catId)); }
internal int InsertBillCategory(HMS_BillCategory objBillCtg) { return(objCategory_DAL.InsertBillCategory(objBillCtg)); }
protected void btnBillCateGorySubmit_Click(object sender, EventArgs e) { try { if (txtCategory.Text == "") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input Bill Category !!')", true); } else { HMS_BillCategory objCatgory = new HMS_BillCategory(); objCatgory.OCODE = ((SessionUser)Session["SessionUser"]).OCode; objCatgory.CategoryName = txtCategory.Text; if (btnBillCateGorySubmit.Text == "Submit") { if (IsExist(objCatgory.CategoryName)) { objCatgory.Create_User = ((SessionUser)Session["SessionUser"]).UserId; objCatgory.Create_Date = DateTime.Now; int result = objCategory_BLL.InsertBillCategory(objCatgory); if (result == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Save successfully!')", true); } } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Already Exists!')", true); } } else { if (hidCategoryName.Value != txtCategory.Text) { if (IsExist(objCatgory.CategoryName)) { objCatgory.Edit_User = ((SessionUser)Session["SessionUser"]).UserId; objCatgory.Edit_Date = DateTime.Now; int catId = Convert.ToInt32(hidCategoryId.Value); int result = objCategory_BLL.UpdateBillCategory(objCatgory, catId); if (result == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update successfully!')", true); } } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Already Exists!')", true); } } else { objCatgory.Edit_User = ((SessionUser)Session["SessionUser"]).UserId; objCatgory.Edit_Date = DateTime.Now; int catId = Convert.ToInt32(hidCategoryId.Value); int result = objCategory_BLL.UpdateBillCategory(objCatgory, catId); if (result == 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update successfully!')", true); } } } GetBillCategory(); ClearBillCategoryUi(); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }