public void ProcessRequest(System.Web.HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int num = 0;

            int.TryParse(context.Request["id"].ToString(), out num);
            if (num > 0)
            {
                CustomerServiceInfo customer = CustomerServiceHelper.GetCustomer(num);
                var value = new
                {
                    type     = "success",
                    userver  = customer.userver,
                    password = customer.password,
                    nickname = customer.nickname
                };
                string s = JsonConvert.SerializeObject(value);
                context.Response.Write(s);
                return;
            }
            var value2 = new
            {
                type     = "success",
                userver  = string.Empty,
                password = string.Empty,
                nickname = string.Empty
            };
            string s2 = JsonConvert.SerializeObject(value2);

            context.Response.Write(s2);
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int result = 0;

            int.TryParse(context.Request["id"].ToString(), out result);
            if (result > 0)
            {
                CustomerServiceInfo customer = CustomerServiceHelper.GetCustomer(result);
                var typea = new {
                    type     = "success",
                    userver  = customer.userver,
                    password = customer.password,
                    nickname = customer.nickname
                };
                string s = JsonConvert.SerializeObject(typea);
                context.Response.Write(s);
            }
            else
            {
                var typea2 = new {
                    type     = "success",
                    userver  = string.Empty,
                    password = string.Empty,
                    nickname = string.Empty
                };
                string str2 = JsonConvert.SerializeObject(typea2);
                context.Response.Write(str2);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            wid = context.Session[DTKeys.SESSION_WEB_ID] as string;
            if (string.IsNullOrEmpty(wid))
            {
                return;
            }
            context.Response.ContentType = "text/plain";
            int result = 0;

            int.TryParse(context.Request["id"].ToString(), out result);
            if (result > 0)
            {
                CustomerServiceInfo     customer       = CustomerServiceHelper.GetCustomer(result);
                CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);
                string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);
                if (!string.IsNullOrEmpty(tokenValue))
                {
                    string str2 = CustomerApi.DeleteCustomer(tokenValue, customer.unit, customer.userver);
                    if (!string.IsNullOrWhiteSpace(str2))
                    {
                        string jsonValue = Common.GetJsonValue(str2, "errcode");
                        string str4      = Common.GetJsonValue(str2, "errmsg");
                        if (jsonValue == "0")
                        {
                            if (CustomerServiceHelper.DeletCustomer(result))
                            {
                                context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
                            }
                            else
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"删除客服失败!\"}");
                            }
                        }
                        else
                        {
                            context.Response.Write("{\"type\":\"error\",\"data\":\"" + str4 + "\"}");
                        }
                    }
                    else
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"删除客服失败!\"}");
                    }
                }
                else
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"获取access_token失败!\"}");
                }
            }
        }
Exemple #4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (Globals.GetCurrentManagerUserId() <= 0)
            {
                context.Response.Write("{\"type\":\"error\",\"data\":\"请先登录\"}");
                context.Response.End();
            }
            int result = 0;

            int.TryParse(context.Request["id"].ToString(), out result);
            if (result > 0)
            {
                CustomerServiceInfo     customer       = CustomerServiceHelper.GetCustomer(result);
                CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);
                string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);
                if (!string.IsNullOrEmpty(tokenValue))
                {
                    string str2 = CustomerApi.DeleteCustomer(tokenValue, customer.unit, customer.userver);
                    if (!string.IsNullOrWhiteSpace(str2))
                    {
                        string jsonValue = Hishop.MeiQia.Api.Util.Common.GetJsonValue(str2, "errcode");
                        string str4      = Hishop.MeiQia.Api.Util.Common.GetJsonValue(str2, "errmsg");
                        if (jsonValue == "0")
                        {
                            if (CustomerServiceHelper.DeletCustomer(result))
                            {
                                context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
                            }
                            else
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"删除客服失败!\"}");
                            }
                        }
                        else
                        {
                            context.Response.Write("{\"type\":\"error\",\"data\":\"" + str4 + "\"}");
                        }
                    }
                    else
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"删除客服失败!\"}");
                    }
                }
                else
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"获取access_token失败!\"}");
                }
            }
        }
        public void ProcessRequest(System.Web.HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int num = 0;

            int.TryParse(context.Request["id"].ToString(), out num);
            if (num > 0)
            {
                CustomerServiceInfo     customer       = CustomerServiceHelper.GetCustomer(num);
                CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);
                string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);
                if (!string.IsNullOrEmpty(tokenValue))
                {
                    string text = CustomerApi.DeleteCustomer(tokenValue, customer.unit, customer.userver);
                    if (string.IsNullOrWhiteSpace(text))
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"删除客服失败!\"}");
                        return;
                    }
                    string jsonValue  = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text, "errcode");
                    string jsonValue2 = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text, "errmsg");
                    if (!(jsonValue == "0"))
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"" + jsonValue2 + "\"}");
                        return;
                    }
                    bool flag = CustomerServiceHelper.DeletCustomer(num);
                    if (flag)
                    {
                        context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
                        return;
                    }
                    context.Response.Write("{\"type\":\"error\",\"data\":\"删除客服失败!\"}");
                    return;
                }
                else
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"获取access_token失败!\"}");
                }
            }
        }
Exemple #6
0
        public void ProcessRequest(System.Web.HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int num = 0;

            int.TryParse(context.Request["id"].ToString(), out num);
            CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);
            string unit       = masterSettings.unit;
            string text       = context.Request["userver"].ToString();
            string password   = context.Request["password"].ToString();
            string text2      = context.Request["nickname"].ToString();
            string value      = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
            string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);

            if (string.IsNullOrEmpty(tokenValue))
            {
                context.Response.Write("{\"type\":\"error\",\"data\":\"获取access_token失败!\"}");
                return;
            }
            System.Collections.Generic.Dictionary <string, string> dictionary = new System.Collections.Generic.Dictionary <string, string>();
            dictionary.Add("unit", unit);
            dictionary.Add("userver", text);
            dictionary.Add("password", value);
            dictionary.Add("nickname", text2);
            dictionary.Add("realname", "");
            dictionary.Add("level", "");
            dictionary.Add("tel", "");
            string empty = string.Empty;
            CustomerServiceInfo customerServiceInfo = new CustomerServiceInfo();

            if (num != 0)
            {
                string text3 = CustomerApi.UpdateCustomer(tokenValue, dictionary);
                if (string.IsNullOrWhiteSpace(text3))
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"修改客服信息失败!\"}");
                    return;
                }
                string jsonValue  = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text3, "errcode");
                string jsonValue2 = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text3, "errmsg");
                if (!(jsonValue == "0"))
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"" + jsonValue2 + "\"}");
                    return;
                }
                customerServiceInfo          = CustomerServiceHelper.GetCustomer(num);
                customerServiceInfo.unit     = unit;
                customerServiceInfo.userver  = text;
                customerServiceInfo.password = password;
                customerServiceInfo.nickname = text2;
                bool flag = CustomerServiceHelper.UpdateCustomer(customerServiceInfo, ref empty);
                if (flag)
                {
                    context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
                    return;
                }
                context.Response.Write("{\"type\":\"error\",\"data\":\"" + empty + "\"}");
                return;
            }
            else
            {
                string text4 = CustomerApi.CreateCustomer(tokenValue, dictionary);
                if (string.IsNullOrWhiteSpace(text4))
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"注册客服用户失败!\"}");
                    return;
                }
                string jsonValue3 = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text4, "errcode");
                string jsonValue4 = Hishop.MeiQia.Api.Util.Common.GetJsonValue(text4, "errmsg");
                if (!(jsonValue3 == "0"))
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"" + jsonValue4 + "\"}");
                    return;
                }
                customerServiceInfo.unit     = unit;
                customerServiceInfo.userver  = text;
                customerServiceInfo.password = password;
                customerServiceInfo.nickname = text2;
                int num2 = CustomerServiceHelper.CreateCustomer(customerServiceInfo, ref empty);
                if (num2 > 0)
                {
                    context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
                    return;
                }
                context.Response.Write("{\"type\":\"error\",\"data\":\"" + empty + "\"}");
                return;
            }
        }
Exemple #7
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (Globals.GetCurrentManagerUserId() <= 0)
            {
                context.Response.Write("{\"type\":\"error\",\"data\":\"请先登录\"}");
                context.Response.End();
            }
            int result = 0;

            int.TryParse(context.Request["id"].ToString(), out result);
            CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);
            string unit       = masterSettings.unit;
            string str2       = context.Request["userver"].ToString();
            string password   = context.Request["password"].ToString();
            string str4       = context.Request["nickname"].ToString();
            string str5       = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
            string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);

            if (!string.IsNullOrEmpty(tokenValue))
            {
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("unit", unit);
                parameters.Add("userver", str2);
                parameters.Add("password", str5);
                parameters.Add("nickname", str4);
                parameters.Add("realname", "");
                parameters.Add("level", "");
                parameters.Add("tel", "");
                string msg = string.Empty;
                CustomerServiceInfo customer = new CustomerServiceInfo();
                if (result != 0)
                {
                    string str8 = CustomerApi.UpdateCustomer(tokenValue, parameters);
                    if (!string.IsNullOrWhiteSpace(str8))
                    {
                        string jsonValue = Hishop.MeiQia.Api.Util.Common.GetJsonValue(str8, "errcode");
                        string str10     = Hishop.MeiQia.Api.Util.Common.GetJsonValue(str8, "errmsg");
                        if (jsonValue == "0")
                        {
                            customer          = CustomerServiceHelper.GetCustomer(result);
                            customer.unit     = unit;
                            customer.userver  = str2;
                            customer.password = password;
                            customer.nickname = str4;
                            if (CustomerServiceHelper.UpdateCustomer(customer, ref msg))
                            {
                                context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
                            }
                            else
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"" + msg + "\"}");
                            }
                        }
                        else
                        {
                            context.Response.Write("{\"type\":\"error\",\"data\":\"" + str10 + "\"}");
                        }
                    }
                    else
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"修改客服信息失败!\"}");
                    }
                }
                else
                {
                    string str11 = CustomerApi.CreateCustomer(tokenValue, parameters);
                    if (!string.IsNullOrWhiteSpace(str11))
                    {
                        string str12 = Hishop.MeiQia.Api.Util.Common.GetJsonValue(str11, "errcode");
                        string str13 = Hishop.MeiQia.Api.Util.Common.GetJsonValue(str11, "errmsg");
                        if (str12 == "0")
                        {
                            customer.unit     = unit;
                            customer.userver  = str2;
                            customer.password = password;
                            customer.nickname = str4;
                            if (CustomerServiceHelper.CreateCustomer(customer, ref msg) > 0)
                            {
                                context.Response.Write("{\"type\":\"success\",\"data\":\"\"}");
                            }
                            else
                            {
                                context.Response.Write("{\"type\":\"error\",\"data\":\"" + msg + "\"}");
                            }
                        }
                        else
                        {
                            context.Response.Write("{\"type\":\"error\",\"data\":\"" + str13 + "\"}");
                        }
                    }
                    else
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"注册客服用户失败!\"}");
                    }
                }
            }
            else
            {
                context.Response.Write("{\"type\":\"error\",\"data\":\"获取access_token失败!\"}");
            }
        }