public ActionResult ProjectStatusUpdate(string ids, byte status) { string res = ""; if (SecurityCache.FormCan("Project", SecurityPermissionBaseTypeEnum.Edit)) { List <Guid> guids = new List <Guid>(); string[] separateIds = ids.Split(new string[] { ",", ", " }, StringSplitOptions.RemoveEmptyEntries); Guid parseId; foreach (string id in separateIds) { if (Guid.TryParse(id, out parseId)) { guids.Add(parseId); } else { return(Content(ServiceStack.Text.JsonSerializer.SerializeToString <string>(null))); } } OptimaJet.BJet.VTB.Project.SetStatus(guids, status); res = OptimaJet.Localization.LocalizationProvider.Provider.Get("The operation is completed") + "!"; return(Content(DynamicEntityJSONDataSource.GetSuccess(res))); } else { res = OptimaJet.Localization.LocalizationProvider.Provider.Get("Access is denied") + "!"; return(Content(DynamicEntityJSONDataSource.GetNotSuccess(res))); } }
public ActionResult BudgetRollbackToVersion(Guid budgetid, Guid versionid, bool ignorecheck = false) { string message = string.Empty; if (!SecurityCache.FormCan("Budget", "RollbackVersion")) { message = OptimaJet.Localization.LocalizationProvider.Provider.Get("Access is denied"); return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(message) }); } bool needConfirm; var success = BudgetItem.RollbackToVersion(budgetid, versionid, ignorecheck, out needConfirm, out message); if (!success) { return new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(message) } } ; return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetSuccess(message, needConfirm) }); }
public ActionResult BudgetRecalc(Guid id) { string res = string.Empty; if (SecurityCache.FormCan("Budget", "Recalc")) { try { OptimaJet.BJet.VTB.BudgetItem.RecalcBudget(id); res = OptimaJet.Localization.LocalizationProvider.Provider.Get("Recalculation complete"); } catch (Exception ex) { Logger.Log.Error(ex); return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(ex.Message) }); } } else { res = OptimaJet.Localization.LocalizationProvider.Provider.Get("Access is denied"); } return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetSuccess(res) }); }
public ActionResult BudgetItemChangeManager(Guid employeeid, string budgetitems) { var idsList = budgetitems.Split(',').Where(x => !string.IsNullOrWhiteSpace(x)).Select(x => new Guid(x)).ToList(); if (SecurityCache.FormCan("BudgetItem", "ChangeManager")) { try { string message; if (BudgetItem.ChangeManager(employeeid, idsList, out message)) { return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetSuccess(message) }); } return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(message) }); } catch (Exception ex) { Logger.Log.Error(ex); return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(ex.Message) }); } } else { return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(OptimaJet.Localization.LocalizationProvider.Provider.Get("Access is denied")) }); } }
public ActionResult InvoiceToState(Guid id, byte state) { string res = string.Empty; if (!SecurityCache.FormCan("Invoice", "ChangeState")) { return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(OptimaJet.Localization.LocalizationProvider.Provider.Get("Access is denied")) }); } try { var error = OptimaJet.BJet.VTB.Invoice.ToState(id, state); if (!string.IsNullOrWhiteSpace(error)) { return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(error) }); } res = OptimaJet.Localization.LocalizationProvider.Provider.Get("State is changed"); } catch (Exception ex) { Logger.Log.Error(ex); return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(ex.Message) }); } return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetSuccess(res) }); }
public ActionResult FormCan(string name, string permission) { var res = SecurityCache.FormCan(name, permission); return(Content(res.ToString())); }