Пример #1
0
        public ActionResult LocationDetailGet(LocationDetailModel model)
        {
            string html = null;

            try
            {
                DataTable dt = obj.FunDataTable("SELECT * from dbo.CityDetail_Get ()");
                if (dt.Rows.Count > 0)
                {
                    int[]         columnHide = { 0 };
                    StringBuilder htmlTable  = CommonUtil.htmlTableEditMode(dt, columnHide);
                    return(Json(new { Flag = 0, Html = htmlTable.ToString() }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    html = "<div class='alert alert-danger'>'" + Resources.Resource1.norecord + "'</div>";
                    return(Json(new { Flag = 0, Html = html }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                html = "Fatch Result Failed !!!";
                return(Json(new { Flag = 2, Html = html }, JsonRequestBehavior.AllowGet));
            }
        }
Пример #2
0
        public ActionResult LocationDetailDelete(LocationDetailModel model)
        {
            string html = null;

            try
            {
                int a = obj.FunExecuteNonQuery("exec dbo.CityDetail_Delete '" + model.CityId + "'");
                if (a > 0)
                {
                    //return RedirectToAction("PropertyTypeGet");
                    DataTable dt = obj.FunDataTable("SELECT * from dbo.CityDetail_Get ()");
                    if (dt.Rows.Count > 0)
                    {
                        int[]         columnHide = { 0 };
                        StringBuilder htmlTable  = CommonUtil.htmlTableEditMode(dt, columnHide);
                        return(Json(new { Flag = 0, Html = htmlTable.ToString() }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        html = "<div class='alert alert-danger'>'" + Resources.Resource1.norecord + "'</div>";
                        return(Json(new { Flag = 0, Html = html }, JsonRequestBehavior.AllowGet));
                    }
                }
                else
                {
                    html = Resources.Resource1.deletefailed;
                    return(Json(new { Flag = 2, Html = html }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                html = Resources.Resource1.deletefailed;
                return(Json(new { Flag = 2, Html = html }, JsonRequestBehavior.AllowGet));
            }
        }
Пример #3
0
 public ActionResult UpdateLocation(LocationDetailModel oLocationInfo, string chkIsActive)
 {
     try
     {
         if (ModelState.IsValid)
         {
             oCurrentUser = (SysUser)Session["User"];
             var existLocation = oDBContext.OfferLocations.FirstOrDefault(t => t.ID == oLocationInfo.Location.ID);
             if (existLocation != null)
             {
                 existLocation.LocationName = oLocationInfo.Location.LocationName;
                 existLocation.ModifiedBy   = oCurrentUser.ID;
                 existLocation.ModifiedOn   = DateTime.Now;
                 existLocation.IsActive     = (!string.IsNullOrEmpty(chkIsActive) && chkIsActive.Contains("on")) ? true : false;
                 oDBContext.SaveChanges();
                 TempData["SuccessMsg"] = "Data Update Successfully";
             }
             else
             {
                 TempData["ErrorMsg"] = "Data Not Found!!!";
             }
         }
     }
     catch (Exception ex)
     {
         TempData["ErrorMsg"] = "Error Occured Due to " + ExceptionMsg(ex);
     }
     return(RedirectToAction("Index"));
 }
Пример #4
0
 public ActionResult InsertLocation(LocationDetailModel oLocationInfo)
 {
     try
     {
         if (ModelState.IsValid)
         {
             oCurrentUser = (SysUser)Session["User"];
             var existLocation = oDBContext.OfferLocations.FirstOrDefault(t => t.ID == oLocationInfo.Location.ID);
             if (existLocation == null)
             {
                 OfferLocation oOfferLocation = oLocationInfo.Location;
                 oOfferLocation.IsActive  = true;
                 oOfferLocation.CreatedBy = oCurrentUser.ID;
                 oOfferLocation.CreatedOn = DateTime.Now;
                 oDBContext.OfferLocations.Add(oOfferLocation);
                 oDBContext.SaveChanges();
                 TempData["SuccessMsg"] = "Data Saved Successfully";
             }
             else
             {
                 TempData["ErrorMsg"] = "Data already Exists!!!";
             }
         }
     }
     catch (Exception ex)
     {
         TempData["ErrorMsg"] = "Error Occured Due to " + ExceptionMsg(ex);
     }
     return(RedirectToAction("Index"));
 }
Пример #5
0
        public ActionResult UpdateLocation(int id)
        {
            var LocationInfo = new LocationDetailModel();

            LocationInfo.IsNew    = false;
            LocationInfo.Location = oDBContext.OfferLocations.FirstOrDefault(t => t.ID == id);
            ViewBag.LocationList  = oDBContext.OfferLocations.Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.LocationName.ToString()
            });
            return(PartialView("_locationDetailPartial", LocationInfo));
        }
Пример #6
0
        public ActionResult NewLocation()
        {
            oCurrentUser = (SysUser)Session["User"];
            var newLocation = new OfferLocation();

            newLocation.IsActive = false;
            var LocationInfo = new LocationDetailModel();

            LocationInfo.IsNew    = true;
            LocationInfo.Location = newLocation;

            ViewBag.LocationList = oDBContext.OfferLocations.Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.LocationName.ToString()
            });

            return(PartialView("_locationDetailPartial", LocationInfo));
        }