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); }
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); }
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); }