Example #1
0
        private void getroomsourcebyopenid(HttpContext context)
        {
            string openid = GetOpenID(context);
            var    list   = ViewRoomBasic.GetRoomBasicListByOpenID(openid);

            WebUtil.WriteJsonResult(context, list);
        }
Example #2
0
 private void LoadRoomResourceList(HttpContext context)
 {
     try
     {
         string     page       = context.Request.Form["page"];
         string     rows       = context.Request.Form["rows"];
         string     ProjectIDs = context.Request.Params["ProjectID"];
         string     RoomIDs    = context.Request.Params["RoomID"];
         List <int> RoomIDList = new List <int>();
         if (!string.IsNullOrEmpty(RoomIDs))
         {
             RoomIDList = JsonConvert.DeserializeObject <List <int> >(RoomIDs);
         }
         List <int> ProjectIDList = new List <int>();
         if (RoomIDList.Count == 0)
         {
             if (!string.IsNullOrEmpty(ProjectIDs))
             {
                 ProjectIDList = JsonConvert.DeserializeObject <List <int> >(ProjectIDs).Where(p => p != 1).ToList();
             }
             ProjectIDList = WebUtil.GetMyProjects(WebUtil.GetUser(context).UserID, ProjectIDList).Where(p => p.ID != 1).Select(p => p.ID).ToList();
         }
         string        OwnerName        = context.Request.Params["OwnerName"];
         string        OwnerPhoneNumber = context.Request.Params["OwnerPhoneNumber"];
         string        Keywords         = context.Request.Params["Keywords"];
         long          startRowIndex    = (long.Parse(page) - 1) * long.Parse(rows);
         int           pageSize         = int.Parse(rows);
         string        SearchAreas      = context.Request.Params["SearchAreas"];
         List <string> SearchAreaList   = new List <string>();
         if (!string.IsNullOrEmpty(SearchAreas))
         {
             SearchAreaList = JsonConvert.DeserializeObject <List <string> >(SearchAreas);
         }
         bool     canexport = WebUtil.GetBoolValue(context, "canexport");
         int      CompanyID = WebUtil.GetIntValue(context, "CompanyID");
         DataGrid dg        = ViewRoomBasic.GetRoomBasicListByKeywords(RoomIDList, ProjectIDList, OwnerName, OwnerPhoneNumber, Keywords, SearchAreaList, "order by DefaultOrder asc", startRowIndex, pageSize, canexport: canexport, CompanyID: CompanyID);
         if (canexport)
         {
             string downloadurl = string.Empty;
             string error       = string.Empty;
             bool   status      = APPCode.ExportHelper.DownLoadRoomSourceData(dg, out downloadurl, out error);
             WebUtil.WriteJson(context, new { status = status, downloadurl = downloadurl, error = error });
         }
         else
         {
             WebUtil.WriteJson(context, dg);
         }
     }
     catch (Exception ex)
     {
         Utility.LogHelper.WriteError("RoomResourceHandler", "命令:LoadRoomResourceList", ex);
         context.Response.Write("{\"rows\":[],\"total\":0,\"page\":0}");
     }
 }
Example #3
0
 private void LoadlRelateRoomResource(HttpContext context)
 {
     try
     {
         int      RoomID        = int.Parse(context.Request.Params["RoomID"]);
         string   Keywords      = context.Request.Params["Keywords"];
         string   page          = context.Request.Form["page"];
         string   rows          = context.Request.Form["rows"];
         long     startRowIndex = (long.Parse(page) - 1) * long.Parse(rows);
         int      pageSize      = int.Parse(rows);
         bool     loadIn        = bool.Parse(context.Request.Params["loadIn"]);
         DataGrid dg            = ViewRoomBasic.GetProjectDetailsGridByRoomID(RoomID, loadIn, Keywords, "order by RoomID asc", startRowIndex, pageSize);
         string   result        = JsonConvert.SerializeObject(dg);
         context.Response.Write(result);
     }
     catch (Exception ex)
     {
         Utility.LogHelper.WriteError("RoomResourceHandler", "命令:LoadlRelateRoomResource", ex);
         context.Response.Write("{\"rows\":[],\"total\":0,\"page\":0}");
     }
 }