예제 #1
0
        public static string PrepareCause(CauseObject_MCE_B_ASSETS_FILETEMPLATE cause, out OracleParameter[] parameters)
        {
            //平台自动生成代码
            System.Text.StringBuilder strBuf = new System.Text.StringBuilder();
            ArrayList       paramList        = new ArrayList();
            OracleParameter param            = null;

            #region Push Block
            if (!string.IsNullOrEmpty(cause.COMMENTS))
            {
                strBuf.Append(" And MCE_B_ASSETS_FILETEMPLATE.COMMENTS ").Append((cause.COMMENTS.StartsWith("%") || cause.COMMENTS.EndsWith("%")) ? " like " : " = ").Append(" :C_COMMENTS");
                param = new OracleParameter();
                param.ParameterName = ":C_COMMENTS";
                param.OracleType    = System.Data.OracleClient.OracleType.VarChar;
                param.Size          = 200;
                param.Value         = cause.COMMENTS;
                paramList.Add(param);
            }
            if (cause.HasINValue("COMMENTS"))
            {
                strBuf.Append(cause.GetINSQL("MCE_B_ASSETS_FILETEMPLATE", "COMMENTS"));
            }
            if (!string.IsNullOrEmpty(cause.ID))
            {
                strBuf.Append(" And MCE_B_ASSETS_FILETEMPLATE.ID ").Append((cause.ID.StartsWith("%") || cause.ID.EndsWith("%")) ? " like " : " = ").Append(" :C_ID");
                param = new OracleParameter();
                param.ParameterName = ":C_ID";
                param.OracleType    = System.Data.OracleClient.OracleType.Char;
                param.Size          = 36;
                param.Value         = cause.ID;
                paramList.Add(param);
            }
            if (cause.HasINValue("ID"))
            {
                strBuf.Append(cause.GetINSQL("MCE_B_ASSETS_FILETEMPLATE", "ID"));
            }
            if (!string.IsNullOrEmpty(cause.NAME))
            {
                strBuf.Append(" And MCE_B_ASSETS_FILETEMPLATE.NAME ").Append((cause.NAME.StartsWith("%") || cause.NAME.EndsWith("%")) ? " like " : " = ").Append(" :C_NAME");
                param = new OracleParameter();
                param.ParameterName = ":C_NAME";
                param.OracleType    = System.Data.OracleClient.OracleType.VarChar;
                param.Size          = 100;
                param.Value         = cause.NAME;
                paramList.Add(param);
            }
            if (cause.HasINValue("NAME"))
            {
                strBuf.Append(cause.GetINSQL("MCE_B_ASSETS_FILETEMPLATE", "NAME"));
            }
            if (!string.IsNullOrEmpty(cause.GetCustomCondition()))
            {
                strBuf.Append(cause.GetCustomCondition());
            }
            #endregion
            parameters = new OracleParameter[paramList.Count];
            paramList.CopyTo(parameters);
            return(strBuf.ToString());
        }
예제 #2
0
 public static int Delete(CauseObject_MCE_B_ASSETS_FILETEMPLATE cause, IDbTransaction trans)
 {
     //平台自动生成代码
     #region Parameters Block
     OracleParameter[] parameters = null;
     #endregion
     string sSql = "delete from MCE_B_ASSETS_FILETEMPLATE where (1=1)";
     sSql += PrepareCause(cause, out parameters);
     return(IDALProvider.IDAL.ExecuteNonQuery(sSql, parameters, trans));
 }
예제 #3
0
 public int DeleteByTrans2(CauseObject_MCE_B_ASSETS_FILETEMPLATE cause, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         return(HelperObject_MCE_B_ASSETS_FILETEMPLATE.Delete(cause, transaction));
         //平台自动生成代码
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
예제 #4
0
 public static int Update(EntityObject_MCE_B_ASSETS_FILETEMPLATE obj, CauseObject_MCE_B_ASSETS_FILETEMPLATE cause, IDbTransaction trans)
 {
     //平台自动生成代码
     #region Parameters Block
     List <OracleParameter> list       = new List <OracleParameter>();
     OracleParameter[]      parameters = null;
     #endregion
     string sSql = "update MCE_B_ASSETS_FILETEMPLATE set ";
     sSql += PrepareUpdate(obj, out parameters, false);
     list.AddRange(parameters);
     sSql += " where 1=1 ";
     sSql += PrepareCause(cause, out parameters);
     list.AddRange(parameters);
     parameters = list.ToArray();
     return(IDALProvider.IDAL.ExecuteNonQuery(sSql, parameters, trans));
 }
예제 #5
0
        public DisplayObject_MCE_B_ASSETS_FILETEMPLATE[] Query(CauseObject_MCE_B_ASSETS_FILETEMPLATE cause, PagingParamter paging, OrderByParameter order)
        {
            if (LocalMode)
            {
                SystemLogic.Proxy.AuditQuery(cause);

                //平台自动生成代码
                return(HelperObject_MCE_B_ASSETS_FILETEMPLATE.Query(cause, paging, order));
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_ASSETS_FILETEMPLATE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_FILETEMPLATE>(ServiceUri))
                {
                    return(smgr.Service.Query(cause, paging, order));
                }
            }
        }
예제 #6
0
 public static DisplayObject_MCE_B_ASSETS_FILETEMPLATE[] Query(CauseObject_MCE_B_ASSETS_FILETEMPLATE cause)
 {
     //平台自动生成代码
     #region Parameters Block
     OracleParameter[] parameters = null;
     #endregion
     string sSql = " select  MCE_B_ASSETS_FILETEMPLATE.COMMENTS, MCE_B_ASSETS_FILETEMPLATE.ID, MCE_B_ASSETS_FILETEMPLATE.NAME from MCE_B_ASSETS_FILETEMPLATE where (1=1)";
     sSql += PrepareCause(cause, out parameters);
     if (cause.Recursion != null && !string.IsNullOrEmpty(cause.Recursion.RecursionFieldValue))
     {
         sSql = "select t.* from (" + sSql + ") t,( select t." + cause.Recursion.TargetKeyFieldName + " from " + cause.Recursion.TargetDataObjectName + " t start with t." + cause.Recursion.TargetKeyFieldName + " = '" + cause.Recursion.RecursionFieldValue + "' connect by  t." + cause.Recursion.TargetLevelFieldName + "  = PRIOR t." + cause.Recursion.TargetKeyFieldName + "  ) t1 where t." + cause.Recursion.RecursionFieldName + " = t1." + cause.Recursion.TargetKeyFieldName;
     }
     #region Push Block
     DisplayObject_MCE_B_ASSETS_FILETEMPLATE dataObj = null;
     ArrayList     objArray   = new ArrayList();
     IDbConnection connection = IDALProvider.IDAL.PopConnection();
     IDataReader   sqlReader  = IDALProvider.IDAL.ExecuteReader(sSql, parameters, connection);
     while (sqlReader.Read())
     {
         dataObj = new DisplayObject_MCE_B_ASSETS_FILETEMPLATE();
         if (!sqlReader.IsDBNull(0))
         {
             dataObj.COMMENTS = sqlReader.GetString(0);
         }
         if (!sqlReader.IsDBNull(1))
         {
             dataObj.ID = sqlReader.GetString(1);
         }
         if (!sqlReader.IsDBNull(2))
         {
             dataObj.NAME = sqlReader.GetString(2);
         }
         objArray.Add(dataObj);
     }
     sqlReader.Close();
     IDALProvider.IDAL.PushConnection(connection);
     #endregion
     DisplayObject_MCE_B_ASSETS_FILETEMPLATE[] objs = new DisplayObject_MCE_B_ASSETS_FILETEMPLATE[objArray.Count];
     objArray.CopyTo(0, objs, 0, objs.Length);
     return(objs);
 }
예제 #7
0
 public BizLogicMsg Delete(CauseObject_MCE_B_ASSETS_FILETEMPLATE cause)
 {
     if (LocalMode)
     {
         BizLogicMsg msg = new BizLogicMsg();
         using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
         {
             using (IDbTransaction transaction = connection.BeginTransaction())
             {
                 try
                 {
                     int amount = HelperObject_MCE_B_ASSETS_FILETEMPLATE.Delete(cause, transaction);
                     //平台自动生成代码
                     transaction.Commit();
                 }
                 catch (Exception expt)
                 {
                     transaction.Rollback();
                     msg = new BizLogicMsg(false, expt.Message);
                     Error(expt);
                 }
                 finally
                 {
                     IDALProvider.IDAL.PushConnection(connection);
                 }
             }
         }
         return(msg);
     }
     else
     {
         using (ServiceManager <ServiceContract_MCE_B_ASSETS_FILETEMPLATE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_FILETEMPLATE>(ServiceUri))
         {
             return(smgr.Service.Delete(cause));
         }
     }
 }
예제 #8
0
 public static DisplayObject_MCE_B_ASSETS_FILETEMPLATE[] Query(CauseObject_MCE_B_ASSETS_FILETEMPLATE cause, PagingParamter paging, OrderByParameter order, IDbTransaction trans)
 {
     //平台自动生成代码
     #region Parameters Block
     OracleParameter[] parameters = null;
     IDataReader       sqlReader  = null;
     #endregion
     string sSql      = " select  MCE_B_ASSETS_FILETEMPLATE.COMMENTS, MCE_B_ASSETS_FILETEMPLATE.ID, MCE_B_ASSETS_FILETEMPLATE.NAME from MCE_B_ASSETS_FILETEMPLATE where (1=1)";
     string sCauseSql = PrepareCause(cause, out parameters);
     sSql += sCauseSql;
     if (cause.Recursion != null && !string.IsNullOrEmpty(cause.Recursion.RecursionFieldValue))
     {
         sSql = "select t.* from (" + sSql + ") t,( select t." + cause.Recursion.TargetKeyFieldName + " from " + cause.Recursion.TargetDataObjectName + " t start with t." + cause.Recursion.TargetKeyFieldName + " = '" + cause.Recursion.RecursionFieldValue + "' connect by  t." + cause.Recursion.TargetLevelFieldName + "  = PRIOR t." + cause.Recursion.TargetKeyFieldName + "  ) t1 where t." + cause.Recursion.RecursionFieldName + " = t1." + cause.Recursion.TargetKeyFieldName;
     }
     #region Push Block
     if (paging != null)
     {
         string countSql = string.Empty;
         if (cause.Recursion != null && !string.IsNullOrEmpty(cause.Recursion.RecursionFieldValue))
         {
             countSql = "Select Count(*) From (" + sSql + ") t";
         }
         else
         {
             countSql = "Select Count(*) From (" + sSql + ") t";
         }
         if (paging.TotalRecords == 0)
         {
             paging.TotalRecords = IDALProvider.IDAL.DatabaseType == Ipedf.Common.DatabaseType.SqlServer || IDALProvider.IDAL.DatabaseType == Ipedf.Common.DatabaseType.Db2? (int)IDALProvider.IDAL.ExecuteScalar(countSql, parameters, trans) : (int)(decimal)IDALProvider.IDAL.ExecuteScalar(countSql, parameters, trans);
         }
         sqlReader = IDALProvider.IDAL.ExecutePagingReader("MCE_B_ASSETS_FILETEMPLATE", paging, order, sSql, parameters, trans);
     }
     else if (order != null)
     {
         sSql     += order.ToString();
         sqlReader = IDALProvider.IDAL.ExecuteReader(sSql, parameters, trans);
     }
     else
     {
         sqlReader = IDALProvider.IDAL.ExecuteReader(sSql, parameters, trans);
     }
     DisplayObject_MCE_B_ASSETS_FILETEMPLATE dataObj = null;
     ArrayList objArray = new ArrayList();
     while (sqlReader.Read())
     {
         dataObj = new DisplayObject_MCE_B_ASSETS_FILETEMPLATE();
         if (!sqlReader.IsDBNull(0))
         {
             dataObj.COMMENTS = sqlReader.GetString(0);
         }
         if (!sqlReader.IsDBNull(1))
         {
             dataObj.ID = sqlReader.GetString(1);
         }
         if (!sqlReader.IsDBNull(2))
         {
             dataObj.NAME = sqlReader.GetString(2);
         }
         objArray.Add(dataObj);
     }
     sqlReader.Close();
     #endregion
     DisplayObject_MCE_B_ASSETS_FILETEMPLATE[] objs = new DisplayObject_MCE_B_ASSETS_FILETEMPLATE[objArray.Count];
     objArray.CopyTo(0, objs, 0, objs.Length);
     return(objs);
 }
예제 #9
0
        public void ProcessRequest(HttpContext context)
        {
            //允许跨域
            context.Response.AddHeader("Access-Control-Allow-Origin", "*");
            JSON_MSG jsonMsg = new JSON_MSG();

            try
            {
                context.Response.ContentType = "text/plain";
                HttpRequest request = context.Request;


                OrderByParameter orderBy = new OrderByParameter();
                orderBy.Asc     = true;
                orderBy.OrderBy = "NAME";

                PagingParamter pager = new PagingParamter();
                pager.PageSize  = string.IsNullOrEmpty(request["limit"]) ? 10 : int.Parse(request["limit"].ToString());
                pager.PageIndex = string.IsNullOrEmpty(request["offset"]) ? 0 : (int.Parse(request["offset"].ToString()) <= 0) ? 0 : int.Parse(request["offset"].ToString()) - 1;


                CauseObject_MCE_B_ASSETS_FILETEMPLATE p = new CauseObject_MCE_B_ASSETS_FILETEMPLATE();

                StringBuilder strCondition = new StringBuilder();
                if (!string.IsNullOrEmpty(request["condition"]))//条件
                {
                    strCondition.Append(" and (MCE_B_ASSETS_FILETEMPLATE.name like '%" + request["condition"].ToString().Trim() + "%' or MCE_B_ASSETS_FILETEMPLATE.comments like '%" + request["condition"].ToString().Trim() + "%')");
                }

                if (!string.IsNullOrEmpty(strCondition.ToString()))
                {
                    p.SetCustomCondition(strCondition.ToString());
                }

                DisplayObject_MCE_B_ASSETS_FILETEMPLATE[] list = BizLogicObject_MCE_B_ASSETS_FILETEMPLATE.Proxy.Query(p, pager, orderBy);


                JSON_PAGER jsonPager = new JSON_PAGER();
                ;
                jsonPager.total = pager.TotalRecords;
                jsonPager.rows  = list;
                jsonMsg.Succeed = 1;
                jsonMsg.Message = jsonPager;
            }
            catch (Exception ex)
            {
                jsonMsg.Succeed = 0;
                jsonMsg.Message = ex.Message;
            }
            finally
            {
                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter {
                    DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm"
                };

                string strMsg = JsonConvert.SerializeObject(jsonMsg, Formatting.Indented, timeConverter);
                strMsg = strMsg.Replace("0001-01-01 00:00", "");
                context.Response.Write(strMsg);

                context.Response.End();
            }
        }