Esempio n. 1
0
    public static void AsyncPOST(string UserID, string UserPWD, DateTime date, Action <User, DateTime> DoAction, Action ErrorAction = null)
    {
        Action <HttpWebResponse> action = null;
        Action action2 = null;
        _003C_003Ec__DisplayClass4 _003C_003Ec__DisplayClass = new _003C_003Ec__DisplayClass4();

        _003C_003Ec__DisplayClass.date        = date;
        _003C_003Ec__DisplayClass.DoAction    = DoAction;
        _003C_003Ec__DisplayClass.ErrorAction = ErrorAction;
        try
        {
            string url    = WsTool.GetUrl();
            string format = "<?xml version=\"1.0\"?><UserInfo><UserID><![CDATA[{0}]]></UserID><UserPW><![CDATA[{1}]]></UserPW><UserDevice>1</UserDevice><UserDateBegin>{2}</UserDateBegin><UserDateEnd>{3}</UserDateEnd></UserInfo>";
            format = string.Format(format, UserID, UserPWD, DateTool.MonthFirstDate(_003C_003Ec__DisplayClass.date).ToString("yyyyMMdd"), DateTool.MonthLastDate(_003C_003Ec__DisplayClass.date).ToString("yyyyMMdd"));
            Dictionary <string, string> dictionary = new Dictionary <string, string>();
            dictionary["XmlDoc"] = format;
            HttpWebRequest httpWebRequest = HttpTool.GetHttpWebRequest(url + "/UserData", "POST", dictionary);
            if (action == null)
            {
                action = new Action <HttpWebResponse>(_003C_003Ec__DisplayClass._003CAsyncPOST_003Eb__0);
            }
            Action <HttpWebResponse> responseAction = action;
            if (action2 == null)
            {
                action2 = new Action(_003C_003Ec__DisplayClass._003CAsyncPOST_003Eb__1);
            }
            HttpTool.DoWithResponse(httpWebRequest, responseAction, action2);
        }
        catch (Exception ex)
        {
            if (_003C_003Ec__DisplayClass.ErrorAction != null)
            {
                _003C_003Ec__DisplayClass.ErrorAction();
            }
            AutoClosingMessageBox.Show(ex.Message);
            LogTool.Debug(ex);
        }
    }