예제 #1
0
        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);
        }
예제 #2
0
        public EbObject_Create_Patch_VersionResponse Post(EbObject_Create_Patch_VersionRequest request)
        {
            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_patch_version(@id, @obj_type, @commit_uid, @src_pid, @cur_pid, @relations)";
                    cmd = this.TenantDbFactory.ObjectsDB.GetNewCommand(con, sql);

                    cmd.Parameters.Add(this.TenantDbFactory.ObjectsDB.GetNewParameter("@id", System.Data.DbType.String, request.RefId));
                    cmd.Parameters.Add(this.TenantDbFactory.ObjectsDB.GetNewParameter("@obj_type", System.Data.DbType.Int32, (int)request.EbObjectType));
                    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));

                    refId = cmd.ExecuteScalar().ToString();
                }
            }
            catch (Exception e)
            {
            }
            return(new EbObject_Create_Patch_VersionResponse()
            {
                RefId = refId
            });
        }