Esempio n. 1
0
        public string SaveFormBuilder()
        {
            var    req = this.HttpContext.Request.Form;
            string refid;

            if (string.IsNullOrEmpty(req["id"]))
            {
                var ds = new EbObject_Create_New_ObjectRequest();
                ds.EbObjectType = Convert.ToInt32(req["obj_type"]);
                ds.Name         = req["name"];
                ds.Description  = req["description"];
                ds.Json         = req["filterdialogjson"];
                ds.Status       = ObjectLifeCycleStatus.Dev;
                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        = req["Id"];
                ds.Name         = req["Name"];
                ds.Description  = req["Description"];
                ds.EbObjectType = Convert.ToInt32(req["obj_type"]);
                ds.Json         = req["filterdialogjson"];
                ds.Relations    = "";
                ViewBag.IsNew   = "false";
                var res = this.ServiceClient.Post <EbObject_SaveResponse>(ds);
                refid = res.RefId;
            }
            return(refid);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
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
            });
        }
Esempio n. 5
0
        public string CommitFormBuilder()
        {
            var    req = this.HttpContext.Request.Form;
            string refid;

            if (string.IsNullOrEmpty(req["id"]))
            {
                var ds = new EbObject_Create_New_ObjectRequest();
                ds.EbObjectType = Convert.ToInt32(req["obj_type"]);
                ds.Name         = req["name"];
                ds.Description  = req["description"];
                ds.Json         = req["filterdialogjson"];
                //if (ds.EbObjectType == 0)
                //   ds.EbObject = EbSerializers.Json_Deserialize<EbForm>(req["filterdialogjson"]);
                //else if (ds.EbObjectType == 12)
                //{
                //    ds.EbObject = EbSerializers.Json_Deserialize<EbFilterDialog>(req["filterdialogjson"]);
                //    (ds.EbObject as EbFilterDialog).EbObjectType = EbObjectType.WebForm;
                //}

                //(ds.EbObject as EbFilterDialog).EbObjectType = EbObjectType.FilterDialog;
                ds.Status    = ObjectLifeCycleStatus.Dev;
                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 = Convert.ToInt32(req["obj_type"]);
                ds.Name         = req["name"];
                ds.Description  = req["description"];
                ds.Json         = req["filterdialogjson"];
                ds.Relations    = "";
                ds.RefId        = req["id"];
                ds.ChangeLog    = "";
                var res = ServiceClient.Post <EbObject_CommitResponse>(ds);
                refid = res.RefId;
            }

            return(refid);
        }
Esempio n. 6
0
        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);
        }