protected override FetchResult <TemplateVM> _fetch(int?Skip, int?Count, NgControllerInstruct[] filters) { using (var l = new MessagesModuleLogic()) { var queryResult = l.GetAll <tblTemplate>() .Select(x => PocoConstructor.MakeFromObj(x, TemplateVM.tblTemplatePR)); return(FetchResult <TemplateVM> .Succes(queryResult, queryResult.Count())); } }
protected override FetchResult <RFilterVM> _fetch(int?Skip, int?Count, NgControllerInstruct[] filters) { using (var l = new MessagesModuleLogic()) { var items = l.GetAll <tblRecepientFilter>() .Select(x => PocoConstructor.MakeFromObj(x, RFilterVM.tblRecepientFilterPR)); return(FetchResult <RFilterVM> .Succes(items, items.Count())); } }
protected override FetchResult <EmailSenderDataProviderVM> _fetch(int?Skip, int?Count, NgControllerInstruct[] filters) { using (var l = new MessagesModuleLogic()) { int allQCount; var queryResult = l.GetFiltered <tblEmailSenderDataProvider>(Skip, Count, filters, out allQCount) .Select(x => PocoConstructor.MakeFromObj(x, EmailSenderDataProviderVM.tblEmailSenderDataProviderPR)); return(FetchResult <EmailSenderDataProviderVM> .Succes(queryResult, allQCount)); } }
protected override FetchResult <RecepientcardVM> _fetch(int?Skip, int?Count, NgControllerInstruct[] filters) { using (var l = new MessagesModuleLogic()) { int fullQueryCount; var queryResult = l.GetFiltered <tblRecepientCard>(Skip, Count, filters, out fullQueryCount) .Select(x => PocoConstructor.MakeFromObj(x, RecepientcardVM.tblRecepientCardPR)); return(FetchResult <RecepientcardVM> .Succes(queryResult, fullQueryCount)); } }
protected override FetchResult <MessageReportVM> _fetch(int?Skip, int?Count, NgControllerInstruct[] filters) { using (var l = new MessagesModuleLogic()) { int count; var queryResult = l.GetFiltered <tblMessage>(Skip, Count, filters, out count) .Select(x => PocoConstructor.MakeFromObj(x, MessageReportVM.tblMessagePR)); return(FetchResult <MessageReportVM> .Succes(queryResult, count)); } }
public JsonResult GetOperatorsForType(string typename) { if (string.IsNullOrWhiteSpace(typename)) { return(NgResultToJsonResult(NgResult.Fail(@DEBS.Translate("MessageModule.Typename is undefined")))); } var items = SqlOperator.GetAllowedForSqlType(typename); return(NgResultToJsonResult(FetchResult <SqlOperator> .Succes(items, items.Count()))); }
protected override FetchResult <FilterVM> _fetch(int?Skip, int?Count, NgControllerInstruct[] filters) { IEnumerable <FilterVM> filts; int allQueryCount; using (var l = new MessagesModuleLogic()) { var result = l.GetFiltered <tblFilter>(Skip, Count, filters, out allQueryCount); filts = result.Select(x => PocoConstructor.MakeFromObj(x, sqllogic, FilterVM.tblFilterPR)).ToArray(); } return(FetchResult <FilterVM> .Succes(filts, allQueryCount)); }
protected override FetchResult <RFilterTableVM> _fetch(int?Skip, int?Count, NgControllerInstruct[] filters) { using (var l = new MessagesModuleLogic()) { var items = l.GetAll <tblRecepientFilterTableName>().Select(x => PocoConstructor.MakeFromObj(x, RFilterTableVM.tblRecepientFilterTableNamePR) ); if (items.Count() == 0) { return(FetchResult <RFilterTableVM> .Fail(DEBS.Translate("MessageMdl.There is no base tables in database"))); } return(FetchResult <RFilterTableVM> .Succes(items, items.Count())); } }
public JsonResult MockMessage(int templateId, int?MaxCount) { using (var l = new MessagesModuleLogic()) { var tmpl = l.Get <tblTemplate>(templateId); if (tmpl == null) { return(NgResultToJsonResult(NgResult.Fail(DEBS.Translate("MessageMdl.Server Error: cannot find template, try save it and re-open.")))); } var items = TASK_PROTOTYPE.GetDemoMessages(l, tmpl, sqllogic, tmpl.IsSms, MaxCount ?? 0); return(NgResultToJsonResult(FetchResult <Message> .Succes(items, items.Count))); } }
public JsonResult GetColumns(int id) { string tablename; using (var l = new MessagesModuleLogic()) { var item = l.Get <tblRecepientFilterTableName>(id); if (item == null) { return(NgResultToJsonResult(NgResult.Fail(DEBS.Translate("MessageMdl.There is no binded table in database with id: {0}", id)))); } tablename = item.ReferncedTableName; } var data = sqlLogic.GetColomnsInfos(tablename); return(NgResultToJsonResult(FetchResult <IDictionary <string, string> > .Succes(data, data.Count))); }
public JsonResult GetReservedCodes() { var items = new List <WildcardVM>() { new WildcardVM { Code = tblRecepientCard.NameCode, Name = DEBS.Translate("MessageMdl.Recepient Name"), Id = -10 }, new WildcardVM { Code = tblRecepientCard.EmailCode, Name = DEBS.Translate("MessageMdl.Recepient Email"), Id = -11 }, new WildcardVM { Code = tblRecepientCard.PhoneCode, Name = DEBS.Translate("MessageMdl.Recepient Phone"), Id = -12 } }; return(NgResultToJsonResult(FetchResult <WildcardVM> .Succes(items, items.Count))); }
protected override FetchResult <BatchReportVM> _fetch(int?Skip, int?Count, NgControllerInstruct[] filters) { using (var l = new MessagesModuleLogic()) { var query = l.GetFilteredQueryable <tblMessageBatch>(filters); int count = query.Count(); query = query.OrderByDescending(x => x.FinishedOn).ThenByDescending(x => x.CreatedOn); if (Skip != null) { query = query.Skip(Skip.Value); } if (Count != null) { query = query.Take(Count.Value); } var queryResult = query.ToList().Select(x => PocoConstructor.MakeFromObj(x, BatchReportVM.tblMessageBatchPR)); return(FetchResult <BatchReportVM> .Succes(queryResult, count)); } }
protected override FetchResult <MessageScheduleVM> _fetch(int?Skip, int?Count, NgControllerInstruct[] filters) { using (var l = new MessagesModuleLogic()) { IQueryable <tblMessageSchedule> baseQuery = null; //Special instructions filtration. //this SHOULD be incapsulated sometime. //Special instructions is query filters that not relies on main enitity POCO parametrs //such as tblMessageSchedule in this case, and we need special logick to handle it, var specialInstructions = filters == null ? null : filters.Where(x => x.isSpecial); NgControllerInstruct filter; if (specialInstructions != null && (filter = specialInstructions.FirstOrDefault(x => x.key == "TemplateName")) != null) { baseQuery = l.GetFilteredQueryable <tblTemplate> (new[] { new NgControllerInstruct { key = "Name", op = filter.op, val = filter.val } }).SelectMany(x => x.tblMessageSchedules); } var query = l.GetFilteredQueryable(filters, baseQuery); int count = query.Count(); query = query.OrderByDescending(x => x.ScheduleDate); if (Skip != null) { query = query.Skip(Skip.Value); } if (Count != null) { query = query.Take(Count.Value); } var queryResult = query.ToList().Select(x => PocoConstructor.MakeFromObj(x, MessageScheduleVM.tblMessageSchedulePR)); return(FetchResult <MessageScheduleVM> .Succes(queryResult, count)); } }
public JsonResult GetRepeatModes() { var items = ScheduleRepeatModeHelper.GetAllowedRepeatModeNames(); return(NgResultToJsonResult(FetchResult <string> .Succes(items, items.Length))); }