public DisplayObject_MCE_B_AOG_D[] Query(CauseObject_MCE_B_AOG_D cause, PagingParamter paging, OrderByParameter order)
        {
            if (LocalMode)
            {
                SystemLogic.Proxy.AuditQuery(cause);

                //平台自动生成代码
                return(HelperObject_MCE_B_AOG_D.Query(cause, paging, order));
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_AOG_D> smgr = new ServiceManager <ServiceContract_MCE_B_AOG_D>(ServiceUri))
                {
                    return(smgr.Service.Query(cause, paging, order));
                }
            }
        }
Пример #2
0
 public static DisplayObject_MCE_B_ASSETS_CHECK_TYPE[] Query(CauseObject_MCE_B_ASSETS_CHECK_TYPE cause, PagingParamter paging, OrderByParameter order, IDbTransaction trans)
 {
     //平台自动生成代码
     #region Parameters Block
     OracleParameter[] parameters = null;
     IDataReader       sqlReader  = null;
     #endregion
     string sSql      = " select  MCE_B_ASSETS_CHECK_TYPE.TYPE_ID, MCE_B_ASSETS_CHECK_TYPE.BASE_ID, MCE_B_ASSETS_CHECK_TYPE.ID, MCE_D_MCE_TYPE_TYPE_ID.NAME as TYPE_ID_NAME from MCE_B_ASSETS_CHECK_TYPE left join MCE_D_MCE_TYPE   MCE_D_MCE_TYPE_TYPE_ID on MCE_B_ASSETS_CHECK_TYPE.TYPE_ID = MCE_D_MCE_TYPE_TYPE_ID.ID 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_CHECK_TYPE", 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_CHECK_TYPE dataObj = null;
     ArrayList objArray = new ArrayList();
     while (sqlReader.Read())
     {
         dataObj = new DisplayObject_MCE_B_ASSETS_CHECK_TYPE();
         if (!sqlReader.IsDBNull(0))
         {
             dataObj.TYPE_ID = sqlReader.GetString(0);
         }
         if (!sqlReader.IsDBNull(1))
         {
             dataObj.BASE_ID = sqlReader.GetString(1);
         }
         if (!sqlReader.IsDBNull(2))
         {
             dataObj.ID = sqlReader.GetString(2);
         }
         if (!sqlReader.IsDBNull(3))
         {
             dataObj.TYPE_ID_NAME = sqlReader.GetString(3);
         }
         objArray.Add(dataObj);
     }
     sqlReader.Close();
     #endregion
     DisplayObject_MCE_B_ASSETS_CHECK_TYPE[] objs = new DisplayObject_MCE_B_ASSETS_CHECK_TYPE[objArray.Count];
     objArray.CopyTo(0, objs, 0, objs.Length);
     return(objs);
 }
        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     = false;
                orderBy.OrderBy = "CODE";

                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_METER p = new CauseObject_MCE_B_ASSETS_METER();

                if (!string.IsNullOrEmpty(request["status"]))
                {
                    p.STATE = int.Parse(request["status"].ToString());
                }


                if (!string.IsNullOrEmpty(request["dept"]))
                {
                    p.USING_DEPT_ID = request["dept"].ToString();
                }


                if (!string.IsNullOrEmpty(request["asset"]))
                {
                    p.ASSETS_ID = request["asset"].ToString();
                }


                if (!string.IsNullOrEmpty(request["meter_type"]))
                {
                    p.METER_TYPE = request["meter_type"].ToString();
                }

                if (!string.IsNullOrEmpty(request["code"]))
                {
                    p.CODE = "%" + request["code"].ToString() + "%";
                }

                if (!string.IsNullOrEmpty(request["beginspan"]))
                {
                    p.NEXT_IDENTIFICATION       = new DateSpan();
                    p.NEXT_IDENTIFICATION.Begin = DateTime.Parse(request["beginspan"].ToString());
                }
                if (!string.IsNullOrEmpty(request["endspan"]))
                {
                    if (p.NEXT_IDENTIFICATION == null)
                    {
                        p.NEXT_IDENTIFICATION = new DateSpan();
                    }
                    p.NEXT_IDENTIFICATION.End = DateTime.Parse(request["endspan"].ToString());
                }


                DisplayObject_MCE_B_ASSETS_METER[] list = BizLogicObject_MCE_B_ASSETS_METER.Proxy.Query(p, pager, orderBy);



                JSON_PAGER jsonPager = new JSON_PAGER();

                jsonPager.total = pager.TotalRecords;
                jsonPager.rows  = list;

                jsonMsg.Message = jsonPager;
                jsonMsg.Succeed = 1;
            }
            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();
            }
        }
Пример #4
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 = "CODE";

                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_METER_TYPE p = new CauseObject_MCE_B_ASSETS_METER_TYPE();

                if (!string.IsNullOrEmpty(request["status"]))
                {
                    p.STATE = int.Parse(request["status"].ToString());
                }

                if (!string.IsNullOrEmpty(request["condition"]))
                {
                    string strCondition = " and (MCE_B_ASSETS_METER_TYPE.code like '%" + request["condition"] + "%' or MCE_B_ASSETS_METER_TYPE.name like '%" + request["condition"] + "%' )";
                    p.SetCustomCondition(strCondition);
                }
                else
                {
                    if (!string.IsNullOrEmpty(request["code"]))
                    {
                        p.CODE = "%" + request["code"].ToString() + "%";
                    }
                    if (!string.IsNullOrEmpty(request["name"]))
                    {
                        p.NAME = "%" + request["name"].ToString() + "%";
                    }
                }

                DisplayObject_MCE_B_ASSETS_METER_TYPE[] list = BizLogicObject_MCE_B_ASSETS_METER_TYPE.Proxy.Query(p, pager, orderBy);



                JSON_PAGER jsonPager = new JSON_PAGER();

                jsonPager.total = pager.TotalRecords;
                jsonPager.rows  = list;

                jsonMsg.Message = jsonPager;
                jsonMsg.Succeed = 1;
            }
            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();
            }
        }
        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 = "CODE, 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;
                StringBuilder strCondition = new StringBuilder();
                strCondition.Append(" and MDM_D_STOCK.STOCK_TYPE_ID = '00320003' ");


                List <JsonMtrPurStock>  list  = new System.Collections.Generic.List <JsonMtrPurStock>();
                CauseObject_MDM_D_STOCK cause = new CauseObject_MDM_D_STOCK();
                if (!string.IsNullOrEmpty(request["area"]))
                {
                    cause.DEPT_ID = request["area"].ToString().Trim();
                }
                if (!string.IsNullOrEmpty(request["is_area"]) && request["is_area"].ToString().Trim() == "1")
                {
                    cause.DEPT_ID = BizLogicObject_MTR_D_MTR.Proxy.getAreaByDept(SystemLogic.Proxy.CurrentUser.DEPART_ID.Trim());
                }
                if (!string.IsNullOrEmpty(request["condition"]))
                {
                    strCondition.Append(string.Format(" and (upper(MDM_D_STOCK.CODE) like upper('%{0}%') or upper(MDM_D_STOCK.NAME) like upper('%{0}%')) ", request["condition"].ToString().Trim()));
                }
                cause.SetCustomCondition(strCondition.ToString());
                DisplayObject_MDM_D_STOCK[] stocks = BizLogicObject_MDM_D_STOCK.Proxy.Query(cause, pager, orderBy);
                foreach (DisplayObject_MDM_D_STOCK item in stocks)
                {
                    JsonMtrPurStock tmp = new JsonMtrPurStock();
                    tmp.id       = item.ID.Trim();
                    tmp.code     = item.CODE;
                    tmp.name     = item.NAME;
                    tmp.dept     = item.DEPT_ID.Trim();
                    tmp.deptName = item.DEPT_ID_NAME;
                    list.Add(tmp);
                }
                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
            {
                context.Response.Write(JsonConvert.SerializeObject(jsonMsg));
                context.Response.End();
            }
        }
        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 = "CODE,PERIODS";

                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_V_MCE_QUERY_CONTRACT_PAY p = new CauseObject_V_MCE_QUERY_CONTRACT_PAY();
                p.H_STATE        = 3;
                p.CONTRACT_STATE = 1;

                if (!string.IsNullOrEmpty(request["status"]))
                {
                    p.STATE = int.Parse(request["status"].ToString());
                }

                if (!string.IsNullOrEmpty(request["contract_status"]))
                {
                    p.CONTRACT_STATE = int.Parse(request["contract_status"].ToString());
                }

                if (!string.IsNullOrEmpty(request["dept"]))
                {
                    p.SECOND_PARTY = request["dept"].ToString();
                }


                if (!string.IsNullOrEmpty(request["code"]))
                {
                    p.CODE = "%" + request["code"].ToString() + "%";
                }

                if (!string.IsNullOrEmpty(request["name"]))
                {
                    p.NAME = "%" + request["name"].ToString() + "%";
                }



                if (!string.IsNullOrEmpty(request["beginspan"]))
                {
                    p.PLAN_PAY_DATE     = new DateSpan();
                    p.PLAN_PAY_DATE.End = DateTime.Parse(request["beginspan"].ToString()).AddDays(1);
                }



                DisplayObject_V_MCE_QUERY_CONTRACT_PAY[] list = BizLogicObject_V_MCE_QUERY_CONTRACT_PAY.Proxy.Query(p, pager, orderBy);



                JSON_PAGER jsonPager = new JSON_PAGER();

                jsonPager.total = pager.TotalRecords;
                jsonPager.rows  = list;

                jsonMsg.Message = jsonPager;
                jsonMsg.Succeed = 1;
            }
            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();
            }
        }
 public static DisplayObject_MCE_B_ASSETS_CONTRACT_PAY[] Query(CauseObject_MCE_B_ASSETS_CONTRACT_PAY cause, PagingParamter paging, OrderByParameter order, IDbTransaction trans)
 {
     //平台自动生成代码
     #region Parameters Block
     OracleParameter[] parameters = null;
     IDataReader       sqlReader  = null;
     #endregion
     string sSql      = " select  MCE_B_ASSETS_CONTRACT_PAY.PERIODS, MCE_B_ASSETS_CONTRACT_PAY.BASE_ID, MCE_B_ASSETS_CONTRACT_PAY.PLAN_PAY_DATE, MCE_B_ASSETS_CONTRACT_PAY.COMMENTS, MCE_B_ASSETS_CONTRACT_PAY.STATE, MCE_B_ASSETS_CONTRACT_PAY.MONEY, MCE_B_ASSETS_CONTRACT_PAY.ID, MCE_B_ASSETS_CONTRACT_PAY.ACTUAL_PAY_DATE, MCE_B_ASSETS_CONTRACT_BASE_ID.NAME as BASE_ID_NAME, (case  when MCE_B_ASSETS_CONTRACT_PAY.STATE = 1 then '已付款' when MCE_B_ASSETS_CONTRACT_PAY.STATE = 2 then '未付款' else '' end ) as STATE_NAME from MCE_B_ASSETS_CONTRACT_PAY left join MCE_B_ASSETS_CONTRACT   MCE_B_ASSETS_CONTRACT_BASE_ID on MCE_B_ASSETS_CONTRACT_PAY.BASE_ID = MCE_B_ASSETS_CONTRACT_BASE_ID.ID 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_CONTRACT_PAY", 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_CONTRACT_PAY dataObj = null;
     ArrayList objArray = new ArrayList();
     while (sqlReader.Read())
     {
         dataObj = new DisplayObject_MCE_B_ASSETS_CONTRACT_PAY();
         if (!sqlReader.IsDBNull(0))
         {
             dataObj.PERIODS = sqlReader.GetDecimal(0);
         }
         if (!sqlReader.IsDBNull(1))
         {
             dataObj.BASE_ID = sqlReader.GetString(1);
         }
         if (!sqlReader.IsDBNull(2))
         {
             dataObj.PLAN_PAY_DATE = sqlReader.GetDateTime(2);
         }
         if (!sqlReader.IsDBNull(3))
         {
             dataObj.COMMENTS = sqlReader.GetString(3);
         }
         if (!sqlReader.IsDBNull(4))
         {
             dataObj.STATE = sqlReader.GetDecimal(4);
         }
         if (!sqlReader.IsDBNull(5))
         {
             dataObj.MONEY = sqlReader.GetDecimal(5);
         }
         if (!sqlReader.IsDBNull(6))
         {
             dataObj.ID = sqlReader.GetString(6);
         }
         if (!sqlReader.IsDBNull(7))
         {
             dataObj.ACTUAL_PAY_DATE = sqlReader.GetDateTime(7);
         }
         if (!sqlReader.IsDBNull(8))
         {
             dataObj.BASE_ID_NAME = sqlReader.GetString(8);
         }
         if (!sqlReader.IsDBNull(9))
         {
             dataObj.STATE_NAME = sqlReader.GetString(9);
         }
         objArray.Add(dataObj);
     }
     sqlReader.Close();
     #endregion
     DisplayObject_MCE_B_ASSETS_CONTRACT_PAY[] objs = new DisplayObject_MCE_B_ASSETS_CONTRACT_PAY[objArray.Count];
     objArray.CopyTo(0, objs, 0, objs.Length);
     return(objs);
 }
 public static DisplayObject_MCE_B_ASSETS_MT_APPLY_EN[] Query(CauseObject_MCE_B_ASSETS_MT_APPLY_EN cause, PagingParamter paging, OrderByParameter order)
 {
     //平台自动生成代码
     #region Parameters Block
     OracleParameter[] parameters = null;
     IDataReader       sqlReader  = null;
     #endregion
     string sSql      = " select  MCE_B_ASSETS_MT_APPLY_EN.ADVISE, MCE_B_ASSETS_MT_APPLY_EN.BASE_ID, MCE_B_ASSETS_MT_APPLY_EN.RESULT, MCE_B_ASSETS_MT_APPLY_EN.COMMENTS, MCE_B_ASSETS_MT_APPLY_EN.USER_ID, MCE_B_ASSETS_MT_APPLY_EN.COMPLETE_TIME, MCE_B_ASSETS_MT_APPLY_EN.ID, MCE_B_ASSETS_MT_APPLY_EN.HOURS, MCE_B_ASSETS_MT_APPLY_EN.IS_CLOSE, MCE_B_ASSETS_MT_APPLY_BASE_ID.CODE as BASE_ID_NAME, COM_USER_USER_ID.NAME as USER_ID_NAME from MCE_B_ASSETS_MT_APPLY_EN left join MCE_B_ASSETS_MT_APPLY   MCE_B_ASSETS_MT_APPLY_BASE_ID on MCE_B_ASSETS_MT_APPLY_EN.BASE_ID = MCE_B_ASSETS_MT_APPLY_BASE_ID.ID left join COM_USER   COM_USER_USER_ID on MCE_B_ASSETS_MT_APPLY_EN.USER_ID = COM_USER_USER_ID.ID 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
     IDbConnection connection = IDALProvider.IDAL.PopConnection();
     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 ? (int)IDALProvider.IDAL.ExecuteScalar(countSql, parameters, connection) : (int)(decimal)IDALProvider.IDAL.ExecuteScalar(countSql, parameters, connection);
         }
         sqlReader = IDALProvider.IDAL.ExecutePagingReader("MCE_B_ASSETS_MT_APPLY_EN", paging, order, sSql, parameters, connection);
     }
     else if (order != null)
     {
         sSql     += order.ToString();
         sqlReader = IDALProvider.IDAL.ExecuteReader(sSql, parameters, connection);
     }
     else
     {
         sqlReader = IDALProvider.IDAL.ExecuteReader(sSql, parameters, connection);
     }
     DisplayObject_MCE_B_ASSETS_MT_APPLY_EN dataObj = null;
     ArrayList objArray = new ArrayList();
     while (sqlReader.Read())
     {
         dataObj = new DisplayObject_MCE_B_ASSETS_MT_APPLY_EN();
         if (!sqlReader.IsDBNull(0))
         {
             dataObj.ADVISE = sqlReader.GetString(0);
         }
         if (!sqlReader.IsDBNull(1))
         {
             dataObj.BASE_ID = sqlReader.GetString(1);
         }
         if (!sqlReader.IsDBNull(2))
         {
             dataObj.RESULT = sqlReader.GetString(2);
         }
         if (!sqlReader.IsDBNull(3))
         {
             dataObj.COMMENTS = sqlReader.GetString(3);
         }
         if (!sqlReader.IsDBNull(4))
         {
             dataObj.USER_ID = sqlReader.GetString(4);
         }
         if (!sqlReader.IsDBNull(5))
         {
             dataObj.COMPLETE_TIME = sqlReader.GetDateTime(5);
         }
         if (!sqlReader.IsDBNull(6))
         {
             dataObj.ID = sqlReader.GetString(6);
         }
         if (!sqlReader.IsDBNull(7))
         {
             dataObj.HOURS = sqlReader.GetDecimal(7);
         }
         if (!sqlReader.IsDBNull(8))
         {
             dataObj.IS_CLOSE = sqlReader.GetDecimal(8);
         }
         if (!sqlReader.IsDBNull(9))
         {
             dataObj.BASE_ID_NAME = sqlReader.GetString(9);
         }
         if (!sqlReader.IsDBNull(10))
         {
             dataObj.USER_ID_NAME = sqlReader.GetString(10);
         }
         objArray.Add(dataObj);
     }
     sqlReader.Close();
     IDALProvider.IDAL.PushConnection(connection);
     #endregion
     DisplayObject_MCE_B_ASSETS_MT_APPLY_EN[] objs = new DisplayObject_MCE_B_ASSETS_MT_APPLY_EN[objArray.Count];
     objArray.CopyTo(0, objs, 0, objs.Length);
     return(objs);
 }
        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     = false;
                orderBy.OrderBy = "CODE";

                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_BACK p = new CauseObject_MCE_B_ASSETS_BACK();

                if (!string.IsNullOrEmpty(request["status"]))
                {
                    p.STATE = int.Parse(request["status"].ToString());
                }


                if (!string.IsNullOrEmpty(request["returndept"]))
                {
                    p.RETURN_DEPT_ID = request["returndept"].ToString();
                }


                if (!string.IsNullOrEmpty(request["returnuser"]))
                {
                    p.RETURN_USER_ID = request["returnuser"].ToString();
                }


                if (!string.IsNullOrEmpty(request["code"]))
                {
                    p.CODE = "%" + request["code"].ToString() + "%";
                }


                if (!string.IsNullOrEmpty(request["prv"]))
                {
                    var prv_ID = request["prv"];
                    p.SetCustomCondition(string.Format(" and MCE_B_ASSETS_BACK.ID in (select d.base_id  from MCE_B_ASSETS_BACK_D d where d.assets_id in (select ID from mce_b_assets s2 where s2.provider_id='{0}'  ))", prv_ID));
                }


                if (!string.IsNullOrEmpty(request["beginspan"]))
                {
                    p.CREATE_DATE       = new DateSpan();
                    p.CREATE_DATE.Begin = DateTime.Parse(request["beginspan"].ToString());
                }
                if (!string.IsNullOrEmpty(request["endspan"]))
                {
                    if (p.CREATE_DATE == null)
                    {
                        p.CREATE_DATE = new DateSpan();
                    }
                    p.CREATE_DATE.End = DateTime.Parse(request["endspan"].ToString());
                }


                DisplayObject_MCE_B_ASSETS_BACK[] list = BizLogicObject_MCE_B_ASSETS_BACK.Proxy.Query(p, pager, orderBy);



                JSON_PAGER jsonPager = new JSON_PAGER();

                jsonPager.total = pager.TotalRecords;
                jsonPager.rows  = list;

                jsonMsg.Message = jsonPager;
                jsonMsg.Succeed = 1;
            }
            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();
            }
        }
Пример #10
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     = false;
                orderBy.OrderBy = "CODE";

                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_PURCHASE p = new CauseObject_MCE_B_ASSETS_PURCHASE();

                p.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;

                if (!string.IsNullOrEmpty(request["status"]))
                {
                    p.STATE = int.Parse(request["status"].ToString());
                }

                if (!string.IsNullOrEmpty(request["dept"]))
                {
                    p.APPLY_DEPT_ID = request["dept"].ToString();
                }

                if (!string.IsNullOrEmpty(request["prv"]))
                {
                    p.PRV_ID = request["prv"].ToString();
                }

                if (!string.IsNullOrEmpty(request["user"]))
                {
                    p.APPLY_USER_ID = request["user"].ToString();
                }

                if (!string.IsNullOrEmpty(request["code"]))
                {
                    p.CODE = "%" + request["code"].ToString() + "%";
                }

                if (!string.IsNullOrEmpty(request["name"]))
                {
                    p.ASSET_NAME = "%" + request["name"].ToString() + "%";
                }

                string strCondition = "";
                if (!string.IsNullOrEmpty(request["condition"]))
                {
                    strCondition = request["condition"];
                }

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

                if (!string.IsNullOrEmpty(request["beginspan"]))
                {
                    p.CREATE_DATE       = new DateSpan();
                    p.CREATE_DATE.Begin = DateTime.Parse(request["beginspan"].ToString());
                }
                if (!string.IsNullOrEmpty(request["endspan"]))
                {
                    if (p.CREATE_DATE == null)
                    {
                        p.CREATE_DATE = new DateSpan();
                    }
                    p.CREATE_DATE.End = DateTime.Parse(request["endspan"].ToString());
                }


                DisplayObject_MCE_B_ASSETS_PURCHASE[] list = BizLogicObject_MCE_B_ASSETS_PURCHASE.Proxy.Query(p, pager, orderBy);



                JSON_PAGER jsonPager = new JSON_PAGER();

                jsonPager.total = pager.TotalRecords;
                jsonPager.rows  = list;

                jsonMsg.Message = jsonPager;
                jsonMsg.Succeed = 1;
            }
            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();
            }
        }
Пример #11
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 = "FINANCE_CYCLE";

                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;


                if (string.IsNullOrEmpty(request["id"]))
                {
                    throw new Exception("参数错误.");
                }

                CauseObject_V_MCE_ASSETS_DEPR_D p = new CauseObject_V_MCE_ASSETS_DEPR_D();
                p.ASSERTS_ID = request["id"];


                List <DisplayObject_V_MCE_ASSETS_DEPR_D> list  = new List <DisplayObject_V_MCE_ASSETS_DEPR_D>();
                DisplayObject_V_MCE_ASSETS_DEPR_D[]      list0 = BizLogicObject_V_MCE_ASSETS_DEPR_D.Proxy.Query(p, pager, orderBy);

                if (list0 != null && list0.Length > 0)
                {
                    list = list0.ToList();
                }

                object objMoney = list.Sum(l => l.MONEY);


                DisplayObject_V_MCE_ASSETS_DEPR_D pageItem = new DisplayObject_V_MCE_ASSETS_DEPR_D();
                pageItem.FINANCE_CYCLE = "小计";
                if (!string.IsNullOrEmpty(objMoney.ToString()))
                {
                    pageItem.MONEY = decimal.Parse(objMoney.ToString());
                }

                list.Add(pageItem);


                DisplayObject_V_MCE_ASSETS_DEPR_D[] list1 = BizLogicObject_V_MCE_ASSETS_DEPR_D.Proxy.Query(p);

                object objTotMoney = list1.Sum(l => l.MONEY);

                DisplayObject_V_MCE_ASSETS_DEPR_D totalItem = new DisplayObject_V_MCE_ASSETS_DEPR_D();

                totalItem.FINANCE_CYCLE = "总计";
                if (!string.IsNullOrEmpty(objTotMoney.ToString()))
                {
                    totalItem.MONEY = decimal.Parse(objTotMoney.ToString());
                }

                list.Add(totalItem);

                JSON_PAGER jsonPager = new JSON_PAGER();

                jsonPager.total = pager.TotalRecords;
                jsonPager.rows  = list;

                jsonMsg.Message = jsonPager;
                jsonMsg.Succeed = 1;
            }
            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();
            }
        }
        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     = false;
                orderBy.OrderBy = "CREATE_TIME";

                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_PRV_B_ASSET p = new CauseObject_PRV_B_ASSET();


                StringBuilder strCondition = new StringBuilder();
                strCondition.Append(" and PRV_B_ASSET.STATE > -1 ");

                if (!string.IsNullOrEmpty(request["state"]))
                {
                    p.STATE = int.Parse(request["state"].ToString());
                }


                if (!string.IsNullOrEmpty(request["prv"]))
                {
                    p.PRV_ID = request["prv"].ToString();
                }

                if (!string.IsNullOrEmpty(request["refprv"]))
                {
                    EntityObject_MDM_D_DEPT entityDept = new EntityObject_MDM_D_DEPT();
                    entityDept.ID = request["refprv"];
                    entityDept    = BizLogicObject_MDM_D_DEPT.Proxy.Get(entityDept);

                    if (entityDept != null)
                    {
                        p.PRV_ID = entityDept.REF_ID;
                    }
                }

                if (!string.IsNullOrEmpty(request["typeid"]))
                {
                    p.TYPE_ID = request["typeid"].ToString();
                }


                if (!string.IsNullOrEmpty(request["name"]))
                {
                    p.NAME = "%" + request["name"].ToString().Trim() + "%";
                }



                if (!string.IsNullOrEmpty(request["prd"]))//生产厂家
                {
                    strCondition.Append(" and PRV_D_DEPT_PRD_ID.NAME like '%" + request["prd"].ToString().Trim() + "%'");
                }

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


                string strOrder = JsonConvert.SerializeObject(orderBy);
                string strPage  = JsonConvert.SerializeObject(pager);
                string strCause = JsonConvert.SerializeObject(p);

                PRV_MCE_Web_Service.PRV_Web_Service service = new PRV_MCE_Web_Service.PRV_Web_Service();
                if (System.Configuration.ConfigurationManager.AppSettings["PrvMceWebServiceAddress"] != null)
                {
                    string strServiceURL = System.Configuration.ConfigurationManager.AppSettings["PrvMceWebServiceAddress"];
                    service.Url = strServiceURL;
                }

                string strJson = service.GetPrvAssetInfo(strCause, strPage, strOrder);

                JSON_PAGER list = JsonConvert.DeserializeObject <JSON_PAGER>(strJson);
                jsonMsg.Succeed = 1;
                jsonMsg.Message = list;
            }
            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();
            }
        }
        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     = false;
                orderBy.OrderBy = "CREATE_TIME";

                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_PRV_D_DEPT p = new CauseObject_PRV_D_DEPT();
                p.DEPT_TYPE_ID = "00340005";

                if (!string.IsNullOrEmpty(request["status"]))
                {
                    p.AUDIT_STATE = request["status"].ToString();
                }

                if (!string.IsNullOrEmpty(request["prvid"]))
                {
                    p.ID = request["prvid"].ToString();
                }

                StringBuilder strCondition = new StringBuilder();
                if (!string.IsNullOrEmpty(request["condition"]))
                {
                    strCondition.Append(string.Format(" and (upper(PRV_D_DEPT.CODE) like upper('%{0}%') or upper(PRV_D_DEPT.NAME) like upper('%{0}%')) ", request["condition"].ToString().Trim()));
                }

                if (!string.IsNullOrEmpty(request["beginspan"]))
                {
                    p.CREATE_TIME       = new DateSpan();
                    p.CREATE_TIME.Begin = DateTime.Parse(request["beginspan"].ToString());
                }
                if (!string.IsNullOrEmpty(request["endspan"]))
                {
                    if (p.CREATE_TIME == null)
                    {
                        p.CREATE_TIME = new DateSpan();
                    }
                    p.CREATE_TIME.End = DateTime.Parse(request["endspan"].ToString());
                }

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

                string strOrder = JsonConvert.SerializeObject(orderBy);
                string strPage  = JsonConvert.SerializeObject(pager);
                string strCause = JsonConvert.SerializeObject(p);

                PRV_MCE_Web_Service.PRV_Web_Service service = new PRV_MCE_Web_Service.PRV_Web_Service();
                if (System.Configuration.ConfigurationManager.AppSettings["PrvMceWebServiceAddress"] != null)
                {
                    string strServiceURL = System.Configuration.ConfigurationManager.AppSettings["PrvMceWebServiceAddress"];
                    service.Url = strServiceURL;
                }

                string strJson = service.GetPrvInfo(strCause, strPage, strOrder);

                JSON_PAGER list = JsonConvert.DeserializeObject <JSON_PAGER>(strJson);
                jsonMsg.Succeed = 1;
                jsonMsg.Message = list;
            }
            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();
            }
        }
        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 = "ASSETS_CODE";

                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;

                StringBuilder strCondition = new StringBuilder();

                CauseObject_MCE_B_ASSETS p = new CauseObject_MCE_B_ASSETS();

                if (!string.IsNullOrEmpty(request["status"]))
                {
                    p.STATE = int.Parse(request["status"].ToString());
                }

                if (!string.IsNullOrEmpty(request["type_id"]))
                {
                    p.MACHINE_TYPE_ID = request["type_id"].ToString();
                }

                if (!string.IsNullOrEmpty(request["brand"]))  //品牌
                {
                    p.BRAND_NAME = "%" + request["brand"].ToString() + "%";
                }

                if (!string.IsNullOrEmpty(request["use_state"]))//使用状态
                {
                    p.USE_STATE = request["use_state"].ToString();
                }

                if (!string.IsNullOrEmpty(request["ownership_type_id"]))//权属信息
                {
                    p.OWNERSHIP_TYPE_ID = request["ownership_type_id"].ToString();
                }

                if (!string.IsNullOrEmpty(request["assets_state"]))//资产状态
                {
                    p.ASSETS_STATE = request["assets_state"].ToString();
                }

                if (!string.IsNullOrEmpty(request["card_type_id"]))//卡片类型
                {
                    p.CARD_TYPE_ID = request["card_type_id"].ToString();
                }

                if (!string.IsNullOrEmpty(request["is_metering"]))//是否计量
                {
                    p.IS_METERING = int.Parse(request["is_metering"].ToString());
                }

                if (!string.IsNullOrEmpty(request["is_force_sense"]))//是否强检设备
                {
                    p.IS_FORCE_SENSE = int.Parse(request["is_force_sense"].ToString());
                }

                if (!string.IsNullOrEmpty(request["prv"]))//供应商
                {
                    p.PROVIDER_ID = request["prv"];
                }

                if (!string.IsNullOrEmpty(request["prd"]))//生产厂家
                {
                    strCondition.Append(" and MDM_D_DEPT_PRD_ID.NAME like '%" + request["prd"].ToString().Trim() + "%'");
                }

                //if (!string.IsNullOrEmpty(request["prv"]))//供应商
                //{
                //    strCondition.Append(" and MDM_D_DEPT_PROVIDER_ID.NAME like '%" + request["prv"].ToString().Trim() + "%'");
                //}


                if (!string.IsNullOrEmpty(request["usedept"]))//领用科室
                {
                    strCondition.Append(" and COM_DEPART_USING_DEPT_ID.NAME like '%" + request["usedept"].ToString().Trim() + "%'");
                }

                if (!string.IsNullOrEmpty(request["cust_condition"]))//定制条件
                {
                    strCondition.Append(request["cust_condition"]);
                }

                if (!string.IsNullOrEmpty(request["condition"]))//条件
                {
                    strCondition.Append(" and (MCE_B_ASSETS.assets_code like '%" + request["condition"].ToString().Trim() + "%' or MCE_B_ASSETS.assets_name like '%" + request["condition"].ToString().Trim() + "%' or MCE_B_ASSETS.spec like '%" + request["condition"].ToString().Trim() + "%' or COM_DEPART_USING_DEPT_ID.NAME like '%" + request["condition"].ToString().Trim() + "%')");
                }
                else
                {
                    if (!string.IsNullOrEmpty(request["code"]))
                    {
                        p.ASSETS_CODE = "%" + request["code"].ToString() + "%";
                    }

                    if (!string.IsNullOrEmpty(request["name"]))
                    {
                        p.ASSETS_NAME = "%" + request["name"].ToString() + "%";
                    }

                    if (!string.IsNullOrEmpty(request["spec"]))//规格型号
                    {
                        p.SPEC = "%" + request["spec"].ToString() + "%";
                    }
                }

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

                List <DisplayObject_MCE_B_ASSETS> list  = new List <DisplayObject_MCE_B_ASSETS>();
                DisplayObject_MCE_B_ASSETS[]      list0 = BizLogicObject_MCE_B_ASSETS.Proxy.Query(p, pager, orderBy);

                if (list0 != null && list0.Length > 0)
                {
                    list = list0.ToList();
                }

                string strNeedTotal = "1";
                if (!string.IsNullOrEmpty(request["needTotal"]))//需要合计
                {
                    strNeedTotal = request["needTotal"];
                }

                if (strNeedTotal == "1")
                {
                    object objORIGINAL_VALUE = list.Sum(l => l.ORIGINAL_VALUE);
                    object objNET_VALUE      = list.Sum(l => l.NET_VALUE);

                    DisplayObject_MCE_B_ASSETS pageItem = new DisplayObject_MCE_B_ASSETS();
                    pageItem.ASSETS_CODE = "小计";
                    if (!string.IsNullOrEmpty(objORIGINAL_VALUE.ToString()))
                    {
                        pageItem.ORIGINAL_VALUE = decimal.Parse(objORIGINAL_VALUE.ToString());
                    }

                    if (!string.IsNullOrEmpty(objNET_VALUE.ToString()))
                    {
                        pageItem.NET_VALUE = decimal.Parse(objNET_VALUE.ToString());
                    }
                    list.Add(pageItem);


                    DisplayObject_MCE_B_ASSETS totalItem = BizLogicObject_MCE_B_ASSETS.Proxy.GetTotalRecord(p);
                    list.Add(totalItem);
                }

                JSON_PAGER jsonPager = new JSON_PAGER();

                jsonPager.total = pager.TotalRecords;
                jsonPager.rows  = list;


                string strDropDown = "0";
                if (!string.IsNullOrEmpty(request["dropdown"]))//
                {
                    strDropDown = request["dropdown"];
                }

                if (strDropDown == "1" && list != null && list.Count > 0)
                {
                    foreach (DisplayObject_MCE_B_ASSETS item in list)
                    {
                        item.NAME = item.ASSETS_NAME;
                    }
                }

                jsonMsg.Message = jsonPager;
                jsonMsg.Succeed = 1;
            }
            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();
            }
        }
Пример #15
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 = "CODE, POST_CODE";
                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;
                StringBuilder          strCondition = new StringBuilder();
                string                 area         = string.Empty;
                CauseObject_COM_DEPART pItem        = new CauseObject_COM_DEPART();
                if (!string.IsNullOrEmpty(request["code"]))
                {
                    strCondition.Append(string.Format(" and COM_DEPART.CODE like upper('%{0}%') ", request["code"].ToString().Trim()));
                }
                if (!string.IsNullOrEmpty(request["area"]))
                {
                    area = request["area"].ToString().Trim();
                    strCondition.Append(string.Concat(" and COM_DEPART.ID in (select distinct id from com_depart where parent_id is not null start with id = '", area, "' connect by parent_id= prior id) "));
                }

                if (!string.IsNullOrEmpty(request["mcetype_id"]))
                {
                    string mcetype_id = request["mcetype_id"].ToString().Trim();
                    strCondition.Append(string.Concat(" and COM_DEPART.ID in (select distinct dept_id from MCE_D_TYPE_DEPT where mce_type_id='", mcetype_id, "')"));
                }

                if (!string.IsNullOrEmpty(request["is_area"]) && request["is_area"].ToString().Trim() == "1")
                {
                    area = BizLogicObject_MTR_D_MTR.Proxy.getAreaByDept(SystemLogic.Proxy.CurrentUser.DEPART_ID.Trim());
                    strCondition.Append(string.Concat(" and COM_DEPART.ID in (select distinct id from com_depart where parent_id is not null start with id = '", area, "' connect by parent_id= prior id) "));
                }
                if (!string.IsNullOrEmpty(request["condition"]))
                {
                    strCondition.Append(string.Format(" and (upper(COM_DEPART.CODE) like upper('%{0}%') or upper(COM_DEPART.NAME) like upper('%{0}%')) ", request["condition"].ToString().Trim()));
                }
                if (!string.IsNullOrEmpty(strCondition.ToString()))
                {
                    pItem.SetCustomCondition(strCondition.ToString());
                }

                List <JsonMtrDept> list      = BizLogicObject_MTR_D_MTR.Proxy.getDeptList(pItem, pager, orderBy, area);
                JSON_PAGER         jsonPager = new JSON_PAGER();
                if (list == null)
                {
                    throw new Exception("获取科室列表失败.");
                }
                jsonPager.total = pager.TotalRecords;
                jsonPager.rows  = list;
                jsonMsg.Succeed = 1;
                jsonMsg.Message = jsonPager;
            }
            catch (Exception ex)
            {
                jsonMsg.Succeed = 0;
                jsonMsg.Message = ex.Message;
            }
            finally
            {
                context.Response.Write(JsonConvert.SerializeObject(jsonMsg));
                context.Response.End();
            }
        }
Пример #16
0
 public static DisplayObject_V_MCE_ASSET_OUTSTOCK_BACK[] Query(CauseObject_V_MCE_ASSET_OUTSTOCK_BACK cause, PagingParamter paging, OrderByParameter order)
 {
     //平台自动生成代码
     #region Parameters Block
     OracleParameter[] parameters = null;
     IDataReader       sqlReader  = null;
     #endregion
     string sSql      = " select  V_MCE_ASSET_OUTSTOCK_BACK.ASSETS_CODE, V_MCE_ASSET_OUTSTOCK_BACK.BASE_ID, V_MCE_ASSET_OUTSTOCK_BACK.CARD_CODE, V_MCE_ASSET_OUTSTOCK_BACK.OUT_D_ID, V_MCE_ASSET_OUTSTOCK_BACK.SPEC, V_MCE_ASSET_OUTSTOCK_BACK.ID, V_MCE_ASSET_OUTSTOCK_BACK.ASSETS_NAME from V_MCE_ASSET_OUTSTOCK_BACK 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
     IDbConnection connection = IDALProvider.IDAL.PopConnection();
     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 ? (int)IDALProvider.IDAL.ExecuteScalar(countSql, parameters, connection) : (int)(decimal)IDALProvider.IDAL.ExecuteScalar(countSql, parameters, connection);
         }
         sqlReader = IDALProvider.IDAL.ExecutePagingReader("V_MCE_ASSET_OUTSTOCK_BACK", paging, order, sSql, parameters, connection);
     }
     else if (order != null)
     {
         sSql     += order.ToString();
         sqlReader = IDALProvider.IDAL.ExecuteReader(sSql, parameters, connection);
     }
     else
     {
         sqlReader = IDALProvider.IDAL.ExecuteReader(sSql, parameters, connection);
     }
     DisplayObject_V_MCE_ASSET_OUTSTOCK_BACK dataObj = null;
     ArrayList objArray = new ArrayList();
     while (sqlReader.Read())
     {
         dataObj = new DisplayObject_V_MCE_ASSET_OUTSTOCK_BACK();
         if (!sqlReader.IsDBNull(0))
         {
             dataObj.ASSETS_CODE = sqlReader.GetString(0);
         }
         if (!sqlReader.IsDBNull(1))
         {
             dataObj.BASE_ID = sqlReader.GetString(1);
         }
         if (!sqlReader.IsDBNull(2))
         {
             dataObj.CARD_CODE = sqlReader.GetString(2);
         }
         if (!sqlReader.IsDBNull(3))
         {
             dataObj.OUT_D_ID = sqlReader.GetString(3);
         }
         if (!sqlReader.IsDBNull(4))
         {
             dataObj.SPEC = sqlReader.GetString(4);
         }
         if (!sqlReader.IsDBNull(5))
         {
             dataObj.ID = sqlReader.GetString(5);
         }
         if (!sqlReader.IsDBNull(6))
         {
             dataObj.ASSETS_NAME = sqlReader.GetString(6);
         }
         objArray.Add(dataObj);
     }
     sqlReader.Close();
     IDALProvider.IDAL.PushConnection(connection);
     #endregion
     DisplayObject_V_MCE_ASSET_OUTSTOCK_BACK[] objs = new DisplayObject_V_MCE_ASSET_OUTSTOCK_BACK[objArray.Count];
     objArray.CopyTo(0, objs, 0, objs.Length);
     return(objs);
 }