public EntityInsuranceCom GetInsuranceById(int Id) { EntityInsuranceCom obj = null; try { obj = (from tbl in objData.tblInsuranceComMasters where tbl.PKId == Id select new EntityInsuranceCom { Address = tbl.Address, City = tbl.City, ContactEmail = tbl.ContactEmailID, ContactNo = tbl.ContactNo, ContactPerson = tbl.ContactPerson, ContactPhNo = tbl.ContactPhNo, Country = tbl.ContactPhNo, EmailID = tbl.EmailID, FaxNumber = tbl.FaxNumber, InsuranceCode = tbl.InsuranceCode, InsuranceDesc = tbl.InsuranceDesc, MobileNo = tbl.MobileNo, Notes = tbl.Notes, PostalCode = tbl.PostalCode, State = tbl.State }).FirstOrDefault(); } catch (Exception ex) { throw ex; } return(obj); }
public int UpdateInsurance(EntityInsuranceCom entInsurance) { int cnt = 0; try { List <SqlParameter> lstParam = new List <SqlParameter>(); Commons.ADDParameter(ref lstParam, "@InsuranceCode", DbType.String, entInsurance.InsuranceCode); Commons.ADDParameter(ref lstParam, "@InsuranceDesc", DbType.String, entInsurance.InsuranceDesc); Commons.ADDParameter(ref lstParam, "@Address", DbType.String, entInsurance.Address); Commons.ADDParameter(ref lstParam, "@Country", DbType.String, entInsurance.Country); Commons.ADDParameter(ref lstParam, "@State", DbType.String, entInsurance.State); Commons.ADDParameter(ref lstParam, "@City", DbType.String, entInsurance.City); Commons.ADDParameter(ref lstParam, "@EmailID", DbType.String, entInsurance.EmailID); Commons.ADDParameter(ref lstParam, "@ContactNo", DbType.String, entInsurance.ContactNo); Commons.ADDParameter(ref lstParam, "@PostalCode", DbType.String, entInsurance.PostalCode); Commons.ADDParameter(ref lstParam, "@ContactPerson", DbType.String, entInsurance.ContactPerson); Commons.ADDParameter(ref lstParam, "@ContactPhNo", DbType.String, entInsurance.ContactPhNo); Commons.ADDParameter(ref lstParam, "@MobileNo", DbType.String, entInsurance.MobileNo); Commons.ADDParameter(ref lstParam, "@ContactEmailID", DbType.String, entInsurance.ContactEmail); Commons.ADDParameter(ref lstParam, "@Notes", DbType.String, entInsurance.Notes); Commons.ADDParameter(ref lstParam, "@ChangeBy", DbType.String, entInsurance.ChangeBy); cnt = mobjDataAcces.ExecuteQuery("sp_UpdateInsurance", lstParam); } catch (Exception ex) { throw ex; } return(cnt); }
protected void btnUpdate_Click(object sender, EventArgs e) { try { ImageButton imgEdit = (ImageButton)sender; GridViewRow cnt = (GridViewRow)imgEdit.NamingContainer; int Id = Convert.ToInt32(dgvInsurance.DataKeys[cnt.RowIndex].Value); EntityInsuranceCom obj = mobjInsuranceBLL.GetInsuranceById(Id); if (obj != null) { txtAddress.Text = obj.Address; txtCity.Text = obj.City; txtCountry.Text = obj.Country; txtState.Text = obj.State; txtContactEmail.Text = obj.ContactEmail; txtContactMobNo.Text = obj.ContactNo; txtContactPerson.Text = obj.ContactPerson; txtContactPhNo.Text = obj.ContactPhNo; txtEmailID.Text = obj.EmailID; txtFaxNo.Text = obj.FaxNumber; txtInsuranceCode.Text = obj.InsuranceCode; txtInsuranceDesc.Text = obj.InsuranceDesc; txtNotes.Text = obj.Notes; txtPhNo.Text = obj.ContactPhNo; txtPostalCode.Text = obj.PostalCode; } BtnSave.Visible = false; btnUpdate.Visible = true; ViewData.SetActiveView(View2); } catch (Exception ex) { lblMessage.Text = ex.Message; } }
protected void BtnSave_Click(object sender, EventArgs e) { int lintcnt = 0; try { EntityInsuranceCom entInsurance = new EntityInsuranceCom(); if (string.IsNullOrEmpty(txtInsuranceCode.Text.Trim())) { lblMsg.Text = "Please Enter Insurance Code"; } else { if (string.IsNullOrEmpty(txtInsuranceDesc.Text.Trim())) { lblMsg.Text = "Please Enter Insurance Description"; } else { entInsurance.InsuranceCode = txtInsuranceCode.Text.Trim(); entInsurance.InsuranceDesc = txtInsuranceDesc.Text.Trim(); entInsurance.Address = txtAddress.Text.Trim(); entInsurance.Country = txtCountry.Text; entInsurance.State = txtState.Text; entInsurance.City = txtCity.Text; entInsurance.EmailID = txtEmailID.Text.Trim(); entInsurance.ContactNo = txtPhNo.Text.Trim(); entInsurance.PostalCode = txtPostalCode.Text.Trim(); entInsurance.FaxNumber = txtFaxNo.Text.Trim(); entInsurance.ContactPerson = txtContactPerson.Text.Trim(); entInsurance.ContactPhNo = txtContactPhNo.Text.Trim(); entInsurance.MobileNo = txtContactMobNo.Text.Trim(); entInsurance.ContactEmail = txtContactEmail.Text.Trim(); entInsurance.Notes = txtNotes.Text.Trim(); entInsurance.EntryBy = SessionWrapper.UserName; lintcnt = mobjInsuranceBLL.InsertInsurance(entInsurance); if (lintcnt > 0) { ClearAll(); GetInsurance(); ViewData.SetActiveView(View1); lblMessage.Text = "Record Inserted Successfully"; } else { lblMessage.Text = "Record Not Inserted"; } } } } catch (Exception ex) { lblMsg.Text = ex.Message; } }
public DataTable GetAllState(EntityInsuranceCom entInsurance) { DataTable ldt = new DataTable(); try { List <SqlParameter> lstParam = new List <SqlParameter>(); Commons.ADDParameter(ref lstParam, "@CountryId", DbType.Int32, entInsurance.Country); ldt = mobjDataAcces.GetDataTable("sp_GetStateForInsurance", lstParam); } catch (Exception ex) { throw ex; } return(ldt); }
public int DeleteInsurance(EntityInsuranceCom entInsurance) { int cnt = 0; try { List <SqlParameter> lstParam = new List <SqlParameter>(); Commons.ADDParameter(ref lstParam, "@InsuranceCode", DbType.String, entInsurance.InsuranceCode); cnt = mobjDataAcces.ExecuteQuery("sp_DeleteInsurance", lstParam); } catch (Exception ex) { Commons.FileLog("InsuranceComBLL - DeleteInsurance(EntityInsurance entInsurance)", ex); } return(cnt); }
protected void BtnEdit_Click(object sender, EventArgs e) { int lintCnt = 0; try { EntityInsuranceCom entInsurance = new EntityInsuranceCom(); entInsurance.InsuranceCode = txtInsuranceCode.Text; entInsurance.InsuranceDesc = txtInsuranceDesc.Text; entInsurance.Address = txtAddress.Text; entInsurance.Country = txtCountry.Text; entInsurance.State = txtState.Text; entInsurance.City = txtCity.Text; entInsurance.EmailID = txtEmailID.Text; entInsurance.ContactNo = txtPhNo.Text; entInsurance.PostalCode = txtPostalCode.Text; entInsurance.FaxNumber = txtFaxNo.Text; entInsurance.ContactPerson = txtContactPerson.Text; entInsurance.ContactPhNo = txtContactPhNo.Text; entInsurance.MobileNo = txtContactMobNo.Text; entInsurance.ContactEmail = txtContactEmail.Text; entInsurance.Notes = txtNotes.Text; entInsurance.ChangeBy = SessionWrapper.UserName; lintCnt = mobjInsuranceBLL.UpdateInsurance(entInsurance); if (lintCnt > 0) { GetInsurance(); lblMessage.Text = "Record Updated Successfully"; BtnClose_Click(sender, e); ViewData.SetActiveView(View1); } else { lblMessage.Text = "Record Not Updated"; } } catch (Exception ex) { lblMsg.Text = ex.Message; } }