Exemple #1
0
        public ActionResult RoomInventory(string roomid, string date)
        {
            etblPropertyRoomInventory obj = new etblPropertyRoomInventory();

            obj = BL_tblPropertyRoomInventory.GetSingleRecordById(Convert.ToInt32(roomid), clsUtils.ConvertyyyymmddtoDateTime(date));
            if (obj.iPropId != 0)
            {
                if (obj.dtInventoryDate != null)
                {
                    obj.InventoryDate = String.Format("{0:dd/MM/yyyy}", obj.dtInventoryDate);
                }
                if (obj.bStopSell == true)
                {
                    obj.sStopSell = "Yes";
                }
                else
                {
                    obj.sStopSell = "No";
                }
            }
            else
            {
                obj.dtInventoryDate = clsUtils.ConvertyyyymmddtoDateTime(date);
                obj.InventoryDate   = String.Format("{0:dd/MM/yyyy}", obj.dtInventoryDate);
                obj.iRoomId         = Convert.ToInt64(roomid);
            }



            return(PartialView("_RoomInventory", obj));
        }
Exemple #2
0
        //Get Single Record
        public static etblPropertyRoomInventory GetSingleRecordById(int roomid, DateTime inventorydate)
        {
            etblPropertyRoomInventory eobj = new etblPropertyRoomInventory();

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                var dbobj = (from t1 in db.tblPropertyRoomInventories
                             join t2 in db.tblPropertyRoomMaps on new { t1.iRoomId, t1.iPropId } equals new { t2.iRoomId, t2.iPropId }
                             select new
                {
                    t1.dtInventoryDate,
                    t1.iPropId,
                    t1.iRoomId,
                    t1.iInventory,
                    t1.bStopSell,
                    t1.iCutOff,
                    t1.dtActionDate,
                    t1.iActionBy,
                    t1.iAvailableInventory,
                    t2.sRoomName
                }).Where(u => u.dtInventoryDate == inventorydate && u.iRoomId == roomid).AsQueryable().SingleOrDefault();

                if (dbobj != null)
                {
                    eobj = (etblPropertyRoomInventory)OneFineRateAppUtil.clsUtils.ConvertToObject(dbobj, eobj);
                }
            }
            return(eobj);
        }
Exemple #3
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));
        }
Exemple #4
0
        //Update a record
        public static int UpdateRecord(etblPropertyRoomInventory eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    //remove old mapings
                    db.tblPropertyRoomInventories.RemoveRange(db.tblPropertyRoomInventories.Where(x => x.iRoomId == eobj.iRoomId && x.dtInventoryDate == eobj.dtInventoryDate));

                    OneFineRate.tblPropertyRoomInventory obj = (OneFineRate.tblPropertyRoomInventory)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblPropertyRoomInventory());
                    db.tblPropertyRoomInventories.Add(obj);

                    db.SaveChanges();
                    retval = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }