private string getUserRefundState(HttpContext context)
        {
            userState jsonResult = new userState();
            string    openid     = context.Request["openid"];
            DataTable dt         = ms.getUserRefundState(openid);

            if (dt != null && dt.Rows.Count > 0)
            {
                jsonResult.Success = true;
                //jsonResult.backBiaoNum = dt.Rows[0]["backBiaoNum"].ToString();
                //jsonResult.flag = dt.Rows[0]["flag"].ToString() == "2" ? "已结束" : "未结束";
                //jsonResult.payState = dt.Rows[0]["payState"].ToString() == "0" ? "已支付" : "未支付";
                //jsonResult.refundState = dt.Rows[0]["refundState"].ToString() == "0" ? "已退" : "未退";
                //jsonResult.biaoState = dt.Rows[0]["biaoState"].ToString() == "0" ? "未还" : "已还";

                jsonResult.flag        = dt.Rows[0]["flag"].ToString();
                jsonResult.payState    = dt.Rows[0]["payState"].ToString();
                jsonResult.refundState = dt.Rows[0]["refundState"].ToString();
                jsonResult.biaoState   = dt.Rows[0]["biaoState"].ToString();
            }
            else
            {
                jsonResult.Success     = true;
                jsonResult.flag        = "2";
                jsonResult.payState    = "0";
                jsonResult.refundState = "0";
                jsonResult.biaoState   = "1";
            }
            string strJson = JsonConvert.SerializeObject(jsonResult);

            return(strJson);
        }
Exemple #2
0
        /// <summary>
        /// Runs every time bytes have been downloaded; shows download progress in window title
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void HandleDownloadProgress(object sender, DownloadProgressChangedEventArgs e)
        {
            userState usr = e.UserState as userState;

            ControlUtils.ChangeMainWindowTitle(usr.title, "Downloading data, " + e.ProgressPercentage + "% complete...");

            Console.Write("\rDownloaded {0} of {1} bytes. {2} % complete...      ",
                          e.BytesReceived,
                          e.TotalBytesToReceive,
                          e.ProgressPercentage);
        }
Exemple #3
0
        /// <summary>
        /// Runs when download finishes; allows main thread to continue
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void HandleDownloadComplete(object sender, AsyncCompletedEventArgs e)
        {
            userState usr = e.UserState as userState;

            ControlUtils.ChangeMainWindowTitle(usr.title, "YARDT");

            Console.WriteLine();


            usr.waiter.Set();
        }
Exemple #4
0
        /// <summary>
        /// Download file to specified location synchronously
        /// </summary>
        /// <param name="address"></param>
        /// <param name="destination"></param>
        /// <param name="windowTitle"></param>
        public static void DownloadFile(string address, string destination, TextBlock windowTitle)
        {
            userState usr = new userState();

            usr.waiter = new ManualResetEvent(false);
            usr.title  = windowTitle;

            Uri       uri = new Uri(address);
            WebClient wc  = new WebClient();

            new Thread(() =>
            {
                wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(HandleDownloadProgress);
                wc.DownloadFileCompleted   += new AsyncCompletedEventHandler(HandleDownloadComplete);
                wc.DownloadFileAsync(uri, destination, usr);
            }).Start();

            usr.waiter.WaitOne();
        }
Exemple #5
0
 public MemberModel(string incomingUserId)
 {
     userId = incomingUserId;
     state  = userState.lobbying;
 }