Beispiel #1
0
        public ActionResult AddUpdate(etblPropertyRoomInventory eObj)
        {
            object result = null;

            try
            {
                if (ModelState.IsValid)
                {
                    eObj.iPropId      = Convert.ToInt32(Session["PropId"]);
                    eObj.iActionBy    = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId;
                    eObj.dtActionDate = DateTime.Now;
                    string s = BL_bulk.SaveInventory(((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId, Convert.ToInt32(Session["PropId"]), eObj.dtInventoryDate.ToString("MM/dd/yyyy").Replace("-", "/"), eObj.iRoomId.ToString(), "", eObj.iAvailableInventory.ToString(), eObj.bStopSell ? "On" : "Off", eObj.iCutOff.ToString(), "", "", "", "", "", "", "", "", "", "");
                    if (s == "a")
                    {
                        result = new { st = 1, msg = "Updated successfully." };
                    }
                    else
                    {
                        result = new { st = 0, msg = "Kindly try after some time." };
                    }
                }
                else
                {
                    result = new { st = 0, msg = "Kindly try after some time." };
                }
            }
            catch (Exception)
            {
                result = new { st = 0, msg = "Kindly try after some time." };
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public string SaveInventory(edata obj)
        {
            //string dates = "", roomid = "", plan = "", Inv = "", StopSell = "", CutOff = "", CloseOut = "", Min = "", Max = "", CTA = "", CTD = "", single = "", doble = "", triple = "", quad = "", quin = "";
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                strReturn = BL_bulk.SaveInventory(((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId, Convert.ToInt32(Session["PropId"]), string.IsNullOrEmpty(obj.dates) ? "" : obj.dates, string.IsNullOrEmpty(obj.roomid) ? "" : obj.roomid, string.IsNullOrEmpty(obj.plan) ? "" : obj.plan, string.IsNullOrEmpty(obj.Inv) ? "" : obj.Inv, string.IsNullOrEmpty(obj.StopSell) ? "" : obj.StopSell, string.IsNullOrEmpty(obj.CutOff) ? "" : obj.CutOff, string.IsNullOrEmpty(obj.CloseOut) ? "" : obj.CloseOut, string.IsNullOrEmpty(obj.Min) ? "" : obj.Min, string.IsNullOrEmpty(obj.Max) ? "" : obj.Max, string.IsNullOrEmpty(obj.CTA) ? "" : obj.CTA, string.IsNullOrEmpty(obj.CTD) ? "" : obj.CTD, string.IsNullOrEmpty(obj.single) ? "" : obj.single, string.IsNullOrEmpty(obj.doble) ? "" : obj.doble, string.IsNullOrEmpty(obj.triple) ? "" : obj.triple, string.IsNullOrEmpty(obj.quad) ? "" : obj.quad, string.IsNullOrEmpty(obj.quin) ? "" : obj.quin);
                if (strReturn == "a")
                {
                    result = new { st = 1, msg = strReturn };
                }
                else
                {
                    result = new { st = 2, msg = strReturn };
                }
            }
            catch (Exception ex)
            {
                OneFineRateAppUtil.clsUtils.SendErrorMail(ex);
                result = new { st = 0, msg = "Kindly try after some time." };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }
Beispiel #3
0
        public ActionResult AddUpdateRatePlan(etblPropertyRoomRatePlanInventoryMap eObj)
        {
            object result = null;

            try
            {
                if (ModelState.IsValid)
                {
                    eObj.iPropId      = Convert.ToInt32(Session["PropId"]);
                    eObj.iActionBy    = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId;
                    eObj.dtActionDate = DateTime.Now;

                    if (eObj.SelectedOccupancies != null)
                    {
                        JArray jArray = (JArray)JsonConvert.DeserializeObject(eObj.SelectedOccupancies.Replace("\\", "\""));
                        if (jArray != null)
                        {
                            List <etblPropertyParkingMap> lstPropertyParkingMap = new List <etblPropertyParkingMap>();
                            foreach (var item in jArray)
                            {
                                if (Convert.ToInt32(item["type"]) == 1)
                                {
                                    eObj.dSingleRate = Convert.ToDecimal(item["value"]);
                                }
                                if (Convert.ToString(item["type"]) == "2")
                                {
                                    eObj.dDoubleRate = Convert.ToDecimal(item["value"]);
                                }
                                if (Convert.ToString(item["type"]) == "3")
                                {
                                    eObj.dTripleRate = Convert.ToDecimal(item["value"]);
                                }
                                if (Convert.ToString(item["type"]) == "4")
                                {
                                    eObj.dQuadrupleRate = Convert.ToDecimal(item["value"]);
                                }
                                if (Convert.ToString(item["type"]) == "5")
                                {
                                    eObj.dQuintrupleRate = Convert.ToDecimal(item["value"]);
                                }
                            }
                        }
                    }
                    string strReturn = BL_bulk.SaveInventory(((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId, Convert.ToInt32(Session["PropId"]), eObj.dtInventoryDate.ToString("MM/dd/yyyy").Replace("-", "/"), eObj.iRoomId.ToString(), eObj.iRoomId.ToString() + "-" + eObj.iRPId.ToString(), "", "", "", eObj.bCloseOut ? "On" : "Off", eObj.iMinLengthStay.ToString(), eObj.iMaxLengthStay.ToString(), eObj.bCTA ? "On" : "Off", eObj.bCTD ? "On" : "Off", eObj.dSingleRate.ToString(), eObj.dDoubleRate.ToString(), eObj.dTripleRate.ToString(), eObj.dQuadrupleRate.ToString(), eObj.dQuintrupleRate.ToString());

                    if (strReturn == "a")
                    {
                        result = new { st = 1, msg = "Updated successfully." };
                    }
                    else if (strReturn.StartsWith("["))
                    {
                        result = new { st = 0, msg = "Rate Plan is not valid for this date." };
                    }
                    else
                    {
                        result = new { st = 0, msg = "Kindly try after some time." };
                    }
                }
                else
                {
                    string errormsg = "";
                    foreach (ModelState modelState in ViewData.ModelState.Values)
                    {
                        foreach (ModelError error in modelState.Errors)
                        {
                            errormsg += error.ErrorMessage;
                            errormsg += "</br>";
                        }
                    }

                    result = new { st = 0, msg = errormsg };
                }
            }
            catch (Exception)
            {
                result = new { st = 0, msg = "Kindly try after some time." };
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }