コード例 #1
0
 public static string SendRequest(string version, string data)
 {
     if (SiteMaster.VerifyRequest(HttpContext.Current.Session))
     {
         var updateData = JsonConvert.DeserializeObject <ReportRequestData>(data);
         var user       = HttpContext.Current.Session[SKeys.User] as User;
         try
         {
             SalesRequestManager.SendRequest(user, updateData);
         }
         catch
         {
             return(JsonConvert.SerializeObject(ApiResponse.Error(ResponseType.ErrorSalesReqUnknown), serializerSettings));
         }
         return(JsonConvert.SerializeObject(ApiResponse.Success(SalesRequestManager.GetPastOrders(user)), serializerSettings));
     }
     else
     {
         return(JsonConvert.SerializeObject(ApiResponse.Error(ResponseType.ErrorAuth), serializerSettings));
     }
 }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SiteMaster.SetAppID(AppID.SalesRequest);
            _fetchList = (state) =>
            {
                var user = Session[SKeys.User] as User;

                storeList      = JsonConvert.SerializeObject(SalesRequestManager.GetStoreList(user));
                retailWeekList = JsonConvert.SerializeObject(SalesRequestManager.GetRetailWeeks(user));
                partnerEmail   = user.Email;

                var pastReqs = SalesRequestManager.GetPastOrders(user);
                pastOrderGrid.DataSource = pastReqs;
                pastOrderGrid.DataBind();
                if (pastReqs.Count > 0)
                {
                    pastOrderGrid.HeaderRow.TableSection = System.Web.UI.WebControls.TableRowSection.TableHeader;
                }
            };
            Page.RegisterAsyncTask(new PageAsyncTask((sndr, args, callback, extraData) => { return(_fetchList.BeginInvoke(HttpContext.Current.Session, callback, extraData)); }, empty => { }, empty => { }, null));
        }