Exemple #1
0
        /// <summary> 删除</summary>
        public ActionResult Delete(int id)
        {
            if (!IsLogin)
            {
                return(Redirect("/Home/Login"));
            }
            if (user == null)
            {
                return(Redirect("/Home/Login"));
            }
            if (id == 0)
            {
                return(Redirect("/System/Account"));
            }

            //POST api/System/{id}?token={token}
            var api = new ApiReceive
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = String.Format("api/System/{0}?token={1}", id, user.token),
            };

            var result = api.PostJsonToFromBody();

            api.Dispose();
            var rm = CommonHelper.Deserialize <User>(result);

            if (rm.result == 1)
            {
                return(Redirect("/System/Account"));
            }
            ViewBag.Error   = -1;
            ViewBag.Message = rm.message;
            return(Redirect("/System/Account"));
        }
Exemple #2
0
        public ActionResult Index(FormCollection collection)
        {
            try
            {
                var name = collection["Name"];
                var pwd  = collection["PassWord"];
                var cpwd = collection["ConfirmPassWord"];

                if (pwd != cpwd)
                {
                    return(View());
                }

                var api = new ApiReceive
                {
                    URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                    Resource = String.Format("api/System?name={0}&pwd={1}&confirm={2}", name, pwd, cpwd),
                };

                var result = api.GetJsonToFromBody();
                api.Dispose();
                return(View());
            }
            catch (Exception ex)
            {
                return(View(ex));
            }
        }
Exemple #3
0
        public ActionResult RescueGm(Int32 id)
        {
            if (!IsLogin)
            {
                return(Redirect("/Home/Login"));
            }
            if (id == 0)
            {
                return(Redirect("/GM/RecordList"));
            }

            var api = new ApiReceive
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = String.Format("api/GM?token={0}&gid={1}", user.token, id),
            };
            var result = api.PostJsonToFromBody();
            var gm     = CommonHelper.Deserialize <GmManage>(result);

            if (gm.result == 1)
            {
                return(Redirect("/GM/RecordList"));
            }
            ViewBag.Error   = -1;
            ViewBag.Message = gm.message;
            return(Redirect("/GM/RecordList"));
        }
Exemple #4
0
        public ActionResult Approval(FormCollection collection)
        {
            if (!IsLogin)
            {
                return(Redirect("/Home/Login"));
            }
            var platform = collection["platform"];
            var sid      = collection["server"];
            var type     = collection["type"];

            if (platform == "" || sid == "")
            {
                ViewBag.Error    = -1;
                ViewBag.Message  = "请选择平台和服务器";
                ViewBag.Platform = new List <Platform>();
                ViewBag.Resource = new List <Resource>();
                return(View());
            }
            var api = new ApiReceive
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/Resource?token={0}&pid={1}&sid={2}&roleid={3}&state={4}", user.token, Convert.ToInt64(platform), Convert.ToInt64(sid), user.id, type),
            };
            var result = api.PostJsonToFromBody();

            api.Dispose();
            var list = CommonHelper.Deserialize <List <Resource> >(result);

            ViewBag.Resource = list;
            var list2 = ApiPlatforms();

            ViewBag.Platform = list2;
            return(View());
        }
Exemple #5
0
        /// <summary>GM操作记录</summary>
        public ActionResult RecordList(Int32 index = 1, Int32 size = 10)
        {
            if (!IsLogin)
            {
                return(Redirect("/Home/Login"));
            }
            ViewBag.Platform = ApiPlatforms();
            ViewBag.Role     = user.role;

            //api/GM?token={token}&role={role}&pid={pid}&index={index}&size={size}
            var api = new ApiReceive()
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/GM?token={0}&role={1}&pid={2}&index={3}&size={4}", user.token, user.role, user.pid, index, size),
            };

            var result = api.PostJsonToParameter();

            api.Dispose();
            var list  = CommonHelper.Deserialize <PageGmManage>(result);
            var query = new PagerQuery <PagerInfo, List <GmManage> >(list.Pager, list.Gms);

            if (query.result < 0)
            {
                ViewBag.Error   = -1;
                ViewBag.Message = query.message;
                return(View());
            }
            return(View(query));
        }
Exemple #6
0
        public ActionResult Delete(Int64 id)
        {
            if (!IsLogin)
            {
                return(Redirect("/Home/Login"));
            }
            if (user == null)
            {
                return(Redirect("/Home/Login"));
            }

            var api = new ApiReceive
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = String.Format("api/Resource?token={0}&id={1}&flag={2}", user.token, id, true),
            };

            var result = api.PostJsonToFromBody();

            api.Dispose();
            var rm = CommonHelper.Deserialize <Resource>(result);

            if (rm.result == 1)
            {
                return(Redirect("/Resource/Approval"));
            }
            ViewBag.Error   = -1;
            ViewBag.Message = rm.message;
            return(Redirect("/Resource/Approval"));
        }
Exemple #7
0
        //
        // GET: /Goods/

        public ActionResult GoodsManage(Int32 index = 1, Int32 size = 10)
        {
            if (!IsLogin)
            {
                return(Redirect("/Home/Login"));
            }

            //api/Goods?token={token}&role={role}&index={index}&size={size}
            var api = new ApiReceive()
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/Goods?token={0}&role={1}&index={2}&size={3}", user.token, user.role, index, size),
            };

            var result = api.PostJsonToParameter();

            api.Dispose();
            var list = CommonHelper.Deserialize <PagerGoodsType>(result);

            var query = new PagerQuery <PagerInfo, List <GoodsType> >(list.Pager, list.GoodsType);

            if (query.result >= 0)
            {
                return(View(query));
            }

            ViewBag.Error   = -1;
            ViewBag.Message = query.message;
            return(View());
        }
        public FileResult AjaxExcel(FormCollection collection)
        {
            var pid        = Convert.ToInt32(collection["pid"]);
            var excel_type = Convert.ToInt32(collection["excel_type"]);
            var excel_kind = collection["excel_kind"];

            //api/Common?pid={pid}&type={type}&order={order}
            var api = new ApiReceive()
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource =
                    string.Format("api/Common?pid={0}&type={1}&order={2}", pid, excel_type, excel_kind),
            };
            var result = api.PostJsonToParameter();

            api.Dispose();
            var list = CommonHelper.Deserialize <List <ReportCode> >(result);

            if (!list.Any())
            {
                list.Add(new ReportCode());
            }

            var html = ExcelHelper.ToHtmlTable(list);

            var name = String.Format("{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss"));

            //第一种:使用FileContentResult
            byte[] fileContents = Encoding.UTF8.GetBytes(html);
            return(File(fileContents, "application/ms-excel", name));

            //第二种:使用FileStreamResult
            //var fileStream = new MemoryStream(fileContents);
            //return File(fileStream, "application/ms-excel", "excel.xls");
        }
Exemple #9
0
        /// <summary>删除福利卡类型</summary>
        public ActionResult DeleteType(Int32 id)
        {
            if (!IsLogin)
            {
                return(Redirect("/Home/Login"));
            }

            //Post api/Goods?token={token}&gid={gid}&role={role}&b={b}
            var api = new ApiReceive()
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/Goods?token={0}&gid={1}&&role={2}&b={3}", user.token, id, user.role, 0),
            };
            var result = api.PostJsonToParameter();

            api.Dispose();
            var entity = CommonHelper.Deserialize <BaseEntity>(result);

            if (entity.result == 1)
            {
                return(Redirect("/Goods/GoodsManage"));
            }
            ViewBag.Error   = -1;
            ViewBag.Message = entity.message;
            return(Redirect("/Goods/GoodsManage"));
        }
Exemple #10
0
        public ActionResult Login(FormCollection collection)
        {
            try
            {
                var name = collection["Name"];
                var cpwd = collection["PassWord"];

                //api/System?name={name}&password={password}
                var api = new ApiReceive
                {
                    URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                    Resource = string.Format("api/System?name={0}&password={1}", name, cpwd),
                };
                var result = api.PostJsonToParameter();
                var entity = CommonHelper.Deserialize <User>(result);
                api.Dispose();
                if (entity.result == 1)
                {
                    Session.Add("user", entity);
                    Session.Timeout = 60;
                    return(RedirectToAction("Index"));
                }
                ViewBag.msg   = entity.message;
                ViewBag.error = 1;
                return(View());
            }
            catch
            {
                return(View());
            }
        }
Exemple #11
0
 public JsonResult PagerHandler(Int32 page, Int32 size, string pid, string sid, string start, string end, string type, string playername)
 {
     if (pid == "0" && sid == "0")
     {
         var api = new ApiReceive()
         {
             URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
             Resource = string.Format("api/Pay?token={0}&role={1}&pid={2}&index={3}&size={4}", user.token, user.role, user.pid, page, size),
         };
         var result = api.PostJsonToFromBody();
         api.Dispose();
         var totalpay = CommonHelper.Deserialize <PagerPay>(result);
         return(Json(totalpay, JsonRequestBehavior.AllowGet));
     }
     else
     {
         var pager = new PagerTotalPay();
         if (start != "" && start != "0" && end == "" || end == "0")
         {
             pager.result  = -1;
             pager.message = "没有选结束时间";
             return(Json(pager, JsonRequestBehavior.AllowGet));
         }
         if (end != "" && end != "0" && start == "" || start == "0")
         {
             pager.result  = -1;
             pager.message = "没有选开始时间";
             return(Json(pager, JsonRequestBehavior.AllowGet));
         }
         if (sid == "0")
         {
             pager.result  = -1;
             pager.message = "没有选服务器";
             return(Json(pager, JsonRequestBehavior.AllowGet));
         }
         if (playername == "")
         {
             pager.result  = -1;
             pager.message = "没有选玩家";
             return(Json(pager, JsonRequestBehavior.AllowGet));
         }
         Int64 stick = 0;
         Int64 etick = 0;
         if (start != "" && start != "0" && end != "" && end != "0")
         {
             stick = DateTime.Parse(start).Ticks;
             etick = DateTime.Parse(end).Ticks;
         }
         var api = new ApiReceive()
         {
             URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
             Resource = string.Format("api/Pay?token={0}&pid={1}&sid={2}&start={3}&end={4}&type={5}&playname={6}&userpid={7}&role={8}&index={9}&size={10}", user.token, Convert.ToInt32(pid), Convert.ToInt32(sid), stick, etick, Convert.ToInt32(type), playername, user.pid, user.role, page, size),
         };
         var result = api.PostJsonToFromBody();
         api.Dispose();
         var totalpay = CommonHelper.Deserialize <PagerPay>(result);
         return(Json(totalpay, JsonRequestBehavior.AllowGet));
     }
 }
Exemple #12
0
        public ActionResult GoodsTypeEdit(FormCollection collection)
        {
            try
            {
                if (!IsLogin)
                {
                    return(Redirect("/Home/Login"));
                }

                var gid  = collection["gid"];
                var type = collection["typeId"];
                var name = collection["name"];

                if (string.IsNullOrEmpty(type) || string.IsNullOrEmpty(name))
                {
                    ViewBag.Error   = -1;
                    ViewBag.Message = "请编辑完整信息";
                    return(Redirect("/Goods/GoodsManage"));
                }

                if (!Regex.IsMatch(type, @"^\d+$"))
                {
                    ViewBag.Error   = -1;
                    ViewBag.Message = "福利卡枚举类型ID格式错误,请重新输入";
                    return(View());
                }

                var goodtype = new GoodsType()
                {
                    id      = Convert.ToInt32(gid),
                    type_id = Convert.ToInt32(type),
                    name    = name,
                };
                //POST api/System?token={token}&gid={gid}&typeId={typeId}&name={name}&b={b}
                var api = new ApiReceive()
                {
                    URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                    Resource =
                        string.Format("api/Goods?token={0}&gid={1}&typeId={2}&name={3}&b={4}", user.token, gid, type,
                                      name, 0),
                };
                var result = api.PostJsonToParameter();
                api.Dispose();
                var entity = CommonHelper.Deserialize <BaseEntity>(result);

                if (entity.result == 1)
                {
                    return(Redirect("/Goods/GoodsManage"));
                }
                ViewBag.Error   = entity.result;
                ViewBag.Message = entity.message;
                return(View(goodtype));
            }
            catch (Exception ex)
            {
                return(Redirect("/Goods/GoodsManage"));
            }
        }
Exemple #13
0
        public ActionResult RecordList(FormCollection collection)
        {
            try
            {
                if (!IsLogin)
                {
                    return(Redirect("/Home/Login"));
                }

                var pid   = collection["platform"];
                var sid   = collection["server"];
                var state = collection["state_type"];
                var type  = collection["user_type"];
                var value = collection["value"];
                ViewBag.Platform = ApiPlatforms();
                ViewBag.Role     = user.role;

                if (!string.IsNullOrEmpty(value))
                {
                    if (string.IsNullOrEmpty(pid) || string.IsNullOrEmpty(sid) || string.IsNullOrEmpty(state) || string.IsNullOrEmpty(type))
                    {
                        ViewBag.Error   = -1;
                        ViewBag.Message = "查询玩家信息请选择完整依据";
                        return(View(new PagerQuery <PagerInfo, List <GmManage> >(new PagerInfo(), new List <GmManage>())));
                    }
                }

                if (string.IsNullOrEmpty(sid))
                {
                    sid = "0";
                }

                //api?GM/token={token}&name={name}&pid={pid}&sid={sid}&state={state}&type={type}&value={value}
                var api = new ApiReceive()
                {
                    URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                    Resource = string.Format("api/GM?token={0}&name={1}&pid={2}&sid={3}&state={4}&type={5}&value={6}", user.token, user.name, pid, sid, state, type, value),
                };

                var result = api.PostJsonToFromBody();
                var list   = CommonHelper.Deserialize <PageGmManage>(result);
                var query  = new PagerQuery <PagerInfo, List <GmManage> >(list.Pager, list.Gms);

                if (query.result < 0)
                {
                    ViewBag.Error   = -1;
                    ViewBag.Message = query.message;
                    return(View());
                }
                return(View(query));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
Exemple #14
0
        public ActionResult RegisterServer(FormCollection collection)
        {
            if (!IsLogin)
            {
                return(Redirect("/Home/Login"));
            }
            try
            {
                var server_pid            = collection["server_pid"];
                var server_name           = collection["server_name"];
                var server_ip             = collection["server_ip"];
                var server_port           = collection["server_port"];
                var server_port_policy    = collection["server_port_policy"];
                var server_connect_string = collection["server_connect_string"];
                var server_tg_route       = collection["server_tg_route"];
                var server_tg_pay         = collection["server_tg_pay"];
                var server_game_domain    = collection["server_game_domain"];
                var server_game_pay       = collection["server_game_pay"];

                if (string.IsNullOrEmpty(server_pid) || string.IsNullOrEmpty(server_name) || string.IsNullOrEmpty(server_ip) ||
                    string.IsNullOrEmpty(server_port) || string.IsNullOrEmpty(server_port_policy) || string.IsNullOrEmpty(server_connect_string))
                {
                    ViewBag.Error    = -2;
                    ViewBag.Message  = "信息内容不完整";
                    ViewBag.Platform = ApiPlatforms();
                    return(View());
                }
                //POST api/System?token={token}&name={name}&ip={ip}&pid={pid}&port={port}&policy={policy}&connect={connect}&tg_route={tg_route}&tg_pay={tg_pay}&game_domain={game_domain}&game_pay={game_pay}

                var sc  = HttpUtility.UrlEncode(server_connect_string);
                var api = new ApiReceive
                {
                    URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                    Resource = String.Format("api/System?token={0}&name={1}&ip={2}&pid={3}&port={4}&policy={5}&connect={6}&tg_route={7}&tg_pay={8}&game_domain={9}&game_pay={10}"
                                             , user.token, server_name, server_ip, server_pid, server_port, server_port_policy, sc,
                                             server_tg_route, server_tg_pay, server_game_domain, server_game_pay),
                };
                var result = api.PostJsonToFromBody();
                api.Dispose();
                var rm = CommonHelper.Deserialize <Server>(result);

                if (rm.result == 1)
                {
                    return(Redirect("/System/Server"));
                }

                ViewBag.Error    = -1;
                ViewBag.Message  = rm.message;
                ViewBag.Platform = ApiPlatforms();
                return(View());
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
Exemple #15
0
        /// <summary>获取平台数据</summary>
        internal List <Platform> ApiPlatforms()
        {
            var api = new ApiReceive()
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/Common?token={0}&pid={1}&role={2}", user.token, user.pid, user.role),
            };
            var result = api.PostJsonToParameter();

            return(CommonHelper.Deserialize <List <Platform> >(result));
        }
Exemple #16
0
        public Resource ApiFindResource(Guid token, Int64 pid, Int64 sid, Int32 roleid, string playername, string gift, int gifttype, string g1, string g2, string g3, string g4, string g5, string reason, int type, string message)
        {
            var api = new ApiReceive
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/Resource?token={0}&pid={1}&sid={2}&roleid={3}&playername={4}&gift={5}&gifttype={6}&g1={7}&g2={8}&g3={9}&g4={10}&g5={11}&reason={12}&type={13}&message={14}", token, pid, sid, roleid, playername, gift, gifttype, g1, g2, g3, g4, g5, reason, type, message),
            };
            var result = api.PostJsonToFromBody();

            api.Dispose();
            return(CommonHelper.Deserialize <Resource>(result));
        }
Exemple #17
0
        private List <Notice> ApiFindALLNotice(Guid token, Int64 roleid)
        {
            var api = new ApiReceive
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/Message?token={0}&roleid={1}&flag={2}", token, roleid, true),
            };
            var result = api.PostJsonToFromBody();

            api.Dispose();
            return(CommonHelper.Deserialize <List <Notice> >(result));
        }
Exemple #18
0
        public ActionResult Index(FormCollection collection)
        {
            if (!IsLogin)
            {
                return(Redirect("Home/Login"));
            }

            var pid   = collection["platform"];
            var sid   = collection["server"];
            var type  = collection["search_type"];
            var value = collection["value"];

            ViewBag.Platform = ApiPlatforms();

            if (string.IsNullOrEmpty(pid) || string.IsNullOrEmpty(sid) || string.IsNullOrEmpty(type) || string.IsNullOrEmpty(value))
            {
                ViewBag.Error   = -1;
                ViewBag.Message = "请提交完整的信息";
                return(View(new PlayerDetailed()));
            }
            if (Convert.ToInt32(type) != 1 && Convert.ToInt32(type) != 2)
            {
                ViewBag.Error   = -1;
                ViewBag.Message = "查询类型错误";
                return(View(new PlayerDetailed()));
            }
            if (string.IsNullOrEmpty(value))
            {
                ViewBag.Error   = -1;
                ViewBag.Message = "请输入查询内容";
                return(View(new PlayerDetailed()));
            }
            //Post api/Player?token={token}&name={name}&pid={pid}&sid={sid}&type={type}&value={value}
            var api = new ApiReceive()
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/Player?token={0}&name={1}&pid={2}&sid={3}&type={4}&value={5}",
                                         user.token, user.name, pid, sid, type, value),
            };
            var result = api.PostJsonToParameter();

            api.Dispose();
            var entity = CommonHelper.Deserialize <PlayerDetailed>(result);

            if (entity.result == -1)
            {
                ViewBag.Error   = -1;
                ViewBag.Message = entity.message;
                return(View(new PlayerDetailed()));
            }
            return(View(entity));
        }
Exemple #19
0
        /// <summary>获取启服服务器</summary>
        internal List <Server> ApiFindServer()
        {
            //api/System?token={token}
            var api = new ApiReceive
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/System?token={0}&flag=true", user.token),
            };
            var result = api.PostJsonToParameter();
            var list   = CommonHelper.Deserialize <List <Server> >(result);

            return(list);
        }
Exemple #20
0
        public ActionResult PlatformEdit(FormCollection collection)
        {
            if (!IsLogin)
            {
                return(Redirect("/Home/Login"));
            }
            try
            {
                var pid     = collection["platform_id"];
                var pname   = collection["platfrom_name"];
                var token   = collection["platform_token"];
                var enctypy = collection["platform_encrtpy"];

                var platform = new Platform
                {
                    id      = Convert.ToInt32(pid),
                    name    = pname,
                    token   = new Guid(token),
                    encrypt = enctypy,
                };

                if (string.IsNullOrEmpty(pid) || string.IsNullOrEmpty(pname) || string.IsNullOrEmpty(token) || string.IsNullOrEmpty(enctypy))
                {
                    ViewBag.Error   = -1;
                    ViewBag.Message = "信息内容不完整";
                    return(View(platform));
                }
                //POST api/System?token={token}&pid={pid}&pname={pname}&encrypt={encrypt}&b={b}
                var api = new ApiReceive
                {
                    URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                    Resource = String.Format("api/System?token={0}&pid={1}&pname={2}&encrypt={3}&b={4}", user.token, pid, pname, enctypy, 0),
                };
                var result = api.PostJsonToFromBody();
                api.Dispose();
                var rm = CommonHelper.Deserialize <BaseEntity>(result);

                if (rm.result == 1)
                {
                    return(Redirect("/System/Index"));
                }

                ViewBag.Error   = -2;
                ViewBag.Message = "修改平台信息失败";
                return(View(platform));
            }
            catch (Exception ex)
            {
                return(Redirect("/System/Index"));
            }
        }
Exemple #21
0
        /// <summary>请求邮件API</summary>
        private Email ApiFindMsg(Guid token, string sn, string title, string content)
        {
            var api = new ApiReceive
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/Manage?token={0}&sn={1}&title={2}&content={3}", token, sn, title, content),
            };
            var result = api.PostJsonToFromBody();

            api.Dispose();
            var entity = CommonHelper.Deserialize <Email>(result);

            return(entity);
        }
Exemple #22
0
        private Notice ApiFindNotice(Guid token, string sn, Int64 stime, Int64 etime, int interval, string content)
        {
            var api = new ApiReceive
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/Manage?token={0}&sn={1}&start={2}&end={3}&space={4}&content={5}", token, sn, stime, etime, interval, content),
            };
            var result = api.PostJsonToParameter();

            api.Dispose();
            var rm = CommonHelper.Deserialize <Notice>(result);

            return(rm);
        }
Exemple #23
0
        public ActionResult Register(FormCollection collection)
        {
            if (!IsLogin)
            {
                return(Redirect("/Home/Login"));
            }
            try
            {
                var pid  = collection["pid"];
                var role = collection["role_type"];
                var name = collection["role_name"];
                var pwd  = collection["role_password"];
                var cpwd = collection["role_confirmpassword"];

                if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(pwd) || string.IsNullOrEmpty(cpwd))
                {
                    ViewBag.Error   = -2;
                    ViewBag.Message = "用户名或密码为空";
                    return(View(user));
                }
                if (pwd != cpwd)
                {
                    ViewBag.Error   = -3;
                    ViewBag.Message = "两次密码不一致";
                    return(View(user));
                }
                //POST api/System?token={token}&name={name}&pid={pid}&role={role}&pwd={pwd}
                var api = new ApiReceive
                {
                    URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                    Resource = String.Format("api/System?token={0}&name={1}&pid={2}&role={3}&pwd={4}", user.token, name, pid, role, cpwd),
                };
                var result = api.PostJsonToFromBody();
                api.Dispose();
                var rm = CommonHelper.Deserialize <User>(result);

                if (rm.result == 1)
                {
                    return(Redirect("/System/Account"));
                }

                ViewBag.Error   = -1;
                ViewBag.Message = rm.message;
                return(View(user));
            }
            catch (Exception ex)
            {
                return(View(ex));
            }
        }
Exemple #24
0
        private Notice ApiFindNotice(Guid token, string stime, string etime, Int64 roleid, int role, Int64 pid, Int64 sid, int interval, string content)
        {
            var api = new ApiReceive
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/Message?token={0}&roleid={1}&role={2}&&pid={3}&sid={4}&start={5}&end={6}&space={7}&content={8}", token, roleid, role, pid, sid, stime, etime, interval, content),
            };
            var result = api.PostJsonToFromBody();

            api.Dispose();
            var rm = CommonHelper.Deserialize <Notice>(result);

            return(rm);
        }
Exemple #25
0
        public ActionResult AddGoodsType(FormCollection collection)
        {
            try
            {
                if (!IsLogin)
                {
                    return(Redirect("/Home/Login"));
                }

                var type = collection["type"];
                var name = collection["name"];

                if (string.IsNullOrEmpty(type) || string.IsNullOrEmpty(name))
                {
                    ViewBag.Error   = -1;
                    ViewBag.Message = "添加失败,信息不完整";
                    return(View());
                }
                if (!Regex.IsMatch(type, @"^\d+$"))
                {
                    ViewBag.Error   = -1;
                    ViewBag.Message = "福利卡枚举类型ID格式错误,请重新输入";
                    return(View());
                }

                //api/Goods?token={token}&type={type}&name={name}
                var api = new ApiReceive
                {
                    URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                    Resource = String.Format("api/Goods?token={0}&type={1}&name={2}", user.token, type, name),
                };
                var result = api.PostJsonToFromBody();
                api.Dispose();
                var rm = CommonHelper.Deserialize <BaseEntity>(result);

                if (rm.result > 0)
                {
                    return(Redirect("/Goods/GoodsManage"));
                }

                ViewBag.Error   = rm.result;
                ViewBag.Message = rm.message;
                return(View());
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
Exemple #26
0
        public ActionResult Reset(FormCollection collection)
        {
            try
            {
                if (!IsLogin)
                {
                    return(Redirect("/Home/Login"));
                }
                var name   = collection["Name"];
                var oldpwd = collection["OldPassWord"];
                var newpwd = collection["NewPassWord"];
                var cpwd   = collection["ConfirmPassWord"];

                if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(oldpwd) || string.IsNullOrEmpty(newpwd))
                {
                    return(View());
                }
                if (newpwd != cpwd)
                {
                    ViewBag.Error   = -1;
                    ViewBag.Message = "新密码与确认密码不一致";
                    return(View());
                }

                var api = new ApiReceive
                {
                    URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                    Resource =
                        String.Format("api/System?token={0}&name={1}&old={2}&newpwd={3}", user.token, name, oldpwd,
                                      newpwd),
                };

                var result = api.PostJsonToFromBody();
                api.Dispose();
                var rm = CommonHelper.Deserialize <User>(result);
                if (rm.result == 1)
                {
                    ViewBag.Error = 0;
                    return(View());
                }
                ViewBag.Error   = -1;
                ViewBag.Message = rm.message;
                return(View());
            }
            catch (Exception ex)
            {
                return(View(ex));
            }
        }
Exemple #27
0
        public JsonResult AjaxServer(Int32 id)
        {
            var api = new ApiReceive()
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/Common?token={0}&pid={1}&flag={2}", user.token, id, true),
            };
            var result = api.PostJsonToFromBody();

            api.Dispose();
            var list       = CommonHelper.Deserialize <List <Server> >(result);
            var jsonResult = Json(list, JsonRequestBehavior.AllowGet);

            return(jsonResult);
        }
Exemple #28
0
        /// <summary>获取所有平台数据</summary>
        private List <Platform> GetPlatformAllList()
        {
            //POST api/Common?token={token}&pid={pid}&role={role}
            var api = new ApiReceive()
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/Common?token={0}&pid={1}&role={2}", user.token, user.pid, user.role),
            };
            var result = api.PostJsonToParameter();

            api.Dispose();
            var list = CommonHelper.Deserialize <List <Platform> >(result);

            return(list);
        }
Exemple #29
0
        /// <summary>获取福利卡类型信息</summary>
        private List <GoodsType> ApiFindGoodsType()
        {
            //  POST api/Goods?token={token}
            var api = new ApiReceive
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/Goods?token={0}&flag=true", user.token),
            };
            var result = api.PostJsonToParameter();

            api.Dispose();
            var list = CommonHelper.Deserialize <List <GoodsType> >(result);

            return(list);
        }
Exemple #30
0
        /// <summary>平台编辑</summary>
        /// <param name="id">平台id</param>
        public ActionResult PlatformEdit(Int32 id)
        {
            //POST api/System?token={token}&pid={pid}&name={name}&b={b}
            var api = new ApiReceive()
            {
                URL      = string.Format("{0}", ConfigHelper.GetApiUrl()),
                Resource = string.Format("api/System?token={0}&pid={1}&name={2}&b={3}", user.token, id, user.name, 0),
            };
            var result = api.PostJsonToParameter();

            api.Dispose();
            var entity = CommonHelper.Deserialize <Platform>(result);

            return(View(entity));
        }