Beispiel #1
0
    public static void ReturnMessage(HttpContext context, int mCode, string strMessage, string strValue)
    {
        context.Response.ContentType = "text/plain";
        string strResult = MyXml.CreateResultXml(mCode, strMessage, strValue).InnerXml;

        context.Response.Write(strResult);
    }
    /// <summary>
    ///
    /// </summary>
    /// <param name="strparam"></param>
    /// <returns></returns>
    public string Delete4Ids(string strparam)
    {
        Dictionary <string, string> dic = MyJson.JsonToDictionary(strparam);
        ReturnValue retVal = equLogic.Delete4Ids((dic.ContainsKey("eiid") ? dic["eiid"] : "-1"));

        return(MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, retVal.OutCount.ToString()).InnerXml);
    }
    /// <summary>
    /// 批量修改时间
    /// </summary>
    /// <param name="strparam"></param>
    /// <returns></returns>
    public string BatchEditDate(string strparam)
    {
        Dictionary <string, string> dic = MyJson.JsonToDictionary(strparam);
        string   uegids    = (dic.ContainsKey("uegids") ? dic["uegids"] : string.Empty);
        DateTime begintime = Tools.GetDateTime(dic.ContainsKey("begintime") ? dic["begintime"] : string.Empty, DateTime.Now);
        DateTime endtime   = Tools.GetDateTime(dic.ContainsKey("endtime") ? dic["endtime"] : string.Empty, DateTime.Now);

        begintime = new DateTime(begintime.Year, begintime.Month, begintime.Day, 0, 0, 0);
        endtime   = new DateTime(endtime.Year, endtime.Month, endtime.Day, 23, 59, 59);

        int         errCnt = 0;
        ReturnValue retVal = null;

        try
        {
            retVal = uegLogic.BatchEditDate(uegids, new UserEquipmentGrantInfo()
            {
                StartDate = begintime, EndDate = endtime
            });
        }
        catch (Exception ex)
        {
            errCnt += 1;
            MyLog.WriteExceptionLog("BatchEditDate(批量修改时间)", ex, ex.Source);
        }

        return(MyXml.CreateResultXml(1, string.Empty, retVal.OutCount).InnerXml);
    }
    /// <summary>
    ///
    /// </summary>
    /// <param name="strparam"></param>
    /// <returns></returns>
    public string Delete4Ids(string strparam)
    {
        Dictionary <string, string> dic = MyJson.JsonToDictionary(strparam);
        //tsrid ==-1 添加 否则 修改
        ReturnValue retVal = tsrLogic.Delete4Ids((dic.ContainsKey("tsrid") ? dic["tsrid"] : "-1"));

        return(MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, string.Empty).InnerXml);
    }
    /// <summary>
    ///
    /// </summary>
    /// <param name="strparam"></param>
    /// <returns></returns>
    public string Delete(string strparam)
    {
        Dictionary <string, string> dic  = MyJson.JsonToDictionary(strparam);
        TiminGstartRecordInfo       info = new TiminGstartRecordInfo()
        {
            TSRID = dic.ContainsKey("tsrid") ? Tools.GetInt32(dic["tsrid"], -1) : -1
        };
        ReturnValue retVal = tsrLogic.Delete(info);

        return(MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, string.Empty).InnerXml);
    }
    /// <summary>
    ///
    /// </summary>
    /// <param name="strparam"></param>
    /// <returns></returns>
    public string Delete(string strparam)
    {
        Dictionary <string, string> dic  = MyJson.JsonToDictionary(strparam);
        UserEquipmentGrantInfo      info = new UserEquipmentGrantInfo()
        {
            UEGID = Tools.GetInt32((dic.ContainsKey("uegid") ? dic["uegid"] : "-1"), -1)
        };
        ReturnValue retVal = uegLogic.Delete(info);

        return(MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, retVal.OutCount.ToString()).InnerXml);
    }
    /// <summary>
    ///
    /// </summary>
    /// <param name="strparam"></param>
    /// <returns></returns>
    public string Delete(string strparam)
    {
        Dictionary <string, string> dic  = MyJson.JsonToDictionary(strparam);
        ActivationCodeInfo          info = new ActivationCodeInfo()
        {
            ACID = dic.ContainsKey("acid") ? Tools.GetInt32(dic["acid"], -1) : -1
        };
        ReturnValue retVal = acLogic.Delete(info);

        return(MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, string.Empty).InnerXml);
    }
Beispiel #8
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="strparam"></param>
    /// <returns></returns>
    public string Delete(string strparam)
    {
        Dictionary <string, string> dic = MyJson.JsonToDictionary(strparam);
        UserInfo info = new UserInfo()
        {
            UserID = Tools.GetInt32((dic.ContainsKey("userid") ? dic["userid"] : "-1"), -1)
        };
        ReturnValue retVal = userLogic.Delete(info);

        return(MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, string.Empty).InnerXml);
    }
    /// <summary>
    ///
    /// </summary>
    /// <param name="strparam"></param>
    /// <returns></returns>
    public string Delete(string strparam)
    {
        Dictionary <string, string> dic = MyJson.JsonToDictionary(strparam);
        EquipmentInfo info = new EquipmentInfo()
        {
            EIID = Tools.GetInt32((dic.ContainsKey("eiid") ? dic["eiid"] : "-1"), -1)
        };
        ReturnValue retVal = equLogic.Delete(info);

        if (retVal.IsSuccess == false)
        {
            return(MyXml.CreateTabledResultXml(new DataTable(), 0, 10, 0).InnerXml);
        }

        return(MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, string.Empty).InnerXml);
    }
Beispiel #10
0
    /// <summary>
    /// 批量添加(批量关联)
    /// </summary>
    /// <param name="strparam"></param>
    /// <returns></returns>
    public string UserEquipmentsGrant(string strparam)
    {
        Dictionary <string, string> dic = MyJson.JsonToDictionary(strparam);

        string[] eiids   = (dic.ContainsKey("eiid") ? dic["eiid"] : string.Empty).Split(',');
        string[] einames = (dic.ContainsKey("einame") ? dic["einame"] : string.Empty).Split(',');
        int      errCnt  = 0;

        for (int i = 0; i < eiids.Length; i++)
        {
            if (eiids[i].Trim().Length == 0)
            {
                continue;
            }
            try
            {
                TiminGstartRecordInfo info = new TiminGstartRecordInfo()
                {
                    UserID       = Tools.GetInt32((dic.ContainsKey("userid") ? dic["userid"] : "-1"), -1),
                    EIID         = Tools.GetInt32(eiids[i], -1),
                    TSRID        = Tools.GetInt32((dic.ContainsKey("tsrid") ? dic["tsrid"] : "-1"), -1),
                    UserName     = dic.ContainsKey("username") ? dic["username"] : string.Empty,
                    EIName       = einames[i],
                    PackName     = dic.ContainsKey("packname") ? dic["packname"] : string.Empty,
                    StartDate    = Tools.GetDateTime(dic.ContainsKey("begintime") ? dic["begintime"] : string.Empty, DateTime.Now),
                    EndDate      = Tools.GetDateTime(dic.ContainsKey("endtime") ? dic["endtime"] : string.Empty, DateTime.Now),
                    ExpStartDate = Tools.GetDateTime(dic.ContainsKey("expbegintime") ? dic["expbegintime"] : string.Empty, DateTime.Now),
                    ExpEndDate   = Tools.GetDateTime(dic.ContainsKey("expendtime") ? dic["expendtime"] : string.Empty, DateTime.Now),
                    Release      = Tools.GetInt32((dic.ContainsKey("release") ? dic["release"] : "-1"), -1),
                    Status       = 0,
                    Description  = dic.ContainsKey("description") ? dic["description"] : string.Empty
                };

                info.ExpStartDate = new DateTime(info.ExpStartDate.Year, info.ExpStartDate.Month, info.ExpStartDate.Day, 0, 0, 0);
                info.ExpEndDate   = new DateTime(info.ExpEndDate.Year, info.ExpEndDate.Month, info.ExpEndDate.Day, 23, 59, 59);
                ReturnValue retVal = tsrLogic.Insert(info);
            }
            catch (Exception ex)
            {
                errCnt += 1;
                MyLog.WriteExceptionLog("UserEquipmentsGrant(定时记录-批量添加)", ex, ex.Source);
            }
        }
        return(MyXml.CreateResultXml(1, string.Empty, (einames.Length - errCnt).ToString()).InnerXml);
    }
Beispiel #11
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="strparam"></param>
    /// <returns></returns>
    public string AddorEdit(string strparam)
    {
        Dictionary <string, string> dic  = MyJson.JsonToDictionary(strparam);
        ActivationCodeInfo          info = new ActivationCodeInfo()
        {
            ACID        = Tools.GetInt32((dic.ContainsKey("acid") ? dic["acid"] : "-1"), -1),
            ACCode      = dic.ContainsKey("accode") ? dic["accode"] : string.Empty,
            StartDate   = Tools.GetDateTime(dic.ContainsKey("begintime") ? dic["begintime"] : string.Empty, DateTime.Now),
            EndDate     = Tools.GetDateTime(dic.ContainsKey("endtime") ? dic["endtime"] : string.Empty, new DateTime(2099, 12, 31)),
            Description = dic.ContainsKey("description") ? dic["description"] : string.Empty
        };
        //acid ==-1 添加 否则 修改
        ReturnValue retVal = info.ACID == -1 ? acLogic.Insert(info) : acLogic.Update(info);

        //if (retVal.IsSuccess == false) { return MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, string.Empty).InnerXml; }
        //
        return(MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, string.Empty).InnerXml);
    }
Beispiel #12
0
    /// <summary>
    /// 客户端页面初始化时用到的初始化数据,缓存处理。
    /// 具体初始化内容由子页面通过重写CreateInitInfo函数提供
    /// </summary>
    /// <returns></returns>
    public string GetInitInfo()
    {
        XmlDocument xmlInitInfo  = null;
        string      type         = this.GetRequest("type"); //这个参数有时也有用
        string      strCacheName = string.Format("{0}_Init_{1}{2}", this.GetType().Name, this.IPApi.SMCode, type);

        if (!CheckInitCacheEnabled() || !CacheHelper.CheckCache(strCacheName))
        {
            xmlInitInfo = CreateInitInfo();
            if (xmlInitInfo == null)
            {
                xmlInitInfo = MyXml.CreateResultXml(-1, "no init info", "");
            }
            CacheHelper.SetCache(strCacheName, CreateInitInfo());
        }

        xmlInitInfo = (XmlDocument)(CacheHelper.GetCache(strCacheName));
        return(xmlInitInfo.InnerXml);
    }
Beispiel #13
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="strparam"></param>
    /// <returns></returns>
    public string AddorEdit(string strparam)
    {
        Dictionary <string, string> dic = MyJson.JsonToDictionary(strparam);
        EquipmentInfo info = new EquipmentInfo()
        {
            EIID        = Tools.GetInt32((dic.ContainsKey("eiid") ? dic["eiid"] : "-1"), -1),
            EIName      = dic.ContainsKey("einame") ? dic["einame"] : string.Empty,
            IPList      = dic.ContainsKey("iplist") ? dic["iplist"] : string.Empty,
            Status      = 0,
            HardWare    = string.Empty,
            EINumber    = string.Empty,
            Description = dic.ContainsKey("description") ? dic["description"] : string.Empty
        };
        //eiid ==-1 添加 否则 修改
        ReturnValue retVal = info.EIID == -1 ? equLogic.Insert(info) : equLogic.Update(info);

        //if (retVal.IsSuccess == false) { return MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, string.Empty).InnerXml; }
        //
        return(MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, string.Empty).InnerXml);
    }
    /// <summary>
    /// 批量添加(批量授权)
    /// </summary>
    /// <param name="strparam"></param>
    /// <returns></returns>
    public string EquipmentsGrant(string strparam)
    {
        Dictionary <string, string> dic = MyJson.JsonToDictionary(strparam);

        string[] eiids   = (dic.ContainsKey("eiid") ? dic["eiid"] : string.Empty).Split(',');
        string[] einames = (dic.ContainsKey("einame") ? dic["einame"] : string.Empty).Split(',');
        int      errCnt  = 0;

        for (int i = 0; i < eiids.Length; i++)
        {
            if (eiids[i].Trim().Length == 0)
            {
                continue;
            }
            try
            {
                UserEquipmentGrantInfo info = new UserEquipmentGrantInfo()
                {
                    UserID      = Tools.GetInt32((dic.ContainsKey("userid") ? dic["userid"] : "-1"), -1),
                    EIID        = Tools.GetInt32(eiids[i], -1),
                    UEGID       = Tools.GetInt32((dic.ContainsKey("uegid") ? dic["uegid"] : "-1"), -1),
                    UserName    = dic.ContainsKey("username") ? dic["username"] : string.Empty,
                    EIName      = einames[i],
                    StartDate   = Tools.GetDateTime(dic.ContainsKey("begintime") ? dic["begintime"] : string.Empty, DateTime.MinValue),
                    EndDate     = Tools.GetDateTime(dic.ContainsKey("endtime") ? dic["endtime"] : string.Empty, DateTime.MaxValue),
                    Description = dic.ContainsKey("description") ? dic["description"] : string.Empty
                };

                info.StartDate = new DateTime(info.StartDate.Year, info.StartDate.Month, info.StartDate.Day, 0, 0, 0);
                info.EndDate   = new DateTime(info.EndDate.Year, info.EndDate.Month, info.EndDate.Day, 23, 59, 59);
                ReturnValue retVal = uegLogic.Insert(info);
            }
            catch (Exception ex)
            {
                errCnt += 1;
                MyLog.WriteExceptionLog("EquipmentsGrant(批量添加)", ex, ex.Source);
            }
        }
        return(MyXml.CreateResultXml(1, string.Empty, (einames.Length - errCnt).ToString()).InnerXml);
    }
    /// <summary>
    ///
    /// </summary>
    /// <param name="strparam"></param>
    /// <returns></returns>
    public string AddorEdit(string strparam)
    {
        Dictionary <string, string> dic  = MyJson.JsonToDictionary(strparam);
        UserEquipmentGrantInfo      info = new UserEquipmentGrantInfo()
        {
            UserID      = Tools.GetInt32((dic.ContainsKey("userid") ? dic["userid"] : "-1"), -1),
            EIID        = Tools.GetInt32((dic.ContainsKey("eiid") ? dic["eiid"] : "-1"), -1),
            UEGID       = Tools.GetInt32((dic.ContainsKey("uegid") ? dic["uegid"] : "-1"), -1),
            UserName    = dic.ContainsKey("username") ? dic["username"] : string.Empty,
            EIName      = dic.ContainsKey("einame") ? dic["einame"] : string.Empty,
            StartDate   = Tools.GetDateTime(dic.ContainsKey("begintime") ? dic["begintime"] : string.Empty, DateTime.MinValue),
            EndDate     = Tools.GetDateTime(dic.ContainsKey("endtime") ? dic["endtime"] : string.Empty, DateTime.MaxValue),
            Description = dic.ContainsKey("description") ? dic["description"] : string.Empty
        };

        info.StartDate = new DateTime(info.StartDate.Year, info.StartDate.Month, info.StartDate.Day, 0, 0, 0);
        info.EndDate   = new DateTime(info.EndDate.Year, info.EndDate.Month, info.EndDate.Day, 23, 59, 59);
        //uegid ==-1 添加 否则 修改
        ReturnValue retVal = info.UEGID == -1 ? uegLogic.Insert(info) : uegLogic.Update(info);

        return(MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, string.Empty).InnerXml);
    }
Beispiel #16
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="strparam"></param>
    /// <returns></returns>
    public string AddorEdit(string strparam)
    {
        Dictionary <string, string> dic = MyJson.JsonToDictionary(strparam);
        UserInfo info = new UserInfo()
        {
            UserID      = Tools.GetInt32((dic.ContainsKey("userid") ? dic["userid"] : "-1"), -1),
            UserName    = dic.ContainsKey("username") ? dic["username"] : string.Empty,
            UserNick    = dic.ContainsKey("usernick") ? dic["usernick"] : string.Empty,
            MobilePhone = dic.ContainsKey("mobilephone") ? dic["mobilephone"] : string.Empty,
            UserType    = Tools.GetInt32(dic["usertype"], -1),
            Status      = 0,
            UserPwd     = dic.ContainsKey("userpwd") ? dic["userpwd"] : string.Empty,
            Description = dic.ContainsKey("description") ? dic["description"] : string.Empty
        };
        //if (info.UserID == -1) { info.UserPwd = dic.ContainsKey("userpwd") ? dic["userpwd"] : string.Empty; }
        //userid ==-1 添加 否则 修改
        ReturnValue retVal = info.UserID == -1 ? userLogic.Insert(info) : userLogic.Update(info);

        //if (retVal.IsSuccess == false) { return MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, string.Empty).InnerXml; }
        //
        return(MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, string.Empty).InnerXml);
    }
Beispiel #17
0
    /// <summary>
    /// 修改密码
    /// </summary>
    /// <param name="oldPass">原密码</param>
    /// <param name="newPass">新密码</param>
    /// <returns>修改密码是否成功 0/-1 成功/失败</returns>
    public string ChangePass(string oldPass, string newPass)
    {
        UserLogic   userLogin = new UserLogic();
        ReturnValue retVal    = userLogin.GetUserById(new UserInfo()
        {
            UserName = IPApi.UserCode
        });

        if (retVal.IsSuccess == false)
        {
            return(MyXml.CreateResultXml(-9, Consts.EXP_Info, string.Empty).InnerXml);
        }
        UserInfo info = retVal.RetObj as UserInfo;

        if (oldPass != info.UserPwd)
        {
            return(MyXml.CreateResultXml(-8, "原密码错误", string.Empty).InnerXml);
        }
        retVal = userLogin.UpdatePassWord(new UserInfo()
        {
            UserPwd = newPass, UserID = info.UserID
        });
        return(MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, string.Empty).InnerXml);
    }
Beispiel #18
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="strparam"></param>
    /// <returns></returns>
    public string AddorEdit(string strparam)
    {
        Dictionary <string, string> dic  = MyJson.JsonToDictionary(strparam);
        TiminGstartRecordInfo       info = new TiminGstartRecordInfo()
        {
            UserID       = Tools.GetInt32((dic.ContainsKey("userid") ? dic["userid"] : "-1"), -1),
            EIID         = Tools.GetInt32((dic.ContainsKey("eiid") ? dic["eiid"] : "-1"), -1),
            TSRID        = Tools.GetInt32((dic.ContainsKey("tsrid") ? dic["tsrid"] : "-1"), -1),
            UserName     = dic.ContainsKey("username") ? dic["username"] : string.Empty,
            EIName       = dic.ContainsKey("einame") ? dic["einame"] : string.Empty,
            PackName     = dic.ContainsKey("packname") ? dic["packname"] : string.Empty,
            StartDate    = Tools.GetDateTime(dic.ContainsKey("begintime") ? dic["begintime"] : string.Empty, DateTime.MinValue),
            EndDate      = Tools.GetDateTime(dic.ContainsKey("endtime") ? dic["endtime"] : string.Empty, DateTime.MaxValue),
            ExpStartDate = Tools.GetDateTime(dic.ContainsKey("expbegintime") ? dic["expbegintime"] : string.Empty, DateTime.MinValue),
            ExpEndDate   = Tools.GetDateTime(dic.ContainsKey("expendtime") ? dic["expendtime"] : string.Empty, DateTime.MaxValue),
            Release      = Tools.GetInt32((dic.ContainsKey("release") ? dic["release"] : "-1"), -1),
            Status       = 0,
            Description  = dic.ContainsKey("description") ? dic["description"] : string.Empty
        };
        //tsrid ==-1 添加 否则 修改
        ReturnValue retVal = info.TSRID == -1 ? tsrLogic.Insert(info) : tsrLogic.Update(info);

        return(MyXml.CreateResultXml(retVal.RetCode, retVal.RetMsg, string.Empty).InnerXml);
    }
Beispiel #19
0
    /// <summary>
    /// 心跳包处理(ipapi定时自动向webservice向送心跳,此处只处理webclient向本webserver发送的心跳)
    /// todo:保留返回消息
    /// </summary>
    /// <returns></returns>
    public string HeartBeat()
    {
        XmlDocument xmlDoc = MyXml.CreateResultXml(mTestFlag++, "保留", string.Empty);

        return(xmlDoc.InnerXml); // IPApi.HeartBeat(5) ? 1 : 0;
    }
Beispiel #20
0
    protected override void OnInit(EventArgs e)
    {
        if (this.Request["ajaxflag"] != null) //&& (this.Request.InputStream.Length > 0))
        {
            /* 当客户端以post方法提交soap请求,认为是客户端提交了AJAX请求
             * 具体的处理过程由虚方法responseAJAX实现
             * 子类页面可以重载其实现过程
             * 若不能在相应的子类页面中找到实现过程,系统将按原请求的流程进行处理
             */

            //0/1 json(jquery)/soap
            int ajaxtype = MyType.ToInt(this.Request["ajaxflag"]);

            if (ajaxtype == 0)
            {
                #region AJAX请求处理(JQuery调用,JSON格式)

                string methodName = this.Request["webmethodname"];

                Hashtable htParam = new Hashtable();
                foreach (string strkey in this.Request.Form.AllKeys)
                {
                    //htParam.Add(strkey.ToLower(), this.Request.Form[strkey]);
                    string value = this.Request.Form[strkey].Replace("&lt;", "<").Replace("&gt;", ">").Replace("&amp;", "&");
                    htParam.Add(strkey.ToLower(), value);
                }

                object objRet = null;
                string strXml = "";
                if (responseAJAX(methodName, htParam, ref objRet))
                {
                    if (objRet.GetType() == typeof(XmlDocument))
                    {
                        strXml = (objRet as XmlDocument).InnerXml;
                    }
                    else
                    {
                        if (MyXml.LoadXml(objRet.ToString()) == null)
                        {
                            MyLog.WriteLogInfo(string.Format("WebService:{0} 返回结果非xml格式", methodName));
                            strXml = MyXml.CreateResultXml(0, "", objRet).InnerXml;
                        }
                        else
                        {
                            strXml = objRet.ToString();
                        }
                    }
                }
                else
                {
                    string strErr = "responseAJAX error:"
                                    + "\r\n  url:" + this.Request.Url.LocalPath
                                    + "\r\n  method:" + methodName
                                    + "\r\n  message:" + objRet;
                    Pro.Common.MyLog.WriteLogInfo(strErr);

                    strXml = MyXml.CreateResultXml(-1, strErr, "").InnerXml;
                }
                Response.ContentType = "text/xml";
                Response.Charset     = "UTF-8";
                Response.Write(strXml);
                Response.End();

                #endregion
            }
            else
            {
                #region AJAX请求处理(SOAP方式)

                XmlDocument xmlRequest = MyXml.CreateXml();
                try
                {
                    xmlRequest.Load(this.Request.InputStream);
                    if (xmlRequest == null)
                    {
                        return;
                    }
                }
                catch
                {
                    return;
                }
                XmlNamespaceManager man = new XmlNamespaceManager(xmlRequest.NameTable);
                man.AddNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
                man.AddNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
                man.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/");

                XmlNode soapNode = xmlRequest.SelectSingleNode("soap:Envelope/soap:Body", man);
                if (soapNode == null)
                {
                    return;
                }

                XmlNode methodNode = soapNode.ChildNodes[0];
                if (methodNode == null)
                {
                    return;
                }
                string methodName = methodNode.Name;

                Hashtable htParam = new Hashtable();
                foreach (XmlNode paramNode in methodNode.ChildNodes)
                {
                    if (htParam[paramNode.Name.ToLower()] == null)
                    {
                        htParam.Add(paramNode.Name.ToLower(), paramNode.InnerText);
                    }
                }

                object objRet = null;
                string strXml = "";
                if (responseAJAX(methodName, htParam, ref objRet))
                {
                    string strResult = "";
                    if (objRet.GetType() == typeof(XmlDocument))
                    {
                        strResult = (objRet as XmlDocument).InnerXml;
                    }
                    else
                    {
                        strResult = objRet.ToString();
                    }

                    strXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
                             + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""
                             + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
                             + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
                             + "<soap:Body>"
                             + "<" + methodName + "Response xmlns=\"http://tempuri.org/\">"
                             + "<" + methodName + "Result>"
                             + strResult.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;")
                             + "</" + methodName + "Result></" + methodName + "Response></soap:Body></soap:Envelope>";
                }
                else
                {
                    string strErr = "responseAJAX error:"
                                    + "\r\n  url:" + this.Request.Url.LocalPath
                                    + "\r\n  method:" + methodName
                                    + "\r\n  message:" + objRet;
                    MyLog.WriteLogInfo(strErr);

                    strXml = MyXml.CreateResultXml(-1, strErr, "").InnerXml;
                }
                Response.ContentType = "text/xml";
                Response.Charset     = "UTF-8";
                Response.Write(strXml);
                Response.End();

                #endregion
            }
        }
        else
        {
            base.OnInit(e);
        }
    }
    protected override XmlDocument CreateInitInfo()
    {
        XmlDocument xmlDoc = MyXml.CreateResultXml(0, "", string.Empty);

        return(xmlDoc);
    }
Beispiel #22
0
    //public bool _CheckInitCacheEnabled = true;

    /// <summary>
    /// 生成初始化数据函数
    /// </summary>
    /// <returns></returns>
    protected virtual XmlDocument CreateInitInfo()
    {
        return(MyXml.CreateResultXml(-1, "no init info", ""));
    }
Beispiel #23
0
    /// <summary>
    ///
    /// </summary>
    /// <returns></returns>
    protected override XmlDocument CreateInitInfo()
    {
        //删除过期设备
        //ReturnValue retVal = uegLogic.DeleteExpire(new UserEquipmentGrantInfo() { EndDate = DateTime.Now });
        //if (retVal.IsSuccess == false) { return MyXml.CreateResultXml(-1, "删除过期授权设备时异常", string.Empty); }

        XmlDocument xmlDoc   = MyXml.CreateResultXml(1, string.Empty, string.Empty);
        XmlNode     rootNode = xmlDoc.SelectSingleNode("xml");

        XmlNode userNode               = MyXml.AddXmlNode(rootNode, "users");
        XmlNode equipmentsNode         = MyXml.AddXmlNode(rootNode, "equipments");
        XmlNode grantequipmentsNode    = MyXml.AddXmlNode(rootNode, "grantequipments");
        XmlNode notgrantequipmentsNode = MyXml.AddXmlNode(rootNode, "notgrantequipments");
        //用户对象
        ReturnValue retVal = userLogic.GetUser(new UserInfo()
        {
            UserID = -1
        });

        if (retVal.IsSuccess == false)
        {
            return(MyXml.CreateResultXml(-1, "加载用户时异常", string.Empty));
        }
        {//排序
            DataView dv = retVal.RetDt.DefaultView;
            dv.Sort      = "username";
            retVal.RetDt = dv.ToTable();
        }
        foreach (DataRow dr in retVal.RetDt.Rows)
        {
            XmlNode itemNode = MyXml.AddXmlNode(userNode, "item");
            MyXml.AddAttribute(itemNode, "key", dr["userid"]);
            MyXml.AddAttribute(itemNode, "name", string.Format("{0}【{1}】", dr["username"], dr["usernick"]));
        }

        //设备对象
        retVal = equLogic.GetEquipment(new EquipmentInfo()
        {
            EIID = -1
        });
        if (retVal.IsSuccess == false)
        {
            return(MyXml.CreateResultXml(-1, "加载设备时异常", string.Empty));
        }
        {//排序
            DataView dv = retVal.RetDt.DefaultView;
            dv.Sort      = "einame";
            retVal.RetDt = dv.ToTable();
        }
        foreach (DataRow dr in retVal.RetDt.Rows)
        {
            XmlNode itemNode = MyXml.AddXmlNode(equipmentsNode, "item");
            MyXml.AddAttribute(itemNode, "key", dr["eiid"]);
            MyXml.AddAttribute(itemNode, "name", dr["einame"]);
        }

        //未授权设备对象
        retVal = equLogic.GetNotGrantEquipment(new EquipmentInfo()
        {
            EIID = -1
        });
        if (retVal.IsSuccess == false)
        {
            return(MyXml.CreateResultXml(-1, "加载未授权设备时异常", string.Empty));
        }
        {//排序
            DataView dv = retVal.RetDt.DefaultView;
            dv.Sort      = "einame";
            retVal.RetDt = dv.ToTable();
        }
        foreach (DataRow dr in retVal.RetDt.Rows)
        {
            XmlNode itemNode = MyXml.AddXmlNode(notgrantequipmentsNode, "item");
            MyXml.AddAttribute(itemNode, "key", dr["eiid"]);
            MyXml.AddAttribute(itemNode, "name", dr["einame"]);
        }

        //昂前登录用户授权设备对象
        retVal = uegLogic.GetUserEquGrant(new UserEquipmentGrantInfo()
        {
            UserID = Tools.GetInt32(IPApi.UserID, int.MaxValue)
        });
        if (retVal.IsSuccess == false)
        {
            return(MyXml.CreateResultXml(-1, "加载未授权设备时异常", string.Empty));
        }
        {//排序
            DataView dv = retVal.RetDt.DefaultView;
            dv.Sort      = "einame";
            retVal.RetDt = dv.ToTable();
        }
        foreach (DataRow dr in retVal.RetDt.Rows)
        {
            XmlNode itemNode = MyXml.AddXmlNode(grantequipmentsNode, "item");
            MyXml.AddAttribute(itemNode, "key", dr["eiid"]);
            MyXml.AddAttribute(itemNode, "name", dr["einame"]);
        }

        return(xmlDoc);
    }