public int DeleteByTrans2(CauseObject_MCE_B_ASSETS_MT_APPLY cause, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         return(HelperObject_MCE_B_ASSETS_MT_APPLY.Delete(cause, transaction));
         //平台自动生成代码
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
        public DisplayObject_MCE_B_ASSETS_MT_APPLY[] Query(CauseObject_MCE_B_ASSETS_MT_APPLY cause, PagingParamter paging, OrderByParameter order)
        {
            if (LocalMode)
            {
                SystemLogic.Proxy.AuditQuery(cause);

                //平台自动生成代码
                return(HelperObject_MCE_B_ASSETS_MT_APPLY.Query(cause, paging, order));
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_ASSETS_MT_APPLY> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_MT_APPLY>(ServiceUri))
                {
                    return(smgr.Service.Query(cause, paging, order));
                }
            }
        }
 public BizLogicMsg Delete(CauseObject_MCE_B_ASSETS_MT_APPLY 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_MT_APPLY.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_MT_APPLY> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_MT_APPLY>(ServiceUri))
         {
             return(smgr.Service.Delete(cause));
         }
     }
 }
        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;

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

                CauseObject_MCE_B_ASSETS_MT_APPLY p = new CauseObject_MCE_B_ASSETS_MT_APPLY();
                p.ID = request["id"].ToString();

                DisplayObject_MCE_B_ASSETS_MT_APPLY[] listHead = BizLogicObject_MCE_B_ASSETS_MT_APPLY.Proxy.Query(p);


                JSON_PAGER_APPLY_MTN_ATTACH jsonPager = new JSON_PAGER_APPLY_MTN_ATTACH();
                if (listHead == null)
                {
                    throw new Exception("获取列表信息失败.");
                }

                jsonPager.head = listHead[0];



                OrderByParameter orderByAttach = new OrderByParameter();
                orderByAttach.Asc     = false;
                orderByAttach.OrderBy = "CREATE_TIME";

                CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE();
                pCOM_FILE.REF_TAB_ID   = request["id"];
                pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_MT_APPLY";

                List <JsonMCEMT_APPLY_MTN_ATTACH> list = new List <JsonMCEMT_APPLY_MTN_ATTACH>();

                DisplayObject_COM_FILE[] listAttach = BizLogicObject_COM_FILE.Proxy.Query(pCOM_FILE, null, orderByAttach);
                if (listAttach != null && listAttach.Length > 0)
                {
                    foreach (DisplayObject_COM_FILE item in listAttach)
                    {
                        JsonMCEMT_APPLY_MTN_ATTACH attach = new JsonMCEMT_APPLY_MTN_ATTACH();
                        attach.ID             = item.ID;
                        attach.CLIENT_NAME    = item.CLIENT_NAME;
                        attach.SERVER_NAME    = item.SERVER_NAME;
                        attach.CREATE_USER_ID = item.CREATE_USER_ID;

                        if (!string.IsNullOrEmpty(attach.CREATE_USER_ID))
                        {
                            EntityObject_COM_USER entity = new EntityObject_COM_USER();

                            entity.ID = attach.CREATE_USER_ID;

                            entity = BizLogicObject_COM_USER.Proxy.Get(entity);

                            if (entity != null)
                            {
                                attach.CREATE_USER_ID_NAME = entity.NAME;
                            }
                        }
                        attach.CREATE_TIME = item.CREATE_TIME;
                        list.Add(attach);
                    }
                }
                jsonPager.attach = 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();
            }
        }
Ejemplo n.º 5
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;


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

                StringBuilder strCondition          = new StringBuilder();
                CauseObject_MCE_B_ASSETS_MT_APPLY p = new CauseObject_MCE_B_ASSETS_MT_APPLY();

                p.ASSETS_ID = request["id"];

                if (!string.IsNullOrEmpty(request["condition"]))//
                {
                    strCondition.Append(" and (MCE_B_ASSETS_MT_APPLY.CODE like '%" + request["condition"].ToString().Trim() + "%' )");
                }

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

                DisplayObject_MCE_B_ASSETS_MT_APPLY[] list = BizLogicObject_MCE_B_ASSETS_MT_APPLY.Proxy.Query(p);


                if (list != null && list.Length > 0)
                {
                    foreach (DisplayObject_MCE_B_ASSETS_MT_APPLY item in list)
                    {
                        string strMtn_User = "";
                        CauseObject_MCE_B_ASSETS_MT_APPLY_EN pMCE_B_ASSETS_MT_APPLY_EN = new CauseObject_MCE_B_ASSETS_MT_APPLY_EN();
                        pMCE_B_ASSETS_MT_APPLY_EN.BASE_ID = item.ID;

                        DisplayObject_MCE_B_ASSETS_MT_APPLY_EN[] listMCE_B_ASSETS_MT_APPLY_EN = BizLogicObject_MCE_B_ASSETS_MT_APPLY_EN.Proxy.Query(pMCE_B_ASSETS_MT_APPLY_EN);

                        if (listMCE_B_ASSETS_MT_APPLY_EN != null && listMCE_B_ASSETS_MT_APPLY_EN.Length > 0)
                        {
                            strMtn_User = listMCE_B_ASSETS_MT_APPLY_EN[0].USER_ID_NAME;
                        }
                        item.COMMENTS = strMtn_User;
                    }
                }
                else
                {
                    list = new DisplayObject_MCE_B_ASSETS_MT_APPLY[1];
                    DisplayObject_MCE_B_ASSETS_MT_APPLY item = new DisplayObject_MCE_B_ASSETS_MT_APPLY();
                    list[0] = item;
                }

                jsonMsg.Message = list;
                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();
            }
        }
Ejemplo n.º 6
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_MT_APPLY p = new CauseObject_MCE_B_ASSETS_MT_APPLY();

                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["asset"]))
                {
                    p.ASSETS_ID = request["asset"].ToString();
                }


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

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

                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_MT_APPLY[] list = BizLogicObject_MCE_B_ASSETS_MT_APPLY.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();
            }
        }