protected void BtnEdit_Click(object sender, EventArgs e) { int lintCnt = 0; try { EntityOperationMaster entOpera = new EntityOperationMaster(); //entRoom.RoomId = Convert.ToInt32(txtRoomId.Text); entOpera.OperationId = Convert.ToInt32(Session["Opera_Id"]); entOpera.OperationName = txtCatOperation.Text; entOpera.OperationCategoryId = Convert.ToInt32(Session["Cat_Id"]); entOpera.Price = Convert.ToDecimal(txtPrice.Text); OpeartionMasterBLL objOtherAcc = new OpeartionMasterBLL(); lintCnt = objOtherAcc.Update(entOpera); if (lintCnt > 0) { GetOperationDetails(); lblMessage.Text = "Record Updated Successfully"; //this.programmaticModalPopup.Hide(); } else { lblMessage.Text = "Record Not Updated"; } MultiView1.SetActiveView(View1); } catch (Exception ex) { Commons.FileLog("frmDepartmentMaster - BtnEdit_Click(object sender, EventArgs e)", ex); } }
public int InsertOperationName(EntityOperationMaster entOpera) { try { tblOperationMaster obj = new tblOperationMaster() { OperationCategoryId = entOpera.OperationCategoryId, OperationName = entOpera.OperationName, Price = entOpera.Price }; objData.tblOperationMasters.InsertOnSubmit(obj); objData.SubmitChanges(); return(1); } catch (Exception ex) { throw ex; } }
public int Update(EntityOperationMaster entOpera) { try { tblOperationMaster test = (from tbl in objData.tblOperationMasters where tbl.IsDelete == false && tbl.OperationId == entOpera.OperationId select tbl).FirstOrDefault(); test.OperationId = entOpera.OperationId; test.OperationName = entOpera.OperationName; test.OperationCategoryId = entOpera.OperationCategoryId; test.Price = entOpera.Price; objData.SubmitChanges(); return(1); } catch (Exception ex) { throw ex; } }
protected void BtnSave_Click(object sender, EventArgs e) { int lintcnt = 0; EntityOperationMaster entOpera = new EntityOperationMaster(); if (Session["update"].ToString() == ViewState["update"].ToString()) { if (ddlCategoryName.SelectedIndex == 0) { lblMsg.Text = "Please Select Operation Category Name"; ddlCategoryName.Focus(); return; } else { if (string.IsNullOrEmpty(txtCatOperation.Text)) { lblMsg.Text = "Please Enter Description"; txtCatOperation.Focus(); return; } else { if (string.IsNullOrEmpty(txtPrice.Text)) { lblMsg.Text = "Please Enter Cost For Description"; txtPrice.Focus(); return; } else { entOpera.OperationCategoryId = Convert.ToInt32(Session["Cat_Id"]); entOpera.OperationName = txtCatOperation.Text; entOpera.Price = Convert.ToDecimal(txtPrice.Text); if (!mobjOperationMasterBLL.IsRecordExists(Convert.ToString(entOpera.OperationName))) { lintcnt = mobjOperationMasterBLL.InsertOperationName(entOpera); if (lintcnt > 0) { GetOperationDetails(); lblMessage.Text = "Record Inserted Successfully...."; //this.programmaticModalPopup.Hide(); //this.Load += new EventHandler(frmDepartmentMaster_Load); ////this.Response.Redirect("frmDepartmentMaster.aspx"); Session["update"] = Server.UrlEncode(System.DateTime.Now.ToString()); } else { lblMessage.Text = "Record Not Inserted..."; } } else { lblMessage.Text = "Record Already Exist...."; } Clear(); MultiView1.SetActiveView(View1); } } } } else { } }