protected void BtnDelete_Click(object sender, EventArgs e) { try { int DeleteId = 0; if (ViewState["EditID"] != null) { DeleteId = Convert.ToInt32(ViewState["EditID"]); } if (DeleteId != 0) { Entity_PM.PartyId = DeleteId; Entity_PM.UserId = Convert.ToInt32(Session["UserId"]); Entity_PM.LoginDate = DateTime.Now; int iDelete = Obj_PM.DeletePartyMaster(ref Entity_PM, out StrError); if (iDelete != 0) { Obj_Comm.ShowPopUpMsg("Record Deleted Successfully..!", this.Page); MakeEmptyForm(); } } Entity_PM = null; Obj_Comm = null; } catch (Exception ex) { throw new Exception(ex.Message); } }
protected void BtnUpdate_Click(object sender, EventArgs e) { int UpdateRow = 0; try { if (Check() == true) { if (ViewState["EditID"] != null) { Entity_PM.PartyId = Convert.ToInt32(ViewState["EditID"]); } Entity_PM.PartyName = TxtPartyName.Text.Trim(); Entity_PM.PartyAddress = TxtAddress.Text.Trim(); Entity_PM.PEmailId = TxtEmail.Text.Trim(); Entity_PM.PTelNo = TxtPhoneNo.Text.Trim(); Entity_PM.PmobileNo = txtMobileNo.Text.Trim(); Entity_PM.PWebsite = TxtWebsite.Text.Trim(); Entity_PM.ContPerName = txtContPerName.Text.Trim(); Entity_PM.ContPerAddress = txtContPerAddress.Text.Trim(); Entity_PM.CEmailId = txtContPerEId.Text.Trim(); Entity_PM.CMobileNo = txtContPerMobNo.Text.Trim(); Entity_PM.CAdharCardNo = TxtAdharNo.Text.Trim(); Entity_PM.CTelNo = txtContPerTelNo.Text.Trim(); Entity_PM.PANNO = TxtPANNo.Text.Trim(); Entity_PM.GSTNo = TxtGSTINNo.Text.Trim(); Entity_PM.Note = TxtNoteC.Text.Trim(); Entity_PM.UserId = Convert.ToInt32(Session["UserId"]); Entity_PM.LoginDate = DateTime.Now; UpdateRow = Obj_PM.UpdatePartyMaster(ref Entity_PM, out StrError); if (UpdateRow != 0) { Obj_Comm.ShowPopUpMsg("Record Updated Successfully", this.Page); MakeEmptyForm(); Entity_PM = null; Obj_Comm = null; } } } catch (Exception ex) { throw new Exception(ex.Message); } }
public int DeletePartyMaster(ref PropertyPartyMaster Entity_PM, out string StrError) { int iDelete = 0; StrError = string.Empty; try { SqlParameter pAction = new SqlParameter(PropertyPartyMaster._Action, SqlDbType.BigInt); SqlParameter pPartyId = new SqlParameter(PropertyPartyMaster._PartyId, SqlDbType.BigInt); SqlParameter pDeletedBy = new SqlParameter(PropertyPartyMaster._UserId, SqlDbType.BigInt); SqlParameter pDeletedDate = new SqlParameter(PropertyPartyMaster._LoginDate, SqlDbType.DateTime); pAction.Value = 3; pPartyId.Value = Entity_PM.PartyId; pDeletedBy.Value = Entity_PM.UserId; pDeletedDate.Value = Entity_PM.LoginDate; // pIsDeleted.Value = Entity_Country.IsDeleted; SqlParameter[] param = new SqlParameter[] { pAction, pPartyId, pDeletedBy, pDeletedDate }; Open(CONNECTION_STRING); BeginTransaction(); iDelete = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, PropertyPartyMaster.SP_PartyMaster, param); if (iDelete > 0) { CommitTransaction(); } else { RollBackTransaction(); } } catch (Exception ex) { RollBackTransaction(); StrError = ex.Message; } finally { Close(); } return(iDelete); }
public int UpdatePartyMaster(ref PropertyPartyMaster Entity_PM, out string StrError) { int iInsert = 0; StrError = string.Empty; try { SqlParameter pAction = new SqlParameter(PropertyPartyMaster._Action, SqlDbType.BigInt); SqlParameter pPartyId = new SqlParameter(PropertyPartyMaster._PartyId, SqlDbType.BigInt); SqlParameter pPartyName = new SqlParameter(PropertyPartyMaster._PartyName, SqlDbType.NVarChar); SqlParameter pPartyAddress = new SqlParameter(PropertyPartyMaster._PartyAddress, SqlDbType.NVarChar); SqlParameter pPEmailId = new SqlParameter(PropertyPartyMaster._PEmailId, SqlDbType.NVarChar); SqlParameter pPmobileNo = new SqlParameter(PropertyPartyMaster._PmobileNo, SqlDbType.NVarChar); SqlParameter pPTelNo = new SqlParameter(PropertyPartyMaster._PTelNo, SqlDbType.NVarChar); SqlParameter pPWebsite = new SqlParameter(PropertyPartyMaster._PWebsite, SqlDbType.NVarChar); SqlParameter pContPerName = new SqlParameter(PropertyPartyMaster._ContPerName, SqlDbType.NVarChar); SqlParameter pContPerAddress = new SqlParameter(PropertyPartyMaster._ContPerAddress, SqlDbType.NVarChar); SqlParameter pCEmailId = new SqlParameter(PropertyPartyMaster._CEmailId, SqlDbType.NVarChar); SqlParameter pCMobileNo = new SqlParameter(PropertyPartyMaster._CMobileNo, SqlDbType.NVarChar); SqlParameter pCTelNo = new SqlParameter(PropertyPartyMaster._CTelNo, SqlDbType.NVarChar); SqlParameter pGSTNo = new SqlParameter(PropertyPartyMaster._GSTNo, SqlDbType.NVarChar); SqlParameter pCAdharCardNo = new SqlParameter(PropertyPartyMaster._CAdharCardNo, SqlDbType.NVarChar); SqlParameter pPANNO = new SqlParameter(PropertyPartyMaster._PANNO, SqlDbType.NVarChar); SqlParameter pNote = new SqlParameter(PropertyPartyMaster._Note, SqlDbType.NVarChar); SqlParameter pCreatedBy = new SqlParameter(PropertyPartyMaster._UserId, SqlDbType.BigInt); SqlParameter pCreatedDate = new SqlParameter(PropertyPartyMaster._LoginDate, SqlDbType.DateTime); pAction.Value = 2; pPartyId.Value = Entity_PM.PartyId; pPartyName.Value = Entity_PM.PartyName; pPartyAddress.Value = Entity_PM.PartyAddress; pPEmailId.Value = Entity_PM.PEmailId; pPmobileNo.Value = Entity_PM.PmobileNo; pPTelNo.Value = Entity_PM.PTelNo; pPWebsite.Value = Entity_PM.PWebsite; pContPerName.Value = Entity_PM.ContPerName; pContPerAddress.Value = Entity_PM.ContPerAddress; pCEmailId.Value = Entity_PM.CEmailId; pCMobileNo.Value = Entity_PM.CMobileNo; pCTelNo.Value = Entity_PM.CTelNo; pGSTNo.Value = Entity_PM.GSTNo; pCAdharCardNo.Value = Entity_PM.CAdharCardNo; pPANNO.Value = Entity_PM.PANNO; pNote.Value = Entity_PM.Note; pCreatedBy.Value = Entity_PM.UserId; pCreatedDate.Value = Entity_PM.LoginDate; SqlParameter[] param = new SqlParameter[] { pAction, pPartyId, pPartyName, pPartyAddress, pPEmailId, pPmobileNo, pPTelNo, pPWebsite, pContPerName, pContPerAddress, pCEmailId, pCMobileNo, pCTelNo, pGSTNo, pCAdharCardNo, pPANNO, pNote, pCreatedBy, pCreatedDate }; Open(CONNECTION_STRING); BeginTransaction(); iInsert = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, PropertyPartyMaster.SP_PartyMaster, param); if (iInsert > 0) { CommitTransaction(); } else { RollBackTransaction(); } } catch (Exception ex) { RollBackTransaction(); StrError = ex.Message; } finally { Close(); } return(iInsert); }