Example #1
0
        private string GetContractCode()
        {
            string strContractCode = "";

            string strCode = DateTime.Now.ToString("yyyyMMdd");


            int code = 1;

            OrderByParameter orderBy = new OrderByParameter();

            orderBy.Asc     = false;
            orderBy.OrderBy = "CODE";

            var cause = new CauseObject_MCE_B_ASSETS_CONTRACT();

            cause.SetCustomCondition(" and MCE_B_ASSETS_CONTRACT.CODE like '" + strCode + "%'");
            var list = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Query(cause, null, orderBy);

            if (list != null && list.Length > 0)
            {
                var s_code    = list[0].CODE;
                var rightCode = s_code.Replace(strCode, "").TrimStart('0');
                code = int.Parse(rightCode) + 1;
            }

            strContractCode = strCode + (code).ToString().PadLeft(3, '0');

            return(strContractCode);
        }
Example #2
0
 public int DeleteByTrans2(CauseObject_MCE_B_ASSETS_CONTRACT cause, IDbTransaction transaction)
 {
     if (LocalMode)
     {
         return(HelperObject_MCE_B_ASSETS_CONTRACT.Delete(cause, transaction));
         //平台自动生成代码
     }
     else
     {
         throw new InvalidConstraintException();
     }
 }
Example #3
0
        public DisplayObject_MCE_B_ASSETS_CONTRACT[] Query(CauseObject_MCE_B_ASSETS_CONTRACT cause, PagingParamter paging, OrderByParameter order)
        {
            if (LocalMode)
            {
                SystemLogic.Proxy.AuditQuery(cause);

                //平台自动生成代码
                return(HelperObject_MCE_B_ASSETS_CONTRACT.Query(cause, paging, order));
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(ServiceUri))
                {
                    return(smgr.Service.Query(cause, paging, order));
                }
            }
        }
Example #4
0
 public BizLogicMsg Delete(CauseObject_MCE_B_ASSETS_CONTRACT 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_CONTRACT.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_CONTRACT> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_CONTRACT>(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_CONTRACT p = new CauseObject_MCE_B_ASSETS_CONTRACT();
                p.ID = request["id"].ToString();

                DisplayObject_MCE_B_ASSETS_CONTRACT[] listHead = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Query(p);


                JSON_PAGER_Contract jsonPager = new JSON_PAGER_Contract();

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

                jsonPager.head = listHead[0];


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


                CauseObject_MCE_B_ASSETS pd = new CauseObject_MCE_B_ASSETS();
                pd.SetCustomCondition(" and MCE_B_ASSETS.ID in(select asset_id from MCE_B_ASSETS_CONTRACT_D where base_id='" + request["id"].ToString() + "')");
                DisplayObject_MCE_B_ASSETS[] listDetail = BizLogicObject_MCE_B_ASSETS.Proxy.Query(pd, null, orderBy);

                jsonPager.total = listDetail.Length;
                jsonPager.rows  = listDetail;



                OrderByParameter orderByPay = new OrderByParameter();
                orderByPay.Asc     = true;
                orderByPay.OrderBy = "PERIODS";

                CauseObject_MCE_B_ASSETS_CONTRACT_PAY p_Pay = new CauseObject_MCE_B_ASSETS_CONTRACT_PAY();
                p_Pay.BASE_ID = request["id"];

                DisplayObject_MCE_B_ASSETS_CONTRACT_PAY[] listPay = BizLogicObject_MCE_B_ASSETS_CONTRACT_PAY.Proxy.Query(p_Pay, null, orderByPay);
                jsonPager.payRows = listPay;


                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_CONTRACT";

                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();
            }
        }
Example #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;


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

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

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

                p.ASSETS_ID = request["id"];

                if (!string.IsNullOrEmpty(request["condition"]))//
                {
                    strCondition.Append(" and (MCE_B_ASSETS_CONTRACT.CODE like '%" + request["condition"].ToString().Trim() + "%' or MDM_D_DEPT_SECOND_PARTY.NAME like '%" + request["condition"].ToString().Trim() + "%'  or COM_DEPART_FIRST_PARTY.NAME like '%" + request["condition"].ToString().Trim() + "%'  or COM_TYPE_TYPE_ID.NAME like '%" + request["condition"].ToString().Trim() + "%'  )");
                }



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

                DisplayObject_MCE_B_ASSETS_CONTRACT[] list = BizLogicObject_MCE_B_ASSETS_CONTRACT.Proxy.Query(p, null, orderBy);


                if (list != null && list.Length > 0)
                {
                    foreach (DisplayObject_MCE_B_ASSETS_CONTRACT item in list)
                    {
                        string strFiles = "";
                        CauseObject_COM_FILE pCOM_FILE = new CauseObject_COM_FILE();
                        pCOM_FILE.REF_TAB_ID   = item.ID;
                        pCOM_FILE.REF_TAB_NAME = "MCE_B_ASSETS_CONTRACT";

                        DisplayObject_COM_FILE[] listCOM_FILE = BizLogicObject_COM_FILE.Proxy.Query(pCOM_FILE);

                        if (listCOM_FILE != null && listCOM_FILE.Length > 0)
                        {
                            foreach (DisplayObject_COM_FILE file in listCOM_FILE)
                            {
                                if (!string.IsNullOrEmpty(file.SERVER_NAME))
                                {
                                    strFiles = strFiles + file.SERVER_NAME + "/" + file.CLIENT_NAME + ",";
                                }
                            }
                            strFiles = strFiles.TrimEnd(',');
                        }
                        item.BACKUP1 = strFiles;
                    }
                }


                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"
                };

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

                context.Response.End();
            }
        }
Example #7
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_CONTRACT p = new CauseObject_MCE_B_ASSETS_CONTRACT();

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

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

                if (!string.IsNullOrEmpty(request["name"]))
                {
                    p.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.SIGN_DATE       = new DateSpan();
                    p.SIGN_DATE.Begin = DateTime.Parse(request["beginspan"].ToString());
                }
                if (!string.IsNullOrEmpty(request["endspan"]))
                {
                    if (p.SIGN_DATE == null)
                    {
                        p.SIGN_DATE = new DateSpan();
                    }
                    p.SIGN_DATE.End = DateTime.Parse(request["endspan"].ToString());
                }


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