public int AddAdPost(AdPostDetails adpostDetails) { try { DALComponent objDAL = new DALComponent(); objDAL.SetParameters("@adpostId", SqlDbType.Int, 4, adpostDetails.AdPostId); objDAL.SetParameters("@adpostTitle", SqlDbType.VarChar, 500, adpostDetails.AdPostTitle); objDAL.SetParameters("@description", SqlDbType.VarChar, 1000, adpostDetails.Description); objDAL.SetParameters("@keywords", SqlDbType.VarChar, 1000, adpostDetails.Keywords); objDAL.SetParameters("@userId", SqlDbType.Int, 4, adpostDetails.UserId); objDAL.SetParameters("@categoryId", SqlDbType.Int, 4, adpostDetails.CategoryId); objDAL.SetParameters("@price", SqlDbType.Decimal, 9, Convert.ToDecimal(adpostDetails.Price)); objDAL.SetParameters("@stateId", SqlDbType.Int, 4, adpostDetails.StateId); objDAL.SetParameters("@cityId", SqlDbType.Int, 4, adpostDetails.CityId); objDAL.SetParameters("@countryId", SqlDbType.Int, 4, adpostDetails.CountryId); objDAL.SetParameters("@zipCode", SqlDbType.VarChar, 50, adpostDetails.ZipCode); objDAL.SetParameters("@adtillDate", SqlDbType.SmallDateTime, 4, adpostDetails.AdTillDate); objDAL.SetParameters("@adStatus", SqlDbType.VarChar, 50, adpostDetails.AdStatus); objDAL.SetParameters("@paidStatus", SqlDbType.Int, 4, adpostDetails.PaidStatus); objDAL.SetParameters("@idvalue", SqlDbType.Int, true); objDAL.SqlCommandText = "CreateAdPost"; int x = objDAL.CreateRecord(); object y = objDAL.GetParameters("@idvalue"); if (adpostDetails.AdPostId != 0) return adpostDetails.AdPostId; else return Int32.Parse(y.ToString()); } catch (SqlException sqlEx) { throw new ApplicationException("Data error=" + sqlEx.Message.ToString()); } catch (Exception ex) { throw new ApplicationException("Error=" + ex.Message.ToString()); } }
public DataTable GetAdImageDetails(AdPostDetails adpostDetails) { try { objDALComponent.SetParameters("@adpostId", SqlDbType.Int, 4, adpostDetails.AdPostId); objDALComponent.SetParameters("@userId", SqlDbType.Int, 4, adpostDetails.UserId); objDALComponent.SqlCommandText = "[GetAdImageDetails]"; return objDALComponent.SelectRecord(); } catch (SqlException sqlEx) { throw new ApplicationException("Data error=" + sqlEx.Message.ToString()); } catch (Exception ex) { throw new ApplicationException("Error=" + ex.Message.ToString()); } }
public void UpdateAdDeleteStatus(AdPostDetails adpostDetails) { try { objDALComponent.SetParameters("@adpostid", SqlDbType.Int, 4, adpostDetails.AdPostId); objDALComponent.SetParameters("@delvalue", SqlDbType.Int, 4, adpostDetails.AdDeleted); objDALComponent.SqlCommandText = "UpdateAdDeleteStatus"; int x = objDALComponent.DeleteRecord(); } catch (SqlException sqlEx) { throw new ApplicationException("Data error=" + sqlEx.Message.ToString()); } catch (Exception ex) { throw new ApplicationException("Error=" + ex.Message.ToString()); } }