/// <summary> /// /// </summary> /// <param name="setting"></param> /// <returns></returns> public JsonResult SetSystemPreferences(CompanySetting setting) { var client2 = SvcBldr.CompanyV2(); ExceptionsML bizEx = null; SR <CompanySetting> existingSetting = null; if (setting.Id != Guid.Empty) { existingSetting = client2.Get(setting.Id); } if (existingSetting != null && existingSetting.Error != null) { return(Result(null, bizEx)); } if (existingSetting == null) { setting.Id = Functions.NewSeq(); existingSetting = client2.Create(setting); } else { existingSetting = client2.Update(setting); } return(Result(existingSetting.Result, existingSetting.Error)); }
public JsonResult Companies() { ExceptionsML bizEx = null; var companyClient = SvcBldr.Company(); var companyClientV2 = SvcBldr.CompanyV2(); var company = new Company() { Id = Guid.Empty, Name = Constants.i18n("newTitle"), Prefix = "AAAA" }; var companiesSR = companyClientV2.GetCompanies(); if (companiesSR.Error != null) { bizEx = companiesSR.Error; } var companies = companiesSR.Result != null?companiesSR.Result.ToList() : null; if (companies != null) { companies.Insert(0, company); } return(Result(companies, bizEx, JsonRequestBehavior.AllowGet)); }
public JsonResult GetDefaultCompanyInstance() { ExceptionsML bizEx = null; var hosting = SvcBldr.CompanyV2();//Hosting(); var instance = hosting.GetDefaultCompanyInstance(); return(Result(instance, bizEx)); }
public System.Web.Mvc.ActionResult GetSystemNotificationsEditor(SystemNotification notification) { var client = SvcBldr.CompanyV2(); string site = string.Empty; var model = new SystemNotificationEditorModel(); if (notification.Title == null) { return(GetSystemNotificationsEditor(Guid.Empty, new ExceptionsML { Message = Constants.i18n("titleEmptyWarning") })); } else { notification.Title.Trim(); } if (Context.Request.Form["Site"] != null) { site = Context.Request.Form["Site"]; } if (site.IndexOf("All") >= 0) { site = "All"; } else { notification.SiteID = site.Split(',').Select(s => Guid.Parse(s)).ToArray(); } if (Context.Request.Form["StartDate"] != null) { notification.StartDate = Convert.ToDateTime(Context.Request.Form["StartDate"]); } if (Context.Request.Form["EndDate"] != null) { notification.EndDate = Convert.ToDateTime(Context.Request.Form["EndDate"]); } if (notification.Id == Guid.Empty) { notification.Id = Guid.NewGuid(); client.CreateSystemNotification(notification); } else { client.UpdateSystemNotification(notification); } ExceptionsML ex = new ExceptionsML(); return(GetSystemNotificationsEditor(notification.Id, ex)); }
public JsonResult GetSystemPreferences() { var clientV2 = SvcBldr.CompanyV2(); var settings = clientV2.GetMany(); var sList = new List <CompanySetting>(); if (settings.Result != null) { sList = settings.Result.ToList(); sList.Add(new CompanySetting() { Id = Guid.Empty, Name = Constants.i18n("newTitle"), InstanceId = sList.First().InstanceId, Type = "String", Value = "" }); } return(Result(sList, settings.Error, JsonRequestBehavior.AllowGet)); }
public System.Web.Mvc.ActionResult GetSystemNotificationsEditor(Guid?selectedId, ExceptionsML ex) { var model = new SystemNotificationEditorModel(); try { var dc = SvcBldr.CompanyV2(); model.Exception = ex; model.Notifications = new List <SystemNotification>(); model.Notifications.Add(new SystemNotification() { Title = Constants.i18n("newTitle"), Content = "", Id = Guid.Empty, StartDate = DateTime.Now, EndDate = DateTime.Now }); var b = dc.GetAllSystemNotification(); if (b.Error != null) { return(Result(null, b.Error, JsonRequestBehavior.AllowGet)); } model.Notifications.AddRange(b.Result); if (selectedId.HasValue) { var selected = model.Notifications.FirstOrDefault(r => r.Id == selectedId.Value); if (selected != null) { model.SelectedNotification = selected; } } else { model.SelectedNotification = new SystemNotification() { Title = Constants.i18n("newTitle"), Content = "", Id = Guid.Empty, StartDate = DateTime.Now, EndDate = DateTime.Now }; } } catch (Exception err) { model.Exception = ExceptionsML.GetExceptionML(err); } return(View(model)); }
public System.Web.Mvc.ActionResult LiveChat() { try { var companyClient = SvcBldr.CompanyV2(); var cd = companyClient.GetChatData(); if (String.IsNullOrEmpty(cd.Result.Channel)) { cd.Result.Channel = @Functions.GetSetting("ChatChannelId", "716209851"); } if (cd.Result.IsGuest) { cd.Result.UserName = "******" + cd.Result.UserName; } ExceptionsML.Check(cd.Error); return(View(cd.Result)); } catch (Exception ex) { return(View("../Home/Oops", ExceptionsML.GetExceptionML(ex))); } }
public void DeleteSystemNotification(Guid Id) { var dc = SvcBldr.CompanyV2(); dc.DeleteSystemNotification(Id); }