public void UpdateSupplierHotelPrice(SupplierHotelPriceInfo supplierHotelPrice)
        {
            _sqlHelper.ExecuteNonQuery(SetValuesInSupplierHotelPriceInfo(supplierHotelPrice), Storeprocedures.spUpdateSupplierHotelPrice.ToString(), CommandType.StoredProcedure);

            DeleteSupplierHotelPriceCharges(supplierHotelPrice.SupplierHotelPriceId);

            InsertSupplierHotelPriceCharges(supplierHotelPrice);
        }
        public SupplierHotelTariffViewModel()
        {
            SupplierHotelTariff = new SupplierHotelTariffInfo();

            SupplierHotelDetail = new SupplierHotelDetailInfo();

            SupplierOccupancyDetail = new SupplierOccupancyDetailInfo();

            SupplierHotelCustomerCategory = new SupplierHotelCustomerCategoryInfo();

            SupplierHotelCustomerCategories = new List <SupplierHotelCustomerCategoryInfo>();

            LstVendor = new List <VendorInfo>();

            LstCities = new List <CityInfo>();

            LstRoomTypes = new List <RoomTypeInfo>();

            LstMeals = new List <MealInfo>();

            LstHotel = new List <HotelInfo>();

            FriendlyMessage = new List <FriendlyMessage>();

            SupplierHotelTariffDuration = new SupplierHotelTariffDurationInfo();

            SupplierHotelTariffDurations = new List <SupplierHotelTariffDurationInfo>();

            LstStandardCharges = new List <ChargesInfo>();

            LstSupplierHotelPriceDetail = new List <SupplierHotelPriceDetailInfo>();

            LstSupplierHotelPrice = new List <SupplierHotelPriceInfo>();

            CustomerCategories = new List <CustomerCategoryInfo>();

            LstStandardCharges = new List <ChargesInfo>();

            LstTaxFormula = new List <TaxFormulaInfo>();

            LstTaxFormulaCharges = new List <TaxFormulaChargesInfo>();

            SupplierHotelPrice = new SupplierHotelPriceInfo();

            Pager = new PaginationInfo();

            Cities = new List <CityInfo>();

            SupplierHotelTariffDayInfo = new SupplierHotelTariffDayInfo();

            SupplierHotelTariffDays = new List <SupplierHotelTariffDayInfo>();

            SupplierHotelDayItem = new SupplierHotelDayItemInfo();

            SupplierHotelDayItems = new List <SupplierHotelDayItemInfo>();
        }
        public void InsertSupplierHotelPriceCharges(SupplierHotelPriceInfo supplierHotelPrices)
        {
            foreach (var item in supplierHotelPrices.SupplierHotelPriceDetails)
            {
                List <SqlParameter> sqlParam = new List <SqlParameter>();


                sqlParam.Add(new SqlParameter("@SupplierHotelPriceId", supplierHotelPrices.SupplierHotelPriceId));

                sqlParam.Add(new SqlParameter("@ChargesId", item.ChargesId));

                sqlParam.Add(new SqlParameter("@Percentage", item.Percentage));

                sqlParam.Add(new SqlParameter("@CalculatedPrice", item.CalculatedPrice));

                _sqlHelper.ExecuteNonQuery(sqlParam, Storeprocedures.spInsertSupplierHotelChargeDetail.ToString(), CommandType.StoredProcedure);
            }
        }
        public SupplierHotelPriceInfo GetSupplierHotelPriceById(int supplierHotelPriceId)
        {
            List <SqlParameter> sqlParam = new List <SqlParameter>();

            SupplierHotelPriceInfo supplierHotelPrice = new SupplierHotelPriceInfo();

            sqlParam.Add(new SqlParameter("@SupplierHotelPriceId", supplierHotelPriceId));

            DataTable dt = _sqlHelper.ExecuteDataTable(sqlParam, Storeprocedures.spGetSupplierHotelPriceById.ToString(), CommandType.StoredProcedure);

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    supplierHotelPrice = GetPriceValues(dr);
                }
            }
            return(supplierHotelPrice);
        }
        public List <SqlParameter> SetValuesInSupplierHotelPriceInfo(SupplierHotelPriceInfo supplierHotelPriceInfo)
        {
            List <SqlParameter> sqlParam = new List <SqlParameter>();

            if (supplierHotelPriceInfo.SupplierHotelPriceId != 0)
            {
                sqlParam.Add(new SqlParameter("@SupplierHotelPriceId", supplierHotelPriceInfo.SupplierHotelPriceId));
            }
            else
            {
                sqlParam.Add(new SqlParameter("@CreatedDate", DateTime.Now));

                sqlParam.Add(new SqlParameter("@CreatedBy", 1));
            }

            sqlParam.Add(new SqlParameter("@OccupancyDetailId", supplierHotelPriceInfo.OccupancyDetailId));

            sqlParam.Add(new SqlParameter("@PublishPrice", supplierHotelPriceInfo.PublishPrice));

            sqlParam.Add(new SqlParameter("@SpecialPrice", supplierHotelPriceInfo.SpecialPrice));

            sqlParam.Add(new SqlParameter("@CommissionPrice", supplierHotelPriceInfo.CommissionPrice));

            sqlParam.Add(new SqlParameter("@FormulaId", supplierHotelPriceInfo.FormulaId));

            sqlParam.Add(new SqlParameter("@TotalTaxPrice", supplierHotelPriceInfo.TotalTaxPrice));

            sqlParam.Add(new SqlParameter("@NetRate", supplierHotelPriceInfo.NetRate));

            sqlParam.Add(new SqlParameter("@IsChildPrice", supplierHotelPriceInfo.IsChildPrice));

            sqlParam.Add(new SqlParameter("@AgeFrom", supplierHotelPriceInfo.AgeFrom));

            sqlParam.Add(new SqlParameter("@AgeTo", supplierHotelPriceInfo.AgeTo));

            sqlParam.Add(new SqlParameter("@Color", supplierHotelPriceInfo.Color));

            sqlParam.Add(new SqlParameter("@UpdatedDate", DateTime.Now));

            sqlParam.Add(new SqlParameter("@UpdatedBy", 1));

            return(sqlParam);
        }
        private SupplierHotelPriceInfo GetPriceValues(DataRow dr)
        {
            SupplierHotelPriceInfo supplierhotelprice = new SupplierHotelPriceInfo();

            if (DBNull.Value != dr["SupplierHotelPriceId"])
            {
                supplierhotelprice.SupplierHotelPriceId = Convert.ToInt32(dr["SupplierHotelPriceId"]);
            }

            if (DBNull.Value != dr["OccupancyDetailId"])
            {
                supplierhotelprice.OccupancyDetailId = Convert.ToInt32(dr["OccupancyDetailId"]);
            }

            if (DBNull.Value != dr["PublishPrice"])
            {
                supplierhotelprice.PublishPrice = Convert.ToDecimal(dr["PublishPrice"]);
            }

            if (DBNull.Value != dr["SpecialPrice"])
            {
                supplierhotelprice.SpecialPrice = Convert.ToDecimal(dr["SpecialPrice"]);
            }

            if (DBNull.Value != dr["CommissionPrice"])
            {
                supplierhotelprice.CommissionPrice = Convert.ToDecimal(dr["CommissionPrice"]);
            }

            if (DBNull.Value != dr["FormulaId"])
            {
                supplierhotelprice.FormulaId = Convert.ToInt32(dr["FormulaId"]);
            }

            if (DBNull.Value != dr["TotalTaxPrice"])
            {
                supplierhotelprice.TotalTaxPrice = Convert.ToDecimal(dr["TotalTaxPrice"]);
            }

            if (DBNull.Value != dr["NetRate"])
            {
                supplierhotelprice.NetRate = Convert.ToDecimal(dr["NetRate"]);
            }

            if (DBNull.Value != dr["IsChildPrice"])
            {
                supplierhotelprice.IsChildPrice = Convert.ToBoolean(dr["IsChildPrice"]);
            }

            if (DBNull.Value != dr["AgeFrom"])
            {
                supplierhotelprice.AgeFrom = Convert.ToInt32(dr["AgeFrom"]);
            }

            if (DBNull.Value != dr["AgeTo"])
            {
                supplierhotelprice.AgeTo = Convert.ToInt32(dr["AgeTo"]);
            }

            supplierhotelprice.Color = Convert.ToString(dr["Color"]);

            supplierhotelprice.CreatedDate = Convert.ToDateTime(dr["CreatedDate"]);

            supplierhotelprice.CreatedBy = Convert.ToInt32(dr["CreatedBy"]);

            supplierhotelprice.UpdatedDate = Convert.ToDateTime(dr["UpdatedDate"]);

            supplierhotelprice.UpdatedBy = Convert.ToInt32(dr["UpdatedBy"]);

            return(supplierhotelprice);
        }
        public void InsertSupplierHotelPrice(SupplierHotelPriceInfo supplierHotelPrice)
        {
            supplierHotelPrice.SupplierHotelPriceId = Convert.ToInt32(_sqlHelper.ExecuteScalerObj(SetValuesInSupplierHotelPriceInfo(supplierHotelPrice), Storeprocedures.spInsertSupplierHotelPrice.ToString(), CommandType.StoredProcedure));

            InsertSupplierHotelPriceCharges(supplierHotelPrice);
        }