//public string CommitEbDataSource() //{ // var req = this.HttpContext.Request.Form; // string refid; // EbDataSource obj; // if (string.IsNullOrEmpty(req["id"])) // { // var ds = new EbObject_Create_New_ObjectRequest(); // ds.EbObjectType = (int)EbObjectType.DataSource; // obj = EbSerializers.Json_Deserialize<EbDataSource>(req["json"]); // ds.Name = obj.Name; // ds.Description = obj.Description; // ds.Json = req["json"]; // ds.Status = ObjectLifeCycleStatus.Dev; // ds.Relations = req["rel_obj"]; // ds.IsSave = false; // ds.Tags = req["tags"]; // var res = ServiceClient.Post<EbObject_Create_New_ObjectResponse>(ds); // refid = res.RefId; // } // else // { // var ds = new EbObject_CommitRequest(); // ds.EbObjectType = (int)EbObjectType.DataSource; // obj = EbSerializers.Json_Deserialize<EbDataSource>(req["json"]); // ds.Name = obj.Name; // ds.Description = obj.Description; // ds.Json = req["json"]; // ds.Relations = req["rel_obj"]; // ds.RefId = req["id"]; // ds.ChangeLog = req["changeLog"]; // ds.Tags = req["tags"]; // var res = ServiceClient.Post<EbObject_CommitResponse>(ds); // refid = res.RefId; // } // return refid; //} //public string SaveEbDataSource() //{ // var req = this.HttpContext.Request.Form; // string refid; // EbDataSource obj; // if (string.IsNullOrEmpty(req["id"])) // { // var ds = new EbObject_Create_New_ObjectRequest(); // ds.EbObjectType = (int)EbObjectType.DataSource; // obj = EbSerializers.Json_Deserialize<EbDataSource>(req["json"]); // ds.Name = obj.Name; // ds.Description = obj.Description; // ds.Json = req["json"]; // ds.Status = ObjectLifeCycleStatus.Dev; // ds.Relations = req["rel_obj"]; // ds.IsSave = true; // ds.Tags = req["tags"]; // var res = ServiceClient.Post<EbObject_Create_New_ObjectResponse>(ds); // refid = res.RefId; // } // else // { // var ds = new EbObject_SaveRequest(); // var _EbObjectType = (EbObjectType)Convert.ToInt32(req["ObjectType"]); // ds.RefId = req["Id"]; // obj = EbSerializers.Json_Deserialize<EbDataSource>(req["json"]); // ds.Name = obj.Name; // ds.Description = obj.Description; // ds.EbObjectType = Convert.ToInt32(req["ObjectType"]); // ds.Json = req["json"]; // //if (_EbObjectType == EbObjectType.SqlFunction) // //{ // // ds.NeedRun = Convert.ToBoolean(req["NeedRun"]); // //} // ds.Relations = req["rel_obj"]; // ds.Tags = req["tags"]; // ViewBag.IsNew = "false"; // var res = this.ServiceClient.Post<EbObject_SaveResponse>(ds); // refid = res.RefId; // } // return refid; //} //public string Create_Major_Version(string _refId, int _type) //{ // var ds = new EbObject_Create_Major_VersionRequest(); // ds.RefId = _refId; // ds.EbObjectType = _type; // ds.Relations = null; // var res = this.ServiceClient.Post<EbObject_Create_Major_VersionResponse>(ds); // return res.RefId; //} //public string Create_Minor_Version(string _refId, int _type) //{ // var ds = new EbObject_Create_Minor_VersionRequest(); // ds.RefId = _refId; // ds.EbObjectType = _type; // ds.Relations = null; // var res = this.ServiceClient.Post<EbObject_Create_Minor_VersionResponse>(ds); // return res.RefId; //} //public string Create_Patch_Version(string _refId, int _type) //{ // var ds = new EbObject_Create_Patch_VersionRequest(); // ds.RefId = _refId; // ds.EbObjectType = _type; // ds.Relations = null; // var res = this.ServiceClient.Post<EbObject_Create_Patch_VersionResponse>(ds); // return res.RefId; //} //[HttpPost] //public EbDataSource VersionCodes(string objid, int objtype) //{ // EbDataSource dsobj = null; // var _EbObjectType = (EbObjectType)objtype; // var resultlist = this.ServiceClient.Get<EbObjectParticularVersionResponse>(new EbObjectParticularVersionRequest { RefId = objid }); // var rlist = resultlist.Data; // foreach (var element in rlist) // { // if (_EbObjectType == EbObjectType.DataSource) // { // var obj = new EbObjectWrapper(); // dsobj = EbSerializers.Json_Deserialize<EbDataSource>(element.Json); // ViewBag.Code = dsobj.Sql; // dsobj.Status = element.Status; // dsobj.VersionNumber = element.VersionNumber; // } // } // return dsobj; //} public IActionResult GetFilterBody(string dvobj) { var dsObject = EbSerializers.Json_Deserialize(dvobj); dsObject.AfterRedisGet(this.Redis); return(ViewComponent("ParameterDiv", new { paramDiv = dsObject.FilterDialog })); }
public IActionResult SqlFunction_Editor(int i) { ViewBag.Header = "Edit Sql Function"; var req = this.HttpContext.Request.Form; string obj_id = req["objid"].ToString(); ViewBag.Obj_id = obj_id; var resultlist = this.ServiceClient.Get <EbObjectNonCommitedVersionResponse>(new EbObjectNonCommitedVersionRequest { RefId = obj_id }); var rlist = resultlist.Data; foreach (var element in rlist) { ObjectLifeCycleStatus[] array = (ObjectLifeCycleStatus[])Enum.GetValues(typeof(ObjectLifeCycleStatus)); List <ObjectLifeCycleStatus> lifeCycle = new List <ObjectLifeCycleStatus>(array); ViewBag.LifeCycle = lifeCycle; ViewBag.IsNew = "false"; var dsobj = EbSerializers.Json_Deserialize <EbSqlFunction>(element.Json); ViewBag.ObjectName = element.Name; ViewBag.ObjectDesc = element.Description; ViewBag.Code = dsobj.Sql; ViewBag.Status = element.Status; ViewBag.VersionNumber = element.VersionNumber; ViewBag.EditorHint = "CodeMirror.hint.sql"; ViewBag.EditorMode = "text/x-sql"; ViewBag.Icon = "fa fa-database"; ViewBag.ObjType = (int)EbObjectType.SqlFunction; ViewBag.FilterDialogId = dsobj.FilterDialogId; } ViewBag.SqlFns = Getsqlfns((int)EbObjectType.SqlFunction); return(View()); }
public GetBotForm4UserResponse Get(GetBotForm4UserRequest request) { var Query1 = @" SELECT EOV.obj_json FROM eb_objects EO, eb_objects_ver EOV, eb_objects_status EOS WHERE EO.id = EOV.eb_objects_id AND EOS.eb_obj_ver_id = EOV.id AND EO.id = ANY('@Ids') AND EOS.status = 3 AND EO.obj_type = 18;;"; EbDataTable table = this.TenantDbFactory.ObjectsDB.DoQuery(Query1.Replace("@Ids", request.BotFormIds)); GetBotForm4UserResponse resp = new GetBotForm4UserResponse(); foreach (EbDataRow row in table.Rows) { var form = EbSerializers.Json_Deserialize(row[0].ToString()); resp.BotForms.Add(form); } //int _id = Convert.ToInt32(request.BotFormIds); //var myService = base.ResolveService<EbObjectService>(); //var res = (EbObjectFetchLiveVersionResponse)myService.Get(new EbObjectFetchLiveVersionRequest() { Id = _id }); return(resp); }
//Jith Builder related private string GetHtml2Render(BuilderType type, string objid) { IServiceClient client = this.ServiceClient; var resultlist = client.Get <EbObjectLatestCommitedResponse>(new EbObjectLatestCommitedRequest { RefId = objid }); var rlist = resultlist.Data[0]; string _html = string.Empty; EbControlContainer _form = null; if (type == BuilderType.FilterDialog) { _form = EbSerializers.Json_Deserialize <EbFilterDialog>(rlist.Json) as EbControlContainer; } else if (type == BuilderType.WebForm) { _form = EbSerializers.Json_Deserialize <EbWebForm>(rlist.Json) as EbControlContainer; } if (_form != null) { _html += _form.GetHtml(); } return(_html); }
public void AfterRedisGetBasicInfoByService(Service service, IRedisClient Redis) { this.FormLinks = new List <FormLink>(); foreach (DVBaseColumn col in this.Columns) { if (col.Check4FormLink()) { try { this.WebForm = Redis.Get <EbWebForm>(col.LinkRefId); if (this.WebForm == null) { var result = service.Gateway.Send <EbObjectParticularVersionResponse>(new EbObjectParticularVersionRequest { RefId = col.LinkRefId }); this.WebForm = EbSerializers.Json_Deserialize(result.Data[0].Json); Redis.Set <EbWebForm>(col.LinkRefId, this.WebForm); } this.FormLinks.Add(new FormLink { DisplayName = this.WebForm.DisplayName, Refid = col.LinkRefId, Params = col.FormParameters }); } catch (Exception e) { Console.WriteLine("AfterRedisGetBasicInfo " + e.Message); } } } }
public static EbApi GetApiByName(string name, string version, IDatabase ObjectsDB) { EbApi api_o = null; string sql = ObjectsDB.EB_API_BY_NAME; DbParameter[] parameter = { ObjectsDB.GetNewParameter("objname", EbDbTypes.String, name), ObjectsDB.GetNewParameter("version", EbDbTypes.String, version) }; EbDataTable dt = ObjectsDB.DoQuery(sql, parameter); if (dt.Rows.Count > 0) { EbDataRow dr = dt.Rows[0]; EbObjectWrapper _ebObject = (new EbObjectWrapper { Json = dr[0].ToString(), VersionNumber = dr[1].ToString(), EbObjectType = (dr[4] != DBNull.Value) ? Convert.ToInt32(dr[4]) : 0, Status = Enum.GetName(typeof(ObjectLifeCycleStatus), Convert.ToInt32(dr[2])), Tags = dr[3].ToString(), RefId = null, }); api_o = EbSerializers.Json_Deserialize <EbApi>(_ebObject.Json); } return(api_o); }
public bool Post(RefreshSolutionConnectionsMqRequest req) { using (var con = new TenantDbFactory("expressbase", this.Redis).DataDB.GetNewConnection() as Npgsql.NpgsqlConnection) { try { con.Open(); string sql = @"SELECT con_type, con_obj FROM eb_connections WHERE solution_id = @solution_id AND eb_del = false"; DataTable dt = new DataTable(); var ada = new Npgsql.NpgsqlDataAdapter(sql, con); ada.SelectCommand.Parameters.Add(new Npgsql.NpgsqlParameter("solution_id", NpgsqlTypes.NpgsqlDbType.Text) { Value = req.TenantAccountId }); ada.Fill(dt); EbSolutionConnections cons = new EbSolutionConnections(); foreach (DataRow dr in dt.Rows) { if (dr["con_type"].ToString() == EbConnectionTypes.EbDATA.ToString()) { cons.DataDbConnection = EbSerializers.Json_Deserialize <EbDataDbConnection>(dr["con_obj"].ToString()); } else if (dr["con_type"].ToString() == EbConnectionTypes.EbDATA_RO.ToString()) { cons.DataDbConnection = EbSerializers.Json_Deserialize <EbDataDbConnection>(dr["con_obj"].ToString()); } else if (dr["con_type"].ToString() == EbConnectionTypes.EbOBJECTS.ToString()) { cons.ObjectsDbConnection = EbSerializers.Json_Deserialize <EbObjectsDbConnection>(dr["con_obj"].ToString()); } else if (dr["con_type"].ToString() == EbConnectionTypes.EbFILES.ToString()) { cons.FilesDbConnection = EbSerializers.Json_Deserialize <EbFilesDbConnection>(dr["con_obj"].ToString()); } else if (dr["con_type"].ToString() == EbConnectionTypes.EbLOGS.ToString()) { cons.LogsDbConnection = EbSerializers.Json_Deserialize <EbLogsDbConnection>(dr["con_obj"].ToString()); } else if (dr["con_type"].ToString() == EbConnectionTypes.SMTP.ToString()) { cons.SMTPConnection = EbSerializers.Json_Deserialize <SMTPConnection>(dr["con_obj"].ToString()); } // ... More to come } Redis.Set <EbSolutionConnections>(string.Format("EbSolutionConnections_{0}", req.TenantAccountId), cons); return(true); } catch (Exception e) { return(false); } } }
public EbMobilePage GetSignUpPage() { if (string.IsNullOrEmpty(SignUpPage)) { return(null); } string regexed = EbSerializers.JsonToNETSTD(SignUpPage); return(EbSerializers.Json_Deserialize <EbMobilePage>(regexed)); }
public dynamic GetVersionObj(string refid) { var resultlist = this.ServiceClient.Get <EbObjectParticularVersionResponse>(new EbObjectParticularVersionRequest { RefId = refid }); var dsobj = EbSerializers.Json_Deserialize(resultlist.Data[0].Json); dsobj.Status = resultlist.Data[0].Status; dsobj.VersionNumber = resultlist.Data[0].VersionNumber; return(dsobj); }
public static T GetEbObject <T>(string refId, IRedisClient Redis, IDatabase ObjectsDB) { T ebObject = Redis.Get <T>(refId); if (ebObject == null) { List <EbObjectWrapper> wrap = EbObjectsHelper.GetParticularVersion(ObjectsDB, refId); ebObject = EbSerializers.Json_Deserialize <T>(wrap[0].Json); } return(ebObject); }
public string VersionCodes(string objid, int objtype) { var resultlist = this.ServiceClient.Get <EbObjectParticularVersionResponse>(new EbObjectParticularVersionRequest { RefId = objid }); var dsobj = EbSerializers.Json_Deserialize(resultlist.Data[0].Json); dsobj.Status = resultlist.Data[0].Status; dsobj.VersionNumber = resultlist.Data[0].VersionNumber; return(EbSerializers.Json_Serialize(dsobj)); }
public async Task <IViewComponentResult> InvokeAsync(string dsobj, int tabnum, int type, string refid, string ssurl) { ViewBag.dsObj = dsobj; if (dsobj != "null") { ViewBag.Html = EbSerializers.Json_Deserialize(dsobj).GetHtml(); } ViewBag.tabnum = tabnum; ViewBag.ObjType = type; ViewBag.Refid = refid; return(View()); }
public IActionResult Eb_EmailBuilder(string Htmlcode) { ViewBag.Header = "Edit Email"; var req = this.HttpContext.Request.Form; int obj_id = Convert.ToInt32(req["objid"]); ViewBag.Obj_id = Convert.ToInt32(req["objid"]); var resultlist = this.ServiceClient.Get <EbObjectExploreObjectResponse>(new EbObjectExploreObjectRequest { Id = obj_id }); var rlist = resultlist.Data; foreach (var element in rlist) { ObjectLifeCycleStatus[] array = (ObjectLifeCycleStatus[])Enum.GetValues(typeof(ObjectLifeCycleStatus)); List <ObjectLifeCycleStatus> lifeCycle = new List <ObjectLifeCycleStatus>(array); ViewBag.LifeCycle = lifeCycle; ViewBag.IsNew = "false"; ViewBag.ObjectName = element.Name; ViewBag.ObjectDesc = element.Description; ViewBag.Status = element.Status; ViewBag.VersionNumber = element.VersionNumber; ViewBag.Icon = "fa fa-database"; ViewBag.ObjType = (int)EbObjectType.EmailBuilder; ViewBag.Refid = element.RefId; ViewBag.Majorv = element.Dashboard_Tiles.MajorVersionNumber; ViewBag.Minorv = element.Dashboard_Tiles.MinorVersionNumber; ViewBag.Patchv = element.Dashboard_Tiles.PatchVersionNumber; if (String.IsNullOrEmpty(element.Json_wc) && !String.IsNullOrEmpty(element.Json_lc)) { ViewBag.ReadOnly = true; var dsobj = EbSerializers.Json_Deserialize <EbEmailTemplate>(element.Json_lc); ViewBag.dsobj = dsobj; ViewBag.html = dsobj.Body; } else { ViewBag.ReadOnly = false; var dsobj = EbSerializers.Json_Deserialize <EbEmailTemplate>(element.Json_wc); ViewBag.dsobj = dsobj; ViewBag.html = dsobj.Body; } var typeArray = typeof(EbEmailTemplateBase).GetTypeInfo().Assembly.GetTypes(); Context2Js _jsResult = new Context2Js(typeArray, BuilderType.EmailBuilder, typeof(EbEmailTemplateBase)); ViewBag.Meta = _jsResult.AllMetas; ViewBag.JsObjects = _jsResult.JsObjects; ViewBag.EbObjectTypes = _jsResult.EbObjectTypes; } return(View()); }
public IActionResult Index(string refid) { var resultlist = this.ServiceClient.Get <EbObjectParticularVersionResponse>(new EbObjectParticularVersionRequest { RefId = refid }); Report = EbSerializers.Json_Deserialize <EbReport>(resultlist.Data[0].Json); Report.IsLastpage = false; Report.watermarkImages = new Dictionary <string, byte[]>(); Report.WaterMarkList = new List <object>(); if (Report.DataSourceRefId != string.Empty) { cresp = this.Redis.Get <DataSourceColumnsResponse>(string.Format("{0}_columns", Report.DataSourceRefId)); if (cresp.IsNull) { cresp = this.ServiceClient.Get <DataSourceColumnsResponse>(new DataSourceColumnsRequest { RefId = Report.DataSourceRefId }); } Report.DataColumns = (cresp.Columns.Count > 1) ? cresp.Columns[1] : cresp.Columns[0]; dresp = this.ServiceClient.Get <DataSourceDataResponse>(new DataSourceDataRequest { RefId = Report.DataSourceRefId, Draw = 1, Start = 0, Length = 100 }); Report.DataRow = dresp.Data; } iTextSharp.text.Rectangle rec = new iTextSharp.text.Rectangle(Report.Width, Report.Height); d = new Document(rec); ms1 = new MemoryStream(); writer = PdfWriter.GetInstance(d, ms1); writer.Open(); d.Open(); writer.PageEvent = new HeaderFooter(this); writer.CloseStream = true;//important canvas = writer.DirectContent; Report.PageNumber = writer.PageNumber; //Report.DataRow = __datarows; Report.InitializeSummaryFields(); GetWatermarkImages(); d.NewPage(); DrawReportHeader(); DrawDetail(); d.Close(); ms1.Position = 0;//important return(new FileStreamResult(ms1, "application/pdf")); }
public string EmailTemplateSave(string _Refid, string PropObj) { var req = this.HttpContext.Request.Form; var emailobj = EbSerializers.Json_Deserialize <EbEmailTemplate>(PropObj); string refid; if (string.IsNullOrEmpty(_Refid)) { var ds = new EbObject_Create_New_ObjectRequest(); ds.EbObjectType = (int)EbObjectType.EmailBuilder; ds.Name = emailobj.Name; ds.Description = emailobj.Description; ds.Json = EbSerializers.Json_Serialize(new EbEmailTemplate { Body = emailobj.Body, //EbObjectType = emailobj.EbObjectType, Name = emailobj.Name, Subject = emailobj.Subject, DataSourceRefId = emailobj.DataSourceRefId }); ds.Relations = ""; ds.IsSave = true; var res = ServiceClient.Post <EbObject_Create_New_ObjectResponse>(ds); refid = res.RefId; } else { var ds = new EbObject_SaveRequest(); ds.RefId = _Refid; ds.Name = emailobj.Name; ds.Description = emailobj.Description; ds.EbObjectType = (int)EbObjectType.EmailBuilder; ds.Json = EbSerializers.Json_Serialize(new EbEmailTemplate { Body = emailobj.Body, //EbObjectType = emailobj.EbObjectType, Name = emailobj.Name, Subject = emailobj.Subject, DataSourceRefId = emailobj.DataSourceRefId }); ds.Relations = ""; ViewBag.IsNew = "false"; var res = this.ServiceClient.Post <EbObject_SaveResponse>(ds); refid = res.RefId; } return(refid); }
public string EmailTemplateCommit(string _Refid, string Htmlcode, string PropObj, string ChangeLog) { IServiceClient client = this.ServiceClient; var emailobj = EbSerializers.Json_Deserialize <EbEmailTemplate>(PropObj); string refid = ""; if (string.IsNullOrEmpty(_Refid)) { var ds = new EbObject_Create_New_ObjectRequest(); ds.EbObjectType = (int)EbObjectType.EmailBuilder; ds.Name = emailobj.Name; ds.Description = emailobj.Description; ds.Json = EbSerializers.Json_Serialize(new EbEmailTemplate { Body = emailobj.Body, //EbObjectType = emailobj.EbObjectType, Name = emailobj.Name, Subject = emailobj.Subject, DataSourceRefId = emailobj.DataSourceRefId }); ds.Relations = ""; ds.IsSave = false; var res = ServiceClient.Post <EbObject_Create_New_ObjectResponse>(ds); refid = res.RefId; } else { var ds = new EbObject_CommitRequest(); ds.EbObjectType = (int)EbObjectType.EmailBuilder; ds.Name = emailobj.Name; ds.Description = emailobj.Description; ds.Json = EbSerializers.Json_Serialize(new EbEmailTemplate { Body = emailobj.Body, //EbObjectType = emailobj.EbObjectType, Name = emailobj.Name, Subject = emailobj.Subject, DataSourceRefId = emailobj.DataSourceRefId }); ds.Relations = ""; ds.RefId = _Refid; ds.ChangeLog = ChangeLog; var res = ServiceClient.Post <EbObject_CommitResponse>(ds); refid = res.RefId; } return(refid); }
//[HttpGet][HttpPost] //public IActionResult dvTable(string objid, EbObjectType objtype) //{ // ViewBag.ServiceUrl = this.ServiceClient.BaseUri; // var typeArray = typeof(EbDataVisualizationObject).GetTypeInfo().Assembly.GetTypes(); // var _jsResult = CSharpToJs.GenerateJs<EbDataVisualizationObject>(BuilderType.DVBuilder, typeArray); // ViewBag.Meta = _jsResult.Meta; // ViewBag.JsObjects = _jsResult.JsObjects; // ViewBag.EbObjectType = _jsResult.EbObjectTypes; // if (objid != null) // { // var resultlist = this.ServiceClient.Get<EbObjectExploreObjectResponse>(new EbObjectExploreObjectRequest { Id = Convert.ToInt32(objid) }); // var rlist = resultlist.Data; // foreach (var element in rlist) // { // ObjectLifeCycleStatus[] array = (ObjectLifeCycleStatus[])Enum.GetValues(typeof(ObjectLifeCycleStatus)); // List<ObjectLifeCycleStatus> lifeCycle = new List<ObjectLifeCycleStatus>(array); // ViewBag.LifeCycle = lifeCycle; // ViewBag.IsNew = "false"; // ViewBag.ObjectName = element.Name; // ViewBag.ObjectDesc = element.Description; // ViewBag.Status = element.Status; // ViewBag.VersionNumber = element.VersionNumber; // ViewBag.Icon = "fa fa-database"; // ViewBag.ObjType = (int)objtype; // ViewBag.Refid = element.RefId; // ViewBag.Majorv = element.Dashboard_Tiles.MajorVersionNumber; // ViewBag.Minorv = element.Dashboard_Tiles.MinorVersionNumber; // ViewBag.Patchv = element.Dashboard_Tiles.PatchVersionNumber; // EbDataVisualization dsobj = null; // if (String.IsNullOrEmpty(element.Json_wc) && !String.IsNullOrEmpty(element.Json_lc)) // { // ViewBag.ReadOnly = true; // if (objtype == EbObjectType.TableVisualization) // dsobj = EbSerializers.Json_Deserialize<EbTableVisualization>(element.Json_lc); // else if (objtype == EbObjectType.ChartVisualization) // dsobj = EbSerializers.Json_Deserialize<EbChartVisualization>(element.Json_lc); // } // else // { // ViewBag.ReadOnly = false; // if (objtype == EbObjectType.TableVisualization) // dsobj = EbSerializers.Json_Deserialize<EbTableVisualization>(element.Json_wc); // else if (objtype == EbObjectType.ChartVisualization) // dsobj = EbSerializers.Json_Deserialize<EbChartVisualization>(element.Json_wc); // } // dsobj.AfterRedisGet(this.Redis); // ViewBag.dvObject = dsobj; // } // } // return View(); //} //[HttpGet][HttpPost] //public IActionResult dvChart(string objid, EbObjectType objtype) //{ // ViewBag.ServiceUrl = this.ServiceClient.BaseUri; // var typeArray = typeof(EbDataVisualizationObject).GetTypeInfo().Assembly.GetTypes(); // var _jsResult = CSharpToJs.GenerateJs<EbDataVisualizationObject>(BuilderType.DVBuilder, typeArray); // ViewBag.Meta = _jsResult.Meta; // ViewBag.JsObjects = _jsResult.JsObjects; // ViewBag.EbObjectType = _jsResult.EbObjectTypes; // if (objid != null) // { // var resultlist = this.ServiceClient.Get<EbObjectExploreObjectResponse>(new EbObjectExploreObjectRequest { Id = Convert.ToInt32(objid) }); // var rlist = resultlist.Data; // foreach (var element in rlist) // { // ObjectLifeCycleStatus[] array = (ObjectLifeCycleStatus[])Enum.GetValues(typeof(ObjectLifeCycleStatus)); // List<ObjectLifeCycleStatus> lifeCycle = new List<ObjectLifeCycleStatus>(array); // ViewBag.LifeCycle = lifeCycle; // ViewBag.IsNew = "false"; // ViewBag.ObjectName = element.Name; // ViewBag.ObjectDesc = element.Description; // ViewBag.Status = element.Status; // ViewBag.VersionNumber = element.VersionNumber; // ViewBag.Icon = "fa fa-database"; // ViewBag.ObjType = (int)objtype; // ViewBag.Refid = element.RefId; // ViewBag.Majorv = element.Dashboard_Tiles.MajorVersionNumber; // ViewBag.Minorv = element.Dashboard_Tiles.MinorVersionNumber; // ViewBag.Patchv = element.Dashboard_Tiles.PatchVersionNumber; // EbDataVisualization dsobj = null; // if (String.IsNullOrEmpty(element.Json_wc) && !String.IsNullOrEmpty(element.Json_lc)) // { // ViewBag.ReadOnly = true; // if (objtype == EbObjectType.TableVisualization) // dsobj = EbSerializers.Json_Deserialize<EbTableVisualization>(element.Json_lc); // else if (objtype == EbObjectType.ChartVisualization) // dsobj = EbSerializers.Json_Deserialize<EbChartVisualization>(element.Json_lc); // } // else // { // ViewBag.ReadOnly = false; // if (objtype == EbObjectType.TableVisualization) // dsobj = EbSerializers.Json_Deserialize<EbTableVisualization>(element.Json_wc); // else if (objtype == EbObjectType.ChartVisualization) // dsobj = EbSerializers.Json_Deserialize<EbChartVisualization>(element.Json_wc); // } // dsobj.AfterRedisGet(this.Redis); // ViewBag.dvObject = dsobj; // } // } // return View(); //} public IActionResult dvCommon(string dvobj, string dvRefId, bool flag) { var dvObject = EbSerializers.Json_Deserialize(dvobj); dvObject.AfterRedisGet(this.Redis, this.ServiceClient); if (!string.IsNullOrEmpty(dvobj) && !string.IsNullOrEmpty(dvRefId) && !flag) { return(ViewComponent("ParameterDiv", new { paramDiv = dvObject.EbDataSource.FilterDialog })); } else { return(ViewComponent("DataVisualization", new { dvobjt = dvobj, dvRefId = dvRefId })); } }
public string getdv(string refid, EbObjectType objtype) { EbDataVisualization dsobj = null; if (refid != null) { var resultlist = this.ServiceClient.Get <EbObjectParticularVersionResponse>(new EbObjectParticularVersionRequest { RefId = refid }); dsobj = EbSerializers.Json_Deserialize(resultlist.Data[0].Json); dsobj.Status = resultlist.Data[0].Status; dsobj.VersionNumber = resultlist.Data[0].VersionNumber; } return(EbSerializers.Json_Serialize(dsobj)); }
public IActionResult Index(string refid) { var resultlist = this.ServiceClient.Get <EbObjectParticularVersionResponse>(new EbObjectParticularVersionRequest { RefId = refid }); Report = EbSerializers.Json_Deserialize <EbReport>(resultlist.Data[0].Json); if (Report.DataSourceRefId != string.Empty) { cresp = this.Redis.Get <DataSourceColumnsResponse>(string.Format("{0}_columns", Report.DataSourceRefId)); if (cresp.IsNull) { cresp = this.ServiceClient.Get <DataSourceColumnsResponse>(new DataSourceColumnsRequest { RefId = Report.DataSourceRefId }); } __columns = (cresp.Columns.Count > 1) ? cresp.Columns[1] : cresp.Columns[0]; dresp = this.ServiceClient.Get <DataSourceDataResponse>(new DataSourceDataRequest { RefId = Report.DataSourceRefId, Draw = 1, Start = 0, Length = 100 }); dt = dresp.Data; } iTextSharp.text.Rectangle rec = (Report.IsLandscape) ? new iTextSharp.text.Rectangle(Report.Height, Report.Width) : new iTextSharp.text.Rectangle(Report.Width, Report.Height); d = new Document(rec); MemoryStream ms1 = new MemoryStream(); writer = PdfWriter.GetInstance(d, ms1); writer.Open(); d.Open(); writer.PageEvent = new HeaderFooter(this); writer.CloseStream = true;//important cb = writer.DirectContent; CalculateSectionHeights(); d.NewPage(); DrawReportHeader(); DrawDetail(); DrawReportFooter(); d.Close(); ms1.Position = 0; return(new FileStreamResult(ms1, "application/pdf")); }
private EbMobilePage DeserializeJsonPage() { EbMobilePage mpage = null; try { string regexed = EbSerializers.JsonToNETSTD(this.Json); mpage = EbSerializers.Json_Deserialize <EbMobilePage>(regexed); } catch (Exception ex) { EbLog.Info("DeserializeJsonPage error inside pagewrapper"); EbLog.Error(ex.Message); } return(mpage); }
private EbObject DeserializeJsonObject() { EbObject obj = null; try { string regexed = EbSerializers.JsonToNETSTD(this.Json); obj = EbSerializers.Json_Deserialize <EbObject>(regexed); } catch (Exception ex) { EbLog.Info("DeserializeJsonPage error inside pagewrapper"); EbLog.Error(ex.Message); } return(obj); }
public EbObject_Create_New_ObjectResponse Post(EbObject_Create_New_ObjectRequest request) { dynamic obj = EbSerializers.Json_Deserialize(request.Json); var _type = obj.GetType(); string refId = null; ILog log = LogManager.GetLogger(GetType()); log.Info("#DS insert -- entered post"); try { using (var con = this.TenantDbFactory.ObjectsDB.GetNewConnection()) { con.Open(); DbCommand cmd = null; log.Info("#DS insert 1 -- con open"); string[] arr = { }; string sql = "SELECT eb_objects_create_new_object(@obj_name, @obj_desc, @obj_type, @obj_cur_status, @obj_json::json, @commit_uid, @src_pid, @cur_pid, @relations, @issave, @tags, @app_id)"; cmd = this.TenantDbFactory.ObjectsDB.GetNewCommand(con, sql); cmd.Parameters.Add(this.TenantDbFactory.ObjectsDB.GetNewParameter("@obj_name", System.Data.DbType.String, request.Name)); cmd.Parameters.Add(this.TenantDbFactory.ObjectsDB.GetNewParameter("@obj_type", System.Data.DbType.Int32, GetObjectType(obj))); cmd.Parameters.Add(this.TenantDbFactory.ObjectsDB.GetNewParameter("@obj_desc", System.Data.DbType.String, (!string.IsNullOrEmpty(request.Description)) ? request.Description : string.Empty)); cmd.Parameters.Add(this.TenantDbFactory.ObjectsDB.GetNewParameter("@obj_cur_status", System.Data.DbType.Int32, ObjectLifeCycleStatus.Dev));//request.Status cmd.Parameters.Add(this.TenantDbFactory.ObjectsDB.GetNewParameter("@obj_json", NpgsqlTypes.NpgsqlDbType.Json, request.Json)); cmd.Parameters.Add(this.TenantDbFactory.ObjectsDB.GetNewParameter("@commit_uid", System.Data.DbType.Int32, request.UserId)); cmd.Parameters.Add(this.TenantDbFactory.ObjectsDB.GetNewParameter("@src_pid", System.Data.DbType.String, request.TenantAccountId)); cmd.Parameters.Add(this.TenantDbFactory.ObjectsDB.GetNewParameter("@cur_pid", System.Data.DbType.String, request.TenantAccountId)); cmd.Parameters.Add(this.TenantDbFactory.ObjectsDB.GetNewParameter("@relations", NpgsqlTypes.NpgsqlDbType.Array | NpgsqlTypes.NpgsqlDbType.Text, (request.Relations != null) ? request.Relations.Split(',').Select(n => n.ToString()).ToArray() : arr)); cmd.Parameters.Add(this.TenantDbFactory.ObjectsDB.GetNewParameter("@issave", System.Data.DbType.Boolean, request.IsSave)); cmd.Parameters.Add(this.TenantDbFactory.ObjectsDB.GetNewParameter("@tags", System.Data.DbType.String, (!string.IsNullOrEmpty(request.Tags)) ? request.Tags : string.Empty)); cmd.Parameters.Add(this.TenantDbFactory.ObjectsDB.GetNewParameter("@app_id", System.Data.DbType.Int32, request.AppId)); refId = cmd.ExecuteScalar().ToString(); SetRedis(obj, refId); } } catch (Exception e) { } return(new EbObject_Create_New_ObjectResponse() { RefId = refId }); }
public void InitFromDataBase(JsonServiceClient ServiceClient) { ////query is directly written- table, column namesa are given explicitly in query (only for postgre) var result = ServiceClient.Get <GetQuestionsBankResponse>(new GetQuestionsBankRequest { }); if (result.Questionlst.Count > 0) { this.OptionHtml = string.Empty; foreach (var dct in result.Questionlst) { EbQuestion qstn = EbSerializers.Json_Deserialize <EbQuestion>(dct.Value); var ctlHtml = qstn.GetHtml(); this.QuestionBankList.Add(dct.Key, qstn); this.QuestionBankCtlHtmlList.Add(dct.Key, ctlHtml); this.OptionHtml += $"<option value='{dct.Key}'>{qstn.Name}</option>"; } } }
public void AfterRedisGet(IRedisClient Redis, Service service) { try { this.FilterDialog = Redis.Get <EbFilterDialog>(this.FilterDialogRefId); if (this.FilterDialog == null && this.FilterDialogRefId != "") { var result = service.Gateway.Send <EbObjectParticularVersionResponse>(new EbObjectParticularVersionRequest { RefId = this.FilterDialogRefId }); this.FilterDialog = EbSerializers.Json_Deserialize(result.Data[0].Json); Redis.Set <EbFilterDialog>(this.FilterDialogRefId, this.FilterDialog); } } catch (Exception e) { Console.WriteLine("Exception:" + e.ToString()); } }
public void AfterRedisGetforFilter(RedisClient Redis, IServiceClient client) { try { this.EbFilterDialog = Redis.Get <EbFilterDialog>(this.FilterDialogRefId); if (this.EbFilterDialog == null) { var result = client.Get <EbObjectParticularVersionResponse>(new EbObjectParticularVersionRequest { RefId = this.FilterDialogRefId }); this.EbFilterDialog = EbSerializers.Json_Deserialize(result.Data[0].Json); Redis.Set <EbFilterDialog>(this.FilterDialogRefId, this.EbFilterDialog); } } catch (Exception e) { Console.WriteLine("AfterRedisGetforFilter " + e.Message); } }
public override void AfterRedisGet(RedisClient Redis, IServiceClient client) { try { this.FilterDialog = Redis.Get <EbFilterDialog>(this.Filter_Dialogue); if (this.FilterDialog == null && this.Filter_Dialogue != "") { var result = client.Get <EbObjectParticularVersionResponse>(new EbObjectParticularVersionRequest { RefId = this.Filter_Dialogue }); this.FilterDialog = EbSerializers.Json_Deserialize(result.Data[0].Json); Redis.Set <EbFilterDialog>(this.Filter_Dialogue, this.FilterDialog); } } catch (Exception e) { Console.WriteLine("Exception:" + e.ToString()); } }
public void InitFromDataBase(JsonServiceClient ServiceClient) { string _html = string.Empty; string ebQuestionsHtml = @"<div id='cont_@ebsid@' ebsid='@ebsid@' class='Eb-Question-Ctrl' Ctype=''>"; //this.Options = new List<EbSimpleSelectOption>(); GetRenderQuestionResponse result = ServiceClient.Get <GetRenderQuestionResponse>(new GetRenderQuestionsRequest { FormRefid = this.RefId, ControlId = this.ContextId }); //this.Questions.Add() foreach (GetRenderQuestions question in result.GetRenderQuestions) { this.Controls.Add(EbSerializers.Json_Deserialize <EbQuestion>(question.Questions)); EbQuestion ebQuestion = EbSerializers.Json_Deserialize <EbQuestion>(question.Questions.ToString()); ebQuestionsHtml += ebQuestion.GetHtml(); } ebQuestionsHtml = ebQuestionsHtml.Replace("@body@", _html).Replace("@name@", this.Name).Replace("@ebsid@", this.EbSid_CtxId); this.QuestionStr = ebQuestionsHtml + "</div>"; }
public async Task <IViewComponentResult> InvokeAsync(string dvobjt, string dvRefId) { var dvobj = EbSerializers.Json_Deserialize(dvobjt); ViewBag.ServiceUrl = this.ServiceClient.BaseUri; if (dvobj != null) { //if (!string.IsNullOrEmpty(dvRefId)) //{ // var dvObject = (ViewBag.wc == "dc") ? this.Redis.Get<EbDataVisualization>(dvRefId) : this.Redis.Get<EbDataVisualization>(dvRefId + ViewBag.UId); // if (dvObject == null) // dvObject = this.Redis.Get<EbDataVisualization>(dvRefId); // dvObject.AfterRedisGet(this.Redis); // ViewBag.data = dvObject; //} //else ViewBag.data = getDVObject(dvobj); } //ViewBag.Meta = Meta.Replace("\\r\\n", string.Empty); ViewBag.dvRefId = dvRefId; return(View()); }
public EbObjectRunSqlFunctionResponse Post(EbObjectRunSqlFunctionRequest request) { ILog log = LogManager.GetLogger(GetType()); log.Info("#DS insert -- entered post"); using (var con = this.TenantDbFactory.ObjectsDB.GetNewConnection()) { con.Open(); DbCommand cmd = null; log.Info("#DS insert 1 -- con open"); string[] arr = { }; var code = EbSerializers.Json_Deserialize <EbSqlFunction>(request.Json).Sql; cmd = this.TenantDbFactory.ObjectsDB.GetNewCommand(con, code); string refId = cmd.ExecuteScalar().ToString(); return(new EbObjectRunSqlFunctionResponse() { RefId = refId }); }; }
public string CommitEbObject(string _refid, string _json, string _changeLog, string _rel_obj, string _tags, int _appid) { string refid; var obj = EbSerializers.Json_Deserialize(_json); if (string.IsNullOrEmpty(_refid)) { var ds = new EbObject_Create_New_ObjectRequest(); ds.Name = obj.Name; ds.Description = obj.Description; ds.Json = _json; ds.Status = ObjectLifeCycleStatus.Dev; ds.Relations = _rel_obj; ds.IsSave = false; ds.Tags = _tags; ds.AppId = _appid; var res = ServiceClient.Post <EbObject_Create_New_ObjectResponse>(ds); refid = res.RefId; } else { var ds = new EbObject_CommitRequest(); ds.Name = obj.Name; ds.Description = obj.Description; ds.Json = _json; ds.Relations = _rel_obj; ds.RefId = _refid; ds.ChangeLog = _changeLog; ds.Tags = _tags; ds.AppId = _appid; var res = ServiceClient.Post <EbObject_CommitResponse>(ds); refid = res.RefId; } return(refid); }