Beispiel #1
0
        //
        public string LogoffPage(System.Web.HttpContext context, string resptype)
        {
            //MessageBox.Show("logoff");
            string      respxml  = string.Empty;
            HttpRequest request  = context.Request;
            Hashtable   RespData = new Hashtable();

            RespData["success"] = true;
            RespData["method"]  = request.Form.Get("method").ToString();
            if (HttpContext.Current.Request.Cookies["AdminInfo"] != null)
            {
                string sessionID = context.Request.Cookies["AdminInfo"]["sessionID"].ToString();
                string username  = context.Request.Cookies["AdminInfo"]["userName"].ToString();
                RespData["username"]    = username;
                RespData["userserver"]  = WebFrameWork.GetServerCookieValueByNode("userserver");
                RespData["moneyserver"] = WebFrameWork.GetServerCookieValueByNode("moneyserver");
                WebFrameWork.ReleaseCache(sessionID);
            }
            else
            {
                RespData["success"] = false;
            }

            WebFrameWork.ReleaseVerifyInfo();
            WebFrameWork.ReleaseCookieUserInfo();
            // context.Response.Expires = -1;


            respxml = AssemblerDictionary.AssemblerPlugins[resptype].GenerateXml(context, (Object)RespData);
            return(respxml);
        }
Beispiel #2
0
        public string XmlRpcTransaction(HttpContext context, string seruri, string resptype, int number, int currentPage, Hashtable reqParms)
        {
            ArrayList   arrayParm = new ArrayList();
            HttpRequest request   = context.Request;
            // arrayParm.Add(reqParms);
            XmlRpcResponse serResp    = null;
            string         respxml    = string.Empty;
            Hashtable      RespData   = new Hashtable();
            Hashtable      XmlData    = new Hashtable();
            Hashtable      Cache      = new Hashtable();
            string         sessionID  = reqParms["sessionID"] as string;
            string         method     = string.Empty;
            int            startindex = 1;

            if (currentPage == 1)
            {
                method     = request.Form.Get("method").ToString();
                startindex = 1;
            }
            else
            {
                method     = "WebGetTransaction";
                Cache      = WebFrameWork.GetCurrentCache(sessionID);
                startindex = (currentPage / 10) * 10 + 1;
            }
            string html = string.Empty;


            WebFrameWork.ReleaseCache(sessionID);

            int maxnumber = number - (currentPage - 1) * 10;
            int maxpage   = maxnumber >= 100 ? 10 : (number - 1) / 10 + 1;

            //  MessageBox.Show(startindex.ToString() + "    /" + maxpage.ToString());

            for (int i = startindex; i <= maxpage; i++)
            {
                html  = string.Empty;
                html += "<br/><br/><br/><h1>User Transaction Records (" + number.ToString() + ")</h1>";
                html += "<table id ='dtable' align='left' style='border: 1px solid #dfdfdf; left : 0px; top:0px; width: 100% ;height:100%' >";
                html += "<thead><tr style='vertical-align:middle;'><td class='top'>Index</td><td class='top' >transaction UUID</td><td class='top'>sender Name</td><td class='top'>receiver Name</td><td class='top'>amount</td><td class='top'>type</td><td class='top'>time</td><td class='top'>status</td><td class='top'>description</td></tr></thead>";
                html += "<tbody>";
                for (int ix = 0; ix < MAX_TRANSACTION_NUM; ix++)
                {
                    try
                    {
                        arrayParm = new ArrayList();
                        //MessageBox.Show("mehtod:   " + method);
                        //MessageBox.Show("https   " + seruri);
                        if (ix == 0 && (int)reqParms["lastIndex"] == -1)
                        {
                            reqParms["lastIndex"] = Convert.ToInt32(reqParms["lastIndex"]) + 0;
                        }
                        else
                        {
                            reqParms["lastIndex"] = Convert.ToInt32(reqParms["lastIndex"]) + 1;
                        }
                        //foreach (DictionaryEntry de in reqParms)
                        //{
                        //    MessageBox.Show(de.Key + "  " + de.Value);
                        //}
                        arrayParm.Add(reqParms);
                        XmlRpcRequest serReq = new XmlRpcRequest(method, arrayParm);
                        serResp = serReq.Send(seruri);//, _REQUEST_TIMEOUT);
                    }
                    catch (Exception ex)
                    {
                        XmlData["success"] = false;
                        XmlData["method"]  = method;
                        XmlData["message"] = ex.Message.ToString();
                        XmlData["seruri"]  = seruri;

                        break;
                    }
                    if (serResp.IsFault)
                    {
                        XmlData["success"] = false;
                        XmlData["method"]  = method;
                        XmlData["message"] = "Failed to Connet server: " + seruri.ToString();
                        XmlData["seruri"]  = seruri;
                        break;
                    }
                    else
                    {
                        RespData = (Hashtable)serResp.Value;

                        html += "<tr>";
                        html += "<td class='rowstate'>" + RespData["transactionIndex"].ToString() + "</td>";
                        html += "<td class='rowstate'>" + RespData["transactionUUID"].ToString() + "</td>";
                        html += "<td class='rowstate'>" + RespData["senderName"].ToString() + "</td>";
                        html += "<td class='rowstate'>" + RespData["receiverName"].ToString() + "</td>";
                        html += "<td class='rowstate'>" + RespData["amount"].ToString() + "</td>";
                        html += "<td class='rowstate'>" + RespData["type"].ToString() + "</td>";
                        html += "<td class='rowstate'>" + getDataTime((int)RespData["time"]) + "</td>";
                        html += "<td class='rowstate'>" + getStatus((int)RespData["status"]) + "</td>";
                        html += "<td class='rowstate'>" + RespData["description"].ToString() + "</td>";
                        html += "</tr>";

                        if ((bool)RespData["isEnd"] || ix == MAX_TRANSACTION_NUM - 1 || Convert.ToInt32(reqParms["lastIndex"]) == (number - 2))
                        {
                            //XmlData["method"] = method;
                            XmlData["success"] = true;
                            //MessageBox.Show(reqParms["lastIndex"].ToString() + "/" + number.ToString()+"-"+i.ToString());
                            //if (i > 10)
                            //    MessageBox.Show(((i - 1) * 10 + ix).ToString()+"/"+(number-1).ToString());
                            //XmlData["seruri"] = seruri;
                            break;
                        }
                    }
                }
                html += "</tbody></table>";


                html += getNavigationhtml(i, number);


                if ((bool)XmlData["success"])
                {
                    Cache[i] = html;
                }
            }
            Cache["startTime"] = Convert.ToInt32(reqParms["startTime"]);
            Cache["endTime"]   = Convert.ToInt32(reqParms["endTime"]);
            Cache["number"]    = number;
            Cache["lastIndex"] = Convert.ToInt32(reqParms["lastIndex"]);

            WebFrameWork.RegisterCache(sessionID, (object)Cache);
            XmlData.Clear();
            XmlData = WebFrameWork.TransactionHash(currentPage, sessionID, method, seruri);
            //XmlData[
            respxml = AssemblerDictionary.AssemblerPlugins[resptype].GenerateXml(context, XmlData);
            //  MessageBox.Show(respxml);

            return(respxml);
        }