コード例 #1
0
        public ActionResult Update(PropertyMaster model)
        {
            if (Session["Login"] != null)
              {
              ViewBag.Propband = new SelectList(BAL.PropertyBandModel.PropertyBandDropDownList(), "Value", "Text");

              if (ModelState.IsValid)
              {
                  try
                  {
                      LoginSession loginsession = (LoginSession)Session["Login"];
                      model.modifyBy = Convert.ToInt64(loginsession.UserID);
                      if (PropertyModel.UpdateProperty(model))
                      {
                          return RedirectToAction("Index", "Property");
                      }
                      else
                      {
                          // return Json(new { result = 0, message = "Duplicate Currency Name " });
                          return Content("Unable to save , try again");
                      }
                  }
                  catch (Exception ex)
                  {
                      return Content("ErrorMessage" + ":" + ex.StackTrace.ToString());
                  }
              }
              else
              {
                  String errorMessage = String.Empty;
                  String exception = String.Empty;
                  foreach (var modelStateVal in ViewData.ModelState.Values)
                  {
                      foreach (var error in modelStateVal.Errors)
                      {
                          errorMessage = error.ErrorMessage;
                          exception = error.Exception.ToString();
                      }
                  }
                  return Content("ErrorMessage" + ":" + exception);
              }
              }
              else
              { return RedirectToAction("Index", "Home"); }
        }
コード例 #2
0
        public ActionResult Create()
        {
            if (Session["Login"] != null)
              {
              LoginSession loginsession = (LoginSession)Session["Login"];
              ViewBag.CompanyLogo = loginsession.CompanyLogo;
              ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
              String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
              String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
              ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType));
              ViewBag.RoleName = loginsession.RoleName;
              ViewBag.Propband = new SelectList(BAL.PropertyBandModel.PropertyBandDropDownList(), "Value", "Text");

              if (loginsession.ClientID != null)
              {
                  ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(loginsession.ClientID), "Value", "Text");
              }
              else
              { ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(), "Value", "Text"); }

              if (loginsession.SiteID != "0")
              {

                  ViewBag.Site = new SelectList(BAL.Common.Default_DDR(), "Value", "Text");
              }
              else
              {

                  ViewBag.Site = new SelectList(BAL.Common.Default_DDR(), "Value", "Text");
              }

              var model = new BAL.PropertyMaster();
              var selectedTariff = new List<CheckListTariff>();

              //setup a view model
              //model.Client_ID = Client_id;
              //model.Site_ID = Site_id;
              model.AvailableTariff = PropertyModel.Get_DefaultChkList();
              model.SelectedTariff = selectedTariff;
              return View(model);
              }
              else
              { return RedirectToAction("Index", "Home"); }
        }
コード例 #3
0
        public ActionResult Edit(String PropID)
        {
            if (Session["Login"] != null)
              {
              LoginSession loginsession = (LoginSession)Session["Login"];
              ViewBag.CompanyLogo = loginsession.CompanyLogo;
              ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
              String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
              String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
              ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType));
              ViewBag.RoleName = loginsession.RoleName;
              if (PropID != null)
              {
                  String Dec_PropID = BAL.Security.URLDecrypt(PropID);
                  if ((Dec_PropID != "0") && (Dec_PropID != null))
                  {
                      PropertyMaster prop = new PropertyMaster();
                      try
                      {
                          prop = BAL.PropertyModel.EditProperty(Dec_PropID);
                          ViewBag.propID = prop.ID;
                          ViewBag.Client = prop.ClientID;
                          ViewBag.Site = prop.SiteID;

                          var selectedTariff = new List<CheckListTariff>();
                          prop.AvailableTariff = BAL.PropertyModel.GetSelectedChkList(Convert.ToInt64(prop.ID));
                          prop.SelectedTariff = selectedTariff;

                          if (prop != null)
                          {
                              ViewBag.Propband = new SelectList(BAL.PropertyBandModel.PropertyBandDropDownList(Convert.ToInt64(prop.ClientID), Convert.ToInt64(prop.SiteID)), "Value", "Text", prop.PropertyBrand);
                          }
                          else
                          {
                              ViewBag.Propband = new SelectList(BAL.PropertyBandModel.PropertyBandDropDownList(Convert.ToInt64(prop.ClientID), Convert.ToInt64(prop.SiteID)), "Value", "Text");

                          }

                      }
                      catch (Exception ex)
                      { return Content(ex.Message); }
                      return View(prop);
                  }
              }
              {
                  return RedirectToAction("Index", "Property");
              }
              }
              else
              { return RedirectToAction("Index", "Home"); }
        }
コード例 #4
0
        public ActionResult Create(PropertyMaster model, String Command)
        {
            if (Session["Login"] != null)
              {
              ViewBag.Propband = new SelectList(BAL.PropertyBandModel.PropertyBandDropDownList(), "Value", "Text");
              if (String.IsNullOrEmpty(model.PropertyNumber))
              {
                  ModelState.AddModelError("Property Number", "Please Enter Property Number");
              }
              if (model.City == null)
              {
                  ModelState.AddModelError("Property city", "Please Enter Property city");
              }

              if (model.PostCode == null)
              {
                  ModelState.AddModelError("Property postcode", "Please Enter Property postcode");
              }
              if (model.PropertyBrand == null)
              {
                  ModelState.AddModelError("Property Band", "Please Enter Property Band");
              }

              if (ModelState.IsValid)
              {
                  try
                  {
                      IEnumerable<CheckListTariff> Selected = model.SelectedTariff;
                      LoginSession loginsession = (LoginSession)Session["Login"];
                      model.CreateBy = Convert.ToInt64(loginsession.UserID);

                      if (Command == "Save")
                      {
                          if (PropertyModel.CreateProperty(model))
                          {
                              return Json(new { result = 1, message = "Record was successfully Saved!" });
                          }
                          else
                          {
                              return Json(new { result = 0, message = "Duplicate Notification Name " });
                          }

                      }
                      else
                      {
                          return Content("Comming soon ");
                      }

                  }
                  catch (Exception ex)
                  {
                      return Json(new { result = 0, message = "ErrorMessage" + ":" + ex.StackTrace.ToString() });
                  }
              }
              else
              {
                  String errorMessage = String.Empty;
                  String exception = String.Empty;
                  foreach (var modelStateVal in ViewData.ModelState.Values)
                  {
                      foreach (var error in modelStateVal.Errors)
                      {
                          errorMessage = error.ErrorMessage;
                          exception = error.Exception.ToString();
                      }
                  }
                  return Json(new { result = 0, message = "ErrorMessage" + ":" + exception });
              }
              }
              else
              { return RedirectToAction("Index", "Home"); }
        }
コード例 #5
0
ファイル: BALProperty.cs プロジェクト: arnabknd4/scs2300915
 public static bool UpdateProperty(PropertyMaster prop)
 {
     Boolean flag = false;
     try
     {
         Icontext objinter = new BALProperty();
         flag = objinter.UpdateRecord(prop);
     }
     catch (Exception ex)
     {
         throw;
     }
     return flag;
 }
コード例 #6
0
ファイル: BALProperty.cs プロジェクト: arnabknd4/scs2300915
 public static Boolean CreateProperty(PropertyMaster Prop)
 {
     Boolean flag = false;
     try
     {
         Icontext objtext = new BALProperty();
         flag = objtext.CreateRecord(Prop);
     }
     catch (Exception ex)
     {
         throw;
     }
     return flag;
 }
コード例 #7
0
ファイル: BALProperty.cs プロジェクト: arnabknd4/scs2300915
        public Object EditRecord(Int64 PropertyID)
        {
            PropertyMaster _prop = new PropertyMaster();
            try
            {
                Property prop = DAL.DALProperty.EditProperty(Convert.ToInt64(PropertyID));
                _prop.ID = prop.ID;

                if (prop.ClientID!= null)
                {
                    _prop.ClientID = prop.ClientID;
                }
                if (prop.SiteID != null)
                {
                    _prop.SiteID = prop.SiteID;
                }
                if (!String.IsNullOrEmpty(prop.PropertyNumber))
                {
                    _prop.PropertyNumber = prop.PropertyNumber;
                }
                if (!String.IsNullOrEmpty(prop.Apartment))
                {
                    _prop.Apartment = prop.Apartment;
                }
                if (!String.IsNullOrEmpty(prop.Address1))
                {
                    _prop.Address1 = prop.Address1;
                }
                if (!String.IsNullOrEmpty(prop.Address2))
                {
                    _prop.Address2 = prop.Address2;
                }
                if (!String.IsNullOrEmpty(prop.City))
                {
                    _prop.City = prop.City;
                }
                if (!String.IsNullOrEmpty(prop.County))
                {
                    _prop.County = prop.County;
                }
                if (!String.IsNullOrEmpty(prop.PostCode))
                {
                    _prop.PostCode = prop.PostCode;
                }
                if (prop.PropertyBrand!= null)
                {
                    _prop.PropertyBrand = prop.PropertyBrand;
                }
                PropertyInfo property = new PropertyInfo();
                property.PropertyID = Convert.ToInt64(PropertyID);
                _prop.Client = property.GetClient();
                _prop.Site = property.GetSite();
            }
            catch (Exception ex)
            {
                throw;
            }
            return _prop;
        }