예제 #1
0
        //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 }));
        }
예제 #2
0
        //public object GetObjectAndPermission(string roleId, int appId)
        //{
        //	var fr = this.ServiceClient.Get<GetObjectAndPermissionResponse>(new GetObjectAndPermissionRequest { RoleId = Convert.ToInt32(roleId), AppId = appId });
        //	return JsonConvert.SerializeObject(fr);
        //}

        //GET  PERMISSION OPERATIONS AS JS
        private string GetPermissionOperationsAsJs()
        {
            Assembly assembly = Assembly.GetAssembly(typeof(EbWebForm));             //DO NOT CHANGE
            List <Eb_ObjectTypeOperations> _listObj = new List <Eb_ObjectTypeOperations>();

            foreach (var ObjectType in Enum.GetValues(typeof(EbObjectTypesUI)))
            {
                string sObjectType = ObjectType.ToString();
                int    sIntObj     = (int)ObjectType;
                var    eOperations = assembly.GetType(string.Format("ExpressBase.Objects.{0}+Operations", sObjectType));
                if (eOperations != null)
                {
                    Eb_ObjectTypeOperations _obj = new Eb_ObjectTypeOperations()
                    {
                        Op_Id = sIntObj, Op_Name = sObjectType, Operations = new List <string>()
                    };
                    foreach (var Op in Enum.GetValues(eOperations))
                    {
                        _obj.Operations.Add(Op.ToString());
                    }
                    _listObj.Add(_obj);
                }
            }
            return(EbSerializers.Json_Serialize(_listObj));
        }
 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);
             }
         }
     }
 }
예제 #4
0
        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 Dictionary <string, string> SendSMS(string To, string Body)
        {
            Dictionary <string, string> msgStatus = null;

            try
            {
                Data["msg"] = Body;
                Data["to"]  = To;
                var    response         = Client.UploadValues(Unifonic_base_url, "POST", Data);
                string responseInString = Encoding.UTF8.GetString(response);
                Console.WriteLine(responseInString);
                if (response != null)
                {
                    msgStatus = new Dictionary <string, string> {
                        { "To", To },
                        { "From", Config.From },
                        { "Uri", url },
                        { "Body", Body },
                        { "ErrorMessage", "" },
                        { "ConId", Config.Id.ToString() },
                        { "Result", responseInString }
                    };
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception:" + e.ToString());
                msgStatus.Add("ErrorMessage", e.ToString());
            }
            Console.WriteLine(" --- SMS msg" + EbSerializers.Json_Serialize(msgStatus));
            return(msgStatus);
        }
예제 #6
0
        //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);
        }
예제 #7
0
        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());
        }
예제 #8
0
        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);
        }
예제 #9
0
        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 Dictionary <string, string> SendSMS(string To, string body)
        {
            Dictionary <string, string> msgStatus = null;
            string result;

            try
            {
                body += " -" + Config.BrandName;
                var status = string.Empty;
                IEnumerable <string> matches = Regex.Matches(To, @"[1-9]").OfType <Match>()
                                               .Select(m => m.Groups[0].Value)
                                               .Distinct();
                if (matches.Count() > 0)
                {
                    string msg = HttpUtility.UrlEncode(body);
                    using (var wb = new WebClient())
                    {
                        byte[] response = wb.UploadValues("https://api.textlocal.in/send/", new NameValueCollection()
                        {
                            { "apikey", Config.ApiKey },
                            { "numbers", To },
                            { "message", msg },
                            { "sender", Config.From }
                            // {"test" , "1"}
                        });
                        result = System.Text.Encoding.UTF8.GetString(response);
                    }
                    status = JsonConvert.DeserializeObject <Dictionary <string, dynamic> >(result)["status"];
                }
                else
                {
                    status = "FAILED";
                    result = "'To' is not a Valid number.";
                }
                msgStatus = new Dictionary <string, string>
                {
                    { "ApiKey", Config.ApiKey },
                    { "To", To },
                    { "From", Config.From },
                    { "Body", body },
                    { "ConId", Config.Id.ToString() },
                    { "Status", status },
                    { "Result", result }
                };
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception:" + e.Message);
                if (!(msgStatus is null))
                {
                    msgStatus.Add("ErrorMessage", e.Message);
                }
            }
            Console.WriteLine(" --- SMS msg" + EbSerializers.Json_Serialize(msgStatus));
            return(msgStatus);
        }
예제 #11
0
        public EbMobilePage GetSignUpPage()
        {
            if (string.IsNullOrEmpty(SignUpPage))
            {
                return(null);
            }
            string regexed = EbSerializers.JsonToNETSTD(SignUpPage);

            return(EbSerializers.Json_Deserialize <EbMobilePage>(regexed));
        }
예제 #12
0
        private string Get_EbObjTypesStr()
        {
            Dictionary <string, int> _dic = new Dictionary <string, int>();

            foreach (Structures.EbObjectType objectType in Structures.EbObjectTypes.Enumerator)
            {
                _dic.Add(objectType.Name, objectType.IntCode);
            }

            return(EbSerializers.Json_Serialize(_dic));
        }
예제 #13
0
        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);
        }
예제 #14
0
        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);
        }
예제 #15
0
        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());
 }
예제 #17
0
        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());
        }
예제 #18
0
        private string Get_EbObjTypesStr()
        {
            Dictionary <string, int> _dic = new Dictionary <string, int>();

            foreach (string enumString in Enum.GetNames(typeof(EbObjectType)))
            {
                EbObjectType _type;
                Enum.TryParse(enumString, out _type);
                _dic.Add(enumString, (int)_type);
            }

            return(EbSerializers.Json_Serialize(_dic));
        }
예제 #19
0
 public void InitializeConfig()
 {
     try
     {
         EbBuildConfig conf = EbSerializers.DeserializeJsonFile <EbBuildConfig>("Configuration.Config.json");
         Vendor = conf.Current;
         HelperFunctions.SetResourceValue("Primary_Color", Vendor.GetPrimaryColor());
         HelperFunctions.SetResourceValue("Primary_FontColor", Vendor.GetPrimaryFontColor());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
        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"));
        }
예제 #21
0
        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);
        }
예제 #22
0
        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);
        }
예제 #23
0
        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));
        }
예제 #24
0
        //[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 }));
            }
        }
예제 #25
0
        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);
        }
예제 #27
0
        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);
        }
        private void TreeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            var node = e.Node;

            if (node != null)
            {
                int id = Convert.ToInt32(node.Tag);

                IServiceClient client = new JsonServiceClient(CacheHelper.SERVICESTACK_URL).WithCache();
                var            fr     = client.Get <EbObjectResponse>(new EbObjectRequest()
                {
                    Id = id, Token = MainForm.JwtToken
                });

                var _formEbObject = EbSerializers.ProtoBuf_DeSerialize <EbObject>(fr.Data[0].Bytea);
                _formEbObject.EbObjectType = fr.Data[0].EbObjectType;
                _formEbObject.Name         = fr.Data[0].Name;
                _formEbObject.Id           = fr.Data[0].Id;

                if (_formEbObject.EbObjectType == EbObjectType.Form)
                {
                    var  _form_name = string.Format("form_{0}", id);
                    Form fc         = Application.OpenForms[_form_name];
                    if (fc == null)
                    {
                        FormDesignerForm pD = new FormDesignerForm(this.MainForm, StudioFormTypes.Desktop);
                        pD.Name = _form_name;
                        pD.Show(MainForm.DockPanel);
                        var _form = new EbFormControl();
                        _form.EbControlContainer    = _formEbObject as EbControlContainer;
                        _form.EbControlContainer.Id = id;
                        pD.SetEB_Form(_form);
                    }
                    else
                    {
                        fc.Activate();
                    }
                }
                else if (_formEbObject.EbObjectType == EbObjectType.DataSource)
                {
                    SqlStatementEditor ed = new SqlStatementEditor();
                    ed.MainForm = this.MainForm;
                    ed.Set(id, _formEbObject.Name, (_formEbObject as EbDataSource).Sql);
                    ed.Show(MainForm.DockPanel);
                }
            }
        }
예제 #29
0
        private void InitDb(string path)
        {
            EbConfiguration e = new EbConfiguration()
            {
                ClientID   = "xyz0007",
                ClientName = "XYZ Enterprises Ltd.",
                LicenseKey = "00288-22558-25558",
            };

            e.DatabaseConfigurations.Add(EbDatabases.EB_OBJECTS, new EbDatabaseConfiguration(EbDatabases.EB_OBJECTS, DatabaseVendors.PGSQL, "eb_objects", "localhost", 5432, "postgres", "infinity", 500));
            e.DatabaseConfigurations.Add(EbDatabases.EB_DATA, new EbDatabaseConfiguration(EbDatabases.EB_DATA, DatabaseVendors.PGSQL, "eb_objects", "localhost", 5432, "postgres", "infinity", 500));
            e.DatabaseConfigurations.Add(EbDatabases.EB_ATTACHMENTS, new EbDatabaseConfiguration(EbDatabases.EB_ATTACHMENTS, DatabaseVendors.PGSQL, "eb_objects", "localhost", 5432, "postgres", "infinity", 500));
            e.DatabaseConfigurations.Add(EbDatabases.EB_LOGS, new EbDatabaseConfiguration(EbDatabases.EB_LOGS, DatabaseVendors.PGSQL, "eb_objects", "localhost", 5432, "postgres", "infinity", 500));

            byte[] bytea = EbSerializers.ProtoBuf_Serialize(e);
            EbFile.Bytea_ToFile(bytea, path);
        }
예제 #30
0
        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
            });
        }