Beispiel #1
0
 public JsonResult CheckSuiteByName(string suiteName, int suiteId)
 {
     Models.vi_SAS suite = new Models.vi_SAS();
     suite = Services.CheckSuiteByName(Application.AppSettingsValue("HoldingCompany"), suiteName, suiteId, true);
     if (suite == null)
     {
         suite           = new Models.vi_SAS();
         suite.SuiteName = string.Empty;
     }
     return(Json(suite, JsonRequestBehavior.AllowGet));
 }
Beispiel #2
0
        public Task <JsonResult> GetSuite(string floorId, int suiteId)
        {
            return(Task.Factory.StartNew(() =>
            {
                var returnVal = new Libs.KmoAjaxResult()
                {
                    success = false
                };

                try
                {
                    Models.vi_SAS suite = new Models.vi_SAS();
                    suite = Services.GetSuite(Application.AppSettingsValue("HoldingCompany"), floorId, suiteId);
                    if (suite == null)
                    {
                        // new
                        suite = new Models.vi_SAS();
                        suite.SuiteOrder = 0;
                        suite.SuiteName = string.Empty;
                        suite.SuiteArea = 0;
                        suite.ElectricityCapacity = 0;
                        suite.Zone = string.Empty;
                    }
                    suite.SuitId = Services.NewSuiteId(Application.AppSettingsValue("HoldingCompany"), Application.GlobalUseApi, floorId);

                    //throw new Exception("Raise Error if any");
                    returnVal.data = suite;
                    returnVal.success = true;
                }
                catch (Exception x)
                {
                    returnVal.message = x.Message;
                }

                return Json(returnVal, JsonRequestBehavior.AllowGet);
            }));
        }