public int SaveVisitRequest(VisitRequest _objVisitRequest, out int VisitReqId) { var noOfAffacted = 0; objDataAccess = DataAccess.NewDataAccess(); objDbCommand = objDataAccess.GetCommand(true, IsolationLevel.Serializable); objDbCommand.AddInOutParameter("VisitReqId", _objVisitRequest.VisitReqId, ParameterDirection.InputOutput, DbType.Int32, 16); objDbCommand.AddInParameter("LandlordId", _objVisitRequest.LandlordId); objDbCommand.AddInParameter("PropertyId", _objVisitRequest.PropertyId); objDbCommand.AddInParameter("ApartmentId", _objVisitRequest.ApartmentId); objDbCommand.AddInParameter("ClientName", _objVisitRequest.ClientName); objDbCommand.AddInParameter("ClientEmail", _objVisitRequest.ClientEmail); objDbCommand.AddInParameter("ClientMobileNo", _objVisitRequest.ClientMobileNo); objDbCommand.AddInParameter("MessageToLandlord", _objVisitRequest.MessageToLandlord); objDbCommand.AddInParameter("RequestDate", _objVisitRequest.RequestDate); try { noOfAffacted = objDataAccess.ExecuteNonQuery(objDbCommand, "ams.uspInsertVisitRequest", CommandType.StoredProcedure); VisitReqId = Convert.ToInt32(objDbCommand.Parameters["VisitReqId"].Value.ToString()); if (noOfAffacted > 0) { objDbCommand.Transaction.Commit(); return noOfAffacted; } else { objDbCommand.Transaction.Rollback(); return noOfAffacted; } } catch (Exception ex) { objDbCommand.Transaction.Rollback(); throw new Exception("Database Error Occured", ex); } finally { objDataAccess.Dispose(objDbCommand); } }
public int SaveApartmentInfo(Apartment objApartment) { var noOfAffacted = 0; int apartmentId; //string spName = ""; //if (referenceType==EnumBiz.ReferanceType.New.ToString()) //{ // spName = "AHL.prInsertApllicant"; //} objDataAccess = DataAccess.NewDataAccess(); objDbCommand = objDataAccess.GetCommand(true, IsolationLevel.Serializable); objDbCommand.AddInOutParameter("ApartmentId", objApartment.ApartmentId, ParameterDirection.InputOutput, DbType.Int32, 16); objDbCommand.AddInParameter("PropertyId", objApartment.PropertyId); objDbCommand.AddInParameter("ApartmentNoOrName", objApartment.ApartmentNoOrName); objDbCommand.AddInParameter("LandloadId", objApartment.LandloadId.Trim()); objDbCommand.AddInParameter("FloorNo", objApartment.FloorNo); objDbCommand.AddInParameter("ApartmentSpace", objApartment.ApartmentSpace); objDbCommand.AddInParameter("Beds", objApartment.Beds); objDbCommand.AddInParameter("AttachBatch", objApartment.AttachBatch); objDbCommand.AddInParameter("CommonBath", objApartment.CommonBath); objDbCommand.AddInParameter("DiningPosition", objApartment.DiningPosition); objDbCommand.AddInParameter("StaffRoom", objApartment.StaffRoom); objDbCommand.AddInParameter("StaffToilet", objApartment.StaffToilet); objDbCommand.AddInParameter("Balconies", objApartment.Balconies); objDbCommand.AddInParameter("FloorTypeId", objApartment.FloorTypeId); objDbCommand.AddInParameter("Rent", objApartment.Rent); objDbCommand.AddInParameter("Advance", objApartment.Advance); objDbCommand.AddInParameter("SecurityAmount", objApartment.SecurityAmount); objDbCommand.AddInParameter("ServiceCharge", objApartment.ServiceCharge); objDbCommand.AddInParameter("GasBill", objApartment.GasBill); objDbCommand.AddInParameter("CableTvBill", objApartment.CableTvBill); objDbCommand.AddInParameter("InternetBill", objApartment.InternetBill); objDbCommand.AddInParameter("Description", objApartment.Description); objDbCommand.AddInParameter("VacancyStatusId", objApartment.VacancyStatusId); try { noOfAffacted = objDataAccess.ExecuteNonQuery(objDbCommand, "ams.uspInsertApartmentDetailInfo", CommandType.StoredProcedure); // apartmentId = Convert.ToInt32(objDbCommand.Parameters["ApartmentId"].Value.ToString()); //noOfAffacted += PropertyFacilityTypeBiz.SaveFacilities(objDataAccess, objDbCommand, objApartment.PropertyFacilityTypeList, propertyId); //noOfAffacted += PropertySecurityTypeBiz.SaveSecurities(objDataAccess, objDbCommand, objApartment.PropertySecurityTypeList, propertyId); if (noOfAffacted > 0) { objDbCommand.Transaction.Commit(); return(noOfAffacted); } else { objDbCommand.Transaction.Rollback(); return(noOfAffacted); } } catch (Exception ex) { objDbCommand.Transaction.Rollback(); throw new Exception("Database Error Occured", ex); } finally { objDataAccess.Dispose(objDbCommand); } }
public int SavePropertyInfo(Property objProperty) { var noOfAffacted = 0; int propertyId; PropertyFacilityType objFacilityType; PropertySecurityType objSecurityType; //string spName = ""; //if (referenceType==EnumBiz.ReferanceType.New.ToString()) //{ // spName = "AHL.prInsertApllicant"; //} objDataAccess = DataAccess.NewDataAccess(); objDbCommand = objDataAccess.GetCommand(true, IsolationLevel.Serializable); objDbCommand.AddInOutParameter("PropertyId", objProperty.PropertyId, ParameterDirection.InputOutput, DbType.Int32, 16); objDbCommand.AddInParameter("PropertyName", objProperty.PropertyName.Trim()); objDbCommand.AddInParameter("PropertyTypeId", objProperty.PropertyTypeId); objDbCommand.AddInParameter("LandloadId", objProperty.LandloadId.Trim()); objDbCommand.AddInParameter("BuiltYear", objProperty.BuiltYear); objDbCommand.AddInParameter("CountryID", objProperty.CountryID); objDbCommand.AddInParameter("DivisionId", objProperty.DivisionId); objDbCommand.AddInParameter("DistrictId", objProperty.DistrictId); objDbCommand.AddInParameter("UpazilaId", objProperty.UpazilaId); objDbCommand.AddInParameter("HoldingNo", objProperty.HoldingNo); objDbCommand.AddInParameter("RoadNo", objProperty.RoadNo.Trim()); objDbCommand.AddInParameter("SectorOrBlock", objProperty.SectorOrBlock.Trim()); objDbCommand.AddInParameter("TotalSpace", objProperty.TotalSpace); objDbCommand.AddInParameter("NoOfFloors", objProperty.NoOfFloors); objDbCommand.AddInParameter("IsParkingAvailable", objProperty.IsParkingAvailable); if (objProperty.IsParkingAvailable) { objDbCommand.AddInParameter("TotalParkingSpace", objProperty.TotalParkingSpace); } try { noOfAffacted = objDataAccess.ExecuteNonQuery(objDbCommand, "ams.uspInsertPropertyDetailInfo", CommandType.StoredProcedure); propertyId = Convert.ToInt32(objDbCommand.Parameters["PropertyId"].Value.ToString()); noOfAffacted += PropertyFacilityTypeBiz.SaveFacilities(objDataAccess, objDbCommand, objProperty.PropertyFacilityTypeList, propertyId); noOfAffacted += PropertySecurityTypeBiz.SaveSecurities(objDataAccess, objDbCommand, objProperty.PropertySecurityTypeList, propertyId); if (noOfAffacted > 0) { objDbCommand.Transaction.Commit(); return(noOfAffacted); } else { objDbCommand.Transaction.Rollback(); return(noOfAffacted); } } catch (Exception ex) { objDbCommand.Transaction.Rollback(); throw new Exception("Database Error Occured", ex); } finally { objDataAccess.Dispose(objDbCommand); } }