/// <summary> /// 继续执行工作流 /// </summary> /// <param name="entity"></param> /// <param name="user"></param> /// <param name="ExecuteResult"></param> /// <param name="ExecuteComment"></param> /// <param name="Memo"></param> public void LabData_ContinueDBWF(string InstanceStepExecutorId, string ToStepId, string ExecuteResult, string ExecuteComment, string Memo, string currentUserId, string currentUserName, bool continueWF) { var InstanceStepExecutor = InstanceStepExecutorDAO.Get(InstanceStepExecutorId); var InstanceStep = WFDA.Instance.GetInstanceStep(InstanceStepExecutor.InstanceStepId); var Instance = WFDA.Instance.GetInstance(InstanceStepExecutor.InstanceId); // 更新 InstanceStepExecutor 的 Extend01 字段,让工作流进行流转 var toStep = WFDA.Instance.GetStep(ToStepId); SetFinished(InstanceStepExecutorId, ExecuteResult, ExecuteComment, Memo, currentUserName); WFDA.Instance.UpdateInstanceStepExt(InstanceStep.InstanceStepId, "Extend01", toStep.StepId, currentUserName); WFDA.Instance.UpdateInstanceStepExt(InstanceStep.InstanceStepId, "Extend02", toStep.StepName, currentUserName); if (continueWF) { var engine = NinjectHelper.Get <IEngine>(); if (engine == null) { throw new Exception("找不到 IEngine".GetRes()); } // 继续工作流 engine.ContinueDBWF(Instance.ModelId, Instance.InstanceId, InstanceStep.InstanceStepId, true, currentUserId, currentUserName); } }
internal static DataGridVM DeleteForm(DFDictionary queryParameters) { FormM form = null; DFDictionary entity = null; DFPub.SetDBEntity(queryParameters, ref form, ref entity); var vm = new DataGridVM(); var message = string.Empty; var da = NinjectHelper.Get <IDA>(form.DAImp); try { if (null == da) { throw new Exception("Invalid DAImp"); } if (da.Delete(form, entity, vm, ref message) != 0) { vm.hasError = true; } vm.error = message; } catch (Exception ex) { m_log.Error(ex.Message, ex); vm.hasError = true; vm.error = ex.Message; } return(vm); }
/// <summary> /// 转签或者加签 /// </summary> /// <param name="InstanceStepExecutorId"></param> /// <param name="list"></param> /// <param name="ExecuteComment"></param> /// <param name="ExecuteResult"></param> /// <param name="p"></param> public void TransferOrAdditional(string InstanceStepExecutorId, List <VM_WF_M_USER> list, string ExecuteComment, string ExecuteResult, string currentUser) { WFInstance Instance; WFInstanceStep InstanceStep; WF_M_STEP Step; WF_T_INSTANCESTEPEXECUTOR InstanceStepExecutor; InstanceStepExecutorDAO.GetAllInfo(InstanceStepExecutorId, out InstanceStepExecutor, out InstanceStep, out Instance, out Step); ExecuteComment = string.Format("{0}\r\n{1}", ExecuteComment, InstanceStepExecutor.ExecuteComment); var engine = NinjectHelper.Get <IEngine>(); if (engine == null) { throw new WFException("找不到 IEngine".GetRes()); } var memo = string.Format("{0}{1}给{2}", currentUser, ExecuteResult, string.Join(",", list.Select(a => a.UserName))); // 加签或者转签 for (int i = 0; i < list.Count; i++) { var user = list[i]; var listInstanceStepExecutorIds = ExecutorImp.InsertOneAndProxy(InstanceStep.InstanceStepId, user.UserId, user.UserName , memo, currentUser, true); SaveAdditionalApproveInfo(listInstanceStepExecutorIds, ExecuteResult, InstanceStepExecutor.InstanceStepExecutorId, user.UserName); } if (ExecuteResult == "加签" && string.IsNullOrWhiteSpace(InstanceStep.Extend04)) { WFDA.Instance.UpdateInstanceStepExt(InstanceStep.InstanceStepId, "Extend04", InstanceStepExecutorId, currentUser); } // 结束当前我自己的任务 SetFinished(InstanceStepExecutorId, ExecuteResult, ExecuteComment, memo, currentUser); }
private static void RunSingle(Condition firstCondition, bool firstValue) { var solver = NinjectHelper.Get <IBDDSolver>(); var secondCondition = new Condition() { { "a", firstValue } }; var automata = TestHelper.CreateAutomataWithConditions(firstCondition, secondCondition); var booleanNetwork = CreateBooleanNetwork(); var availableFunctions = new Dictionary <string, List <int> >() { { "a", new List <int>() { 47 } } }; var res = solver.IsValidPath(automata, booleanNetwork, availableFunctions); Assert.IsTrue(res); secondCondition = new Condition() { { "a", !firstValue } }; automata = TestHelper.CreateAutomataWithConditions(firstCondition, secondCondition); solver = NinjectHelper.Get <IBDDSolver>(); res = solver.IsValidPath(automata, booleanNetwork, availableFunctions); Assert.IsFalse(res); }
public void TestSCaseWithThreeParametersAndThreeRulesBDDSolver() { var solver = NinjectHelper.Get <IBDDSolver>(); var automata = new GeneNode() { CurrentCondition = new Condition() { { "a", true }, { "b", false }, { "c", true } }, NodeName = "n0", Transitions = new List <GeneTransition>() { new GeneTransition() { Node = new GeneNode() { CurrentCondition = new Condition() { { "a", false }, { "b", true }, { "c", true } }, NodeName = "n1", //Transitions = new List<GeneTransition>() //{ // new GeneTransition() // { // Node = new GeneNode() // { // NodeName = "n2", // CurrentCondition = new Condition() { { "a", true }, { "b", false }, {"c", false} } // } // } //} } } } }; var booleanNetwork = new List <GeneLink>() { new GeneLink() { From = "a", To = "a", IsPositive = false }, new GeneLink() { From = "b", To = "b", IsPositive = false }, new GeneLink() { From = "a", To = "c", IsPositive = true }, }; var res = solver.IsValidPath(automata, booleanNetwork); Assert.IsTrue(res); }
public void TestSCaseWithMultipleParametersAddSomeParamsMissingInSomeNodes() { var solver = NinjectHelper.Get <IBDDSolver>(); var automata = new GeneNode() { CurrentCondition = new Condition() { { "a", true }, { "b", false }, { "c", true } }, NodeName = "n0", Transitions = new List <GeneTransition>() { new GeneTransition() { Node = new GeneNode() { // not C here CurrentCondition = new Condition() { { "a", false }, { "b", true } }, NodeName = "n1", Transitions = new List <GeneTransition>() { new GeneTransition() { Node = new GeneNode() { NodeName = "n2", CurrentCondition = new Condition() { { "a", true }, { "b", false }, { "c", true } } } } } } } } }; // C not exist here!! var booleanNetwork = new List <GeneLink>() { new GeneLink() { From = "a", To = "a", IsPositive = false }, new GeneLink() { From = "b", To = "b", IsPositive = false }, }; var res = solver.IsValidPath(automata, booleanNetwork); Assert.IsTrue(res); }
public override int Delete(FormM form, DFDictionary entity, ref string message) { var user = Util.GetCurrentUser(); var data = JsonSerializeHelper.DeserializeObject <List <Dictionary <string, string> > >(entity["data"]); if (data == null) { throw new Exception("无效的参数 data".GetRes()); } if (entity["subAction"] == "DeleteWorkflow") { using (var db = Pub.DB) { var sql = "exec wfsp_delete_instance @InstanceId"; db.Execute(sql, data.Select(a => new { InstanceId = a["InstanceId"] })); message = "删除成功".GetRes(); } } else if (entity["subAction"] == "CancelWorkflow") { var engine = NinjectHelper.Get <IEngine>(); if (engine == null) { throw new Exception("找不到 IEngine".GetRes()); } var failed = 0; var success = 0; foreach (var item in data) { var InstanceId = item["InstanceId"]; if (!string.IsNullOrWhiteSpace(InstanceId)) { var Instance = WFDA.Instance.GetInstance(InstanceId); if (null != Instance && Instance.InstanceStatus == Pub.Running) { if (engine.AbortWF(Instance.InstanceId, user.UserId, user.UserName)) { AbortWF(Instance.InstanceId); success++; } else { failed++; } } else { failed++; } } } message = string.Format("成功取消流程 {0} 个,失败 {1} 个", success, failed); } return(DFPub.EXECUTE_SUCCESS); }
public void TestCaseWithOneParametersAndTwoStepsIn_Time_2_BDDSolverShouldPass() { var solver = NinjectHelper.Get <IBDDSolver>(); var automata = new GeneNode() { CurrentCondition = new Condition() { { "a", true } }, NodeName = "n0", Transitions = new List <GeneTransition>() { new GeneTransition() { Node = new GeneNode() { CurrentCondition = new Condition() { { "a", true } }, NodeName = "n1", Transitions = new List <GeneTransition>() { new GeneTransition() { Node = new GeneNode() { CurrentCondition = new Condition() { { "a", true } }, NodeName = "n2" } } } } } } }; var booleanNetwork = new List <GeneLink>() { new GeneLink() { From = "a", To = "a", IsPositive = true }, //new GeneLink() {From = "b", To = "b", IsPositive = false} }; var res = solver.IsValidPath(automata, booleanNetwork); Assert.IsTrue(res); }
public void TestCaseWithOneParameterAndTwoStepsSameAsAboveStartFromNegative() { var solver = NinjectHelper.Get <IBDDSolver>(); var automata = new GeneNode() { CurrentCondition = new Condition() { { "a", false } }, NodeName = "n0", Transitions = new List <GeneTransition>() { new GeneTransition() { Node = new GeneNode() { CurrentCondition = new Condition() { { "a", false } }, NodeName = "n1", Transitions = new List <GeneTransition>() { new GeneTransition() { Node = new GeneNode() { CurrentCondition = new Condition() { { "a", true } }, NodeName = "n2", } } } } } } }; var booleanNetwork = new List <GeneLink>() { new GeneLink() { From = "a", To = "a", IsPositive = false }, }; var res = solver.IsValidPath(automata, booleanNetwork); Assert.IsFalse(res); }
public void TestPositiveConnectionCantPassWithNegativeValue() { var solver = NinjectHelper.Get <IBDDSolver>(); var automata = new GeneNode() { CurrentCondition = new Condition() { }, NodeName = "n0", Transitions = new List <GeneTransition>() { new GeneTransition() { Node = new GeneNode() { CurrentCondition = new Condition() { { "a", true } }, NodeName = "n1", Transitions = new List <GeneTransition> { new GeneTransition() { Node = new GeneNode() { CurrentCondition = new Condition() { { "a", false } }, NodeName = "n2", } } } } } } }; var booleanNetwork = new List <GeneLink>() { new GeneLink() { From = "a", To = "a", IsPositive = true }, //new GeneLink() {From = "b", To = "b", IsPositive = false} }; var res = solver.IsValidPath(automata, booleanNetwork); Assert.IsFalse(res); }
public override DFDictionary Get(FormM form, DFDictionary entity, ref string message) { if (string.IsNullOrWhiteSpace(entity["ModelId"])) { throw new Exception("缺少参数 ModelId".GetRes()); } var engine = NinjectHelper.Get <IEngine>(); if (engine == null) { throw new Exception("找不到 IEngine".GetRes()); } var user = Util.GetCurrentUser(); var instanceId = Pub.GetNextIdFromDB("T", DateTime.Now.ToString("yyyyMMdd"), string.Empty, 4); var Requestor = user.UserId; var RequestorName = user.UserName; var RequestorProxy = string.Empty; var RequestorProxyName = string.Empty; // 开始工作流 engine.StartDBWF(entity["ModelId"], instanceId, Requestor, RequestorProxy, RequestorName, RequestorProxyName, DateTime.Now, true, user.UserId, user.UserName); var dict = new DFDictionary(); if (!string.IsNullOrWhiteSpace(entity["ModelId"])) { using (var db = Pub.DB) { var sql = "select * from WF_T_INSTANCE where 1=1"; sql += " and InstanceId=@InstanceId"; var parameters = new { InstanceId = instanceId }; var item = db.Query <WF_T_INSTANCE>(sql, parameters).FirstOrDefault(); if (item != null) { dict = DFDictionary.Create <WF_T_INSTANCE>(item); } } } return(dict); }
protected void RunPositiveTest(Dictionary <int, List <int> > resultValues) { var fault = new List <Tuple <int, int> >(); var solver = NinjectHelper.Get <IBDDSolver>(); resultValues.ToList().ForEach((rv) => { TetsParameters.ForEach(tp => { var functionNum = rv.Key; var expectedValue = rv.Value[tp.CaseNumber]; var log = $" function num: {functionNum}, case number {tp.CaseNumber}, expectedValue : {expectedValue}"; logger.Info(log); Trace.WriteLine(log); var firstCondition = tp.FirstCondition; var secondCondition = new Condition() { { "a", expectedValue == 1 } }; var automata = TestHelper.CreateAutomataWithConditions(firstCondition, secondCondition); var booleanNetwork = CreateBooleanNetwork(); var availableFunctions = new Dictionary <string, List <int> >() { { "a", new List <int>() { functionNum } } }; var res = solver.IsValidPath(automata, booleanNetwork, availableFunctions); if (!res) { fault.Add(new Tuple <int, int>(functionNum, tp.CaseNumber)); logger.Warn("failed in this case"); } }); } ); Assert.IsTrue(fault.Count == 0, JsonConvert.SerializeObject(fault)); /** Change2 **/ }
public IHttpActionResult GetData() { var solver = NinjectHelper.Get <IBDDSolver>(); var parser = new FileParser(); var data = new ParseRuleResponse(); var res = parser.GetConditionAndExperiments(PathHelper.GetExamplePath("toy"), PathHelper.GetSpecPath("toy"), out data); var automates = data.Experiments.ToDictionary(s => s.Key, s => new AutomataFromExperimentCreator().CreateAutomata(s.Value)); var sos = solver.IsValidPath(automates.First().Value, res); return(Ok(new { message = sos })); }
private static bool IsExistPath(string experimentName) { var solver = NinjectHelper.Get <IBDDSolver>(); var parser = new FileParser(); var data = new ParseRuleResponse(); var res = parser.GetConditionAndExperiments($"{experimentName}.net", $"{experimentName}.spec", out data); var automates = data.Experiments.ToDictionary(s => s.Key, s => new AutomataFromExperimentCreator().CreateAutomata(s.Value)); var sos = solver.IsValidPath(automates.First().Value, res); return(sos); }
public void TestNotOperatorIWorking() { var solver = NinjectHelper.Get <IBDDSolver>(); var automata = new GeneNode() { CurrentCondition = new Condition() { { "a", false }, { "b", true } }, NodeName = "n0", Transitions = new List <GeneTransition>() { new GeneTransition() { Node = new GeneNode() { CurrentCondition = new Condition() { { "a", true }, { "b", false } }, NodeName = "n1" } } } }; var booleanNetwork = new List <GeneLink>() { new GeneLink() { From = "b", To = "b", IsPositive = false }, new GeneLink() { From = "a", To = "a", IsPositive = false } }; var res = solver.IsValidPath(automata, booleanNetwork); Assert.IsTrue(res); }
private DFDictionary ClientReport(DFDictionary dict) { FormM form = null; DFDictionary entity = null; DFPub.SetDBEntity(dict, ref form, ref entity); var ret = new DFDictionary(); var message = string.Empty; var da = NinjectHelper.Get <IDA>(form.DAImp); try { if (null == da) { throw new Exception("Invalid DAImp"); } if (da.Update(form, entity, ref message) != 0) { ret.Add("hasError", "true"); } var baseDA = (BaseDA)da; ret.Add("Debug", entity["Debug"]); ret.Add("ReportName", Path.GetFileName(baseDA.ReportPath)); ret.Add("UploadFileUrl", baseDA.GetUrlFolder() + "/kindeditor/asp.net/upload_json.ashx"); ret.Add("ReportUrl", baseDA.GetUrlRoot() + DFPub.PhysicalToRelative(baseDA.ReportPath)); if (baseDA.ReportDataSource != null) { ret.Add("ReportDataSource", Convert.ToBase64String(SerializeHelper.DataSetSerializer(baseDA.ReportDataSource))); } ret.Add("error", message); m_log.Debug(JsonSerializeHelper.SerializeObject(ret)); } catch (Exception ex) { ret.Add("hasError", "true"); ret.Add("error", ex.Message); m_log.Error(ex.Message, ex); } return(ret); }
private static void AbortWF(string instanceId) { var model = WFDA.Instance.GetModelByInstanceId(instanceId); if (model == null) { throw new WFException(string.Format("根据工作流实例编号 {0} 不能找到对应的工作流模型定义", instanceId)); } var f = DFPub.GetFormM(model.DFFormName); var da = NinjectHelper.Get <IDA>(f.DAImp); if (da == null) { throw new WFException(string.Format("根据 {0} 不能创建 IDA 接口", f.DAImp)); } var d = new DFDictionary(); d.Add("InstanceId", instanceId); var msg = string.Empty; (da as BaseDA).AbortWF(f, d, ref msg); }
private static void Extend02(string CurrentUserId, string CurrentUserName, WF_T_INSTANCESTEPEXECUTOR InstanceStepExecutor, IEngine engine) { try { // 附加执行 var step = WFDA.Instance.GetStep(InstanceStepExecutor.StepId); if (!string.IsNullOrWhiteSpace(step.Extend02)) { var business = NinjectHelper.Get <IWFBusiness>(step.Extend02); if (business != null) { var context = engine.GetContext(InstanceStepExecutor.InstanceId, CurrentUserId, CurrentUserName); var instanceStep = WFDA.Instance.GetInstanceStep(InstanceStepExecutor.InstanceStepId); context.InstanceStep = instanceStep; context.IsRollback = false; business.Leave(context); } } } catch (Exception ex) { WFLog.ErrorFormat(LogFileName, ex.Message, ex); } }
/// <summary> /// 从某个运行时步骤到另外一个步骤 /// </summary> /// <param name="InstanceStepExecutorId"></param> /// <param name="ToStepId"></param> /// <param name="CurrentUserId"></param> /// <param name="CurrentUserName"></param> private void GotoStep(string InstanceStepExecutorId, string ToStepId, string CurrentUserId, string CurrentUserName) { var InstanceStepExecutor = InstanceStepExecutorDAO.Get(InstanceStepExecutorId); var ToStep = WFDA.Instance.GetStep(ToStepId); if (ToStep.StepId == InstanceStepExecutor.StepId) { throw new WFException("当前步骤和下一步骤不能相同".GetRes()); } var engine = NinjectHelper.Get <IEngine>(); if (engine == null) { throw new WFException("找不到 IEngine".GetRes()); } // 更新步骤签核信息 InstanceStepExecutorDAO.UpdateUnfinishedByInstanceStepId(InstanceStepExecutor.InstanceStepId, "自动完成", Pub.Finished, CurrentUserName); var rollback = new List <string>() { "回退", "不同意", "拒绝" }; if (rollback.Contains(InstanceStepExecutor.ExecuteResult)) { engine.RollbackDBWF(ToStep.ModelId, InstanceStepExecutor.InstanceId, InstanceStepExecutor.InstanceStepId, ToStep.StepId, true, CurrentUserId, CurrentUserName); } else { Extend02(CurrentUserId, CurrentUserName, InstanceStepExecutor, engine); // 继续工作流 engine.GotoDBWF(ToStep.ModelId, InstanceStepExecutor.InstanceId, InstanceStepExecutor.InstanceStepId, ToStep.StepId, true, CurrentUserId, CurrentUserName); } }
public void TestHerrmannCaseBddSolverIsWrong() { var parser = new FileParser(); var data = new ParseRuleResponse(); var res = parser.GetConditionAndExperiments($"herrmann.net", $"herrmann.spec", out data); var automates = data.Experiments.ToDictionary(s => s.Key, s => new AutomataFromExperimentCreator().CreateAutomata(s.Value)); bool sos = true; int i = 0; automates.ToList().ForEach(a => { var solver = NinjectHelper.Get <IBDDSolver>(); logger.Info("Start " + (i++)); sos &= solver.IsValidPath(a.Value, res); }); Assert.IsFalse(sos); }
public PersonControllerTest() { _personService = NinjectHelper.Get <IPersonService>(); }
public static IUnitOfWork Get() { return(NinjectHelper.Get <IUnitOfWork>()); }
public BookingsControllerTest() { _bookingService = NinjectHelper.Get <IBookingService>(); }
public void TestCaseWithTwoParametersAndTwoStepsBDDSolverShouldFailed() { var solver = NinjectHelper.Get <IBDDSolver>(); var automata = new GeneNode() { CurrentCondition = new Condition() { { "a", true }, { "b", false } }, NodeName = "n0", Transitions = new List <GeneTransition>() { new GeneTransition() { Node = new GeneNode() { CurrentCondition = new Condition() { { "a", true }, { "b", true } }, NodeName = "n1", Transitions = new List <GeneTransition>() { new GeneTransition() { Node = new GeneNode() { CurrentCondition = new Condition() { { "a", true }, { "b", false } }, NodeName = "n2", Transitions = new List <GeneTransition>() { new GeneTransition() { Node = new GeneNode() { NodeName = "n3", // here b is wrong CurrentCondition = new Condition() { { "a", true }, { "b", false } }, } } } } } } } } } }; var booleanNetwork = new List <GeneLink>() { new GeneLink() { From = "a", To = "a", IsPositive = true }, new GeneLink() { From = "b", To = "b", IsPositive = false } }; var res = solver.IsValidPath(automata, booleanNetwork); Assert.IsFalse(res); }
public override DFDictionary Get(FormM form, DFDictionary entity, ref string message) { ArgumentCheck.CheckMustInput(entity, "ModelId"); var engine = NinjectHelper.Get <IEngine>(); if (engine == null) { throw new Exception("找不到 IEngine".GetRes()); } var user = Util.GetCurrentUser(); var instanceId = string.Empty; // 信达生物 SAP 只能传递 10 位流水号 var model = WFDA.Instance.GetModelById(entity["ModelId"]); if (model.DFFormName == "Form_XDSW_T_PR") { instanceId = Pub.GetNextIdFromDB("P", DateTime.Now.ToString("yyMMdd"), string.Empty, 3); } else if (model.DFFormName == "Form_AD_T_PO") { instanceId = Pub.GetNextIdFromDB("P", DateTime.Now.ToString("yyyyMMdd"), string.Empty, 4); } else if (model.DFFormName == "Form_AD_T_BANK_PAYMENT") { instanceId = Pub.GetNextIdFromDB("F", DateTime.Now.ToString("yyyyMMdd"), string.Empty, 4); } else if (model.DFFormName == "Form_AD_T_FA") { instanceId = Pub.GetNextIdFromDB("G", DateTime.Now.ToString("yyyyMMdd"), string.Empty, 4); } else { instanceId = Pub.GetNextIdFromDB("A", DateTime.Now.ToString("yyyyMMdd"), string.Empty, 4); } var Requestor = user.UserId; var RequestorName = user.UserName; var RequestorProxy = string.Empty; var RequestorProxyName = string.Empty; // 如果是代理申请,客户端会传上来申请人编号 if (!string.IsNullOrWhiteSpace(entity["Requestor"])) { Requestor = entity["Requestor"]; var requestor = WF_M_USERLoader.Get(Requestor); if (requestor == null) { throw new Exception(string.Format("根据用户编号 {0} 找不到用户", Requestor)); } RequestorName = requestor.UserName; RequestorProxy = user.UserId; RequestorProxyName = user.UserName; } // 开始工作流 engine.StartDBWF(entity["ModelId"], instanceId, Requestor, RequestorProxy, RequestorName, RequestorProxyName, DateTime.Now, true, user.UserId, user.UserName); if (!string.IsNullOrWhiteSpace(entity["SourceInstanceId"])) { // 复制单据 CloneInstance(entity, instanceId); } var dict = new DFDictionary(); if (!string.IsNullOrWhiteSpace(entity["ModelId"])) { using (var db = Pub.DB) { var sql = "select * from WF_T_INSTANCE where 1=1"; sql += " and InstanceId=@InstanceId"; var parameters = new { InstanceId = instanceId }; var item = db.Query <WF_T_INSTANCE>(sql, parameters).FirstOrDefault(); if (item != null) { dict = DFDictionary.Create <WF_T_INSTANCE>(item); } } } return(dict); }
internal static DataGridVM QueryForm(DFDictionary queryParameters) { FormM form = null; DFDictionary entity = null; DFPub.SetDBEntity(queryParameters, ref form, ref entity); if (null == form) { throw new ArgumentException("DF_FORMNAME"); } var start = ParseHelper.ParseInt(queryParameters["start"]).GetValueOrDefault(); var limit = ParseHelper.ParseInt(queryParameters["limit"]).GetValueOrDefault(); // 如果客户端是导出,那么就设置记录数为最大值 if (queryParameters.Data.ContainsKey(DFPub.DF_DATAGRID_EXPORT)) { start = 0; limit = int.MaxValue; } var vm = new DataGridVM(); var message = string.Empty; if (!string.IsNullOrWhiteSpace(form.DAImp)) { var da = NinjectHelper.Get <IDA>(form.DAImp); try { if (null == da) { throw new Exception("Invalid DAImp"); } da.Query(form, entity, vm, start, limit, ref message); if (vm.rows == null) { vm.rows = new List <string>(); } if (vm.rows.GetType() == typeof(DataTable)) { if (entity.Data.ContainsKey(DFPub.DF_DATAGRID_EXPORT)) { vm.data = ExportHelper.Export(((DataTable)vm.rows), form, vm.data as List <GridColumnM>); } } else { ConvertToDisplayText((IList)vm.rows); if (entity.Data.ContainsKey(DFPub.DF_DATAGRID_EXPORT)) { vm.data = ExportHelper.Export(((IList)vm.rows), form); } } } catch (Exception ex) { m_log.Error(ex.Message, ex); vm.hasError = true; vm.error = ex.Message; message = ex.Message; } } if (vm.rows == null) { vm.rows = new List <string>(); } return(vm); }