Пример #1
0
        public ActionResult GetRegion(int parentId = 0)
        {
            RegionBll regionBll = new RegionBll();
            var       list      = regionBll.GetRegionList(parentId).ToDictionary(k => { return(k.Reg_ID); }, v => { return(v.Reg_Name); });
            var       result    = OptionFactory.CreateOptions(list);

            return(Select2(result, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //获取Pid
            int pid = int.Parse(context.Request["Pid"] ?? "0");


            RegionBll bll = new RegionBll();
            //调用 bll层 获取数据
            List <Region> list = bll.getListByPid(pid);

            //序列化成  json
            System.Web.Script.Serialization.JavaScriptSerializer javaScrpitSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            string json = javaScrpitSerializer.Serialize(list);

            context.Response.Write(json);
        }
Пример #3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            RegionBll        regionBll = new RegionBll();
            UserBll          userBll   = new UserBll();
            RoleBll          roleBll   = new RoleBll();
            RSACryptoService rsa       = new RSACryptoService();

            string roleName = "微信零售";
            int    row      = roleBll.selectByroleName(roleName);
            int    roleId   = 0;

            if (row <= 0)
            {
                Role role = new Role();
                role.RoleName = roleName;
                Result insert = roleBll.Insert(role);
                if (insert == Result.添加成功)
                {
                    roleId = roleBll.selectByroleName(roleName);
                    string sqlText = "(" + roleId + "," + 14 + ")";
                    Result inserts = roleBll.InsertPer(sqlText, roleId, "添加");
                    if (inserts == Result.添加失败)
                    {
                        Response.Write("添加失败");
                        Response.End();
                    }
                }
            }
            else
            {
                roleId = row;
            }
            DataSet ds    = regionBll.select();
            int     count = ds.Tables[0].Rows.Count;

            if (count > 0 && ds != null)
            {
                for (int i = 0; i < count; i++)
                {
                    string regionId   = ds.Tables[0].Rows[i]["regionId"].ToString();
                    string regionName = ds.Tables[0].Rows[i]["regionName"].ToString();
                    Region region     = new Region();
                    region.RegionId = Convert.ToInt32(regionId);
                    Role role = new Role();
                    role.RoleId = roleId;
                    User user = new User();
                    user.UserId   = regionId + "01";
                    user.UserName = regionName + "微信零售";
                    user.ReginId  = region;
                    user.Pwd      = rsa.Encrypt("000000");
                    user.RoleId   = role;
                    Result rows = userBll.Insert(user);
                    if (rows == Result.添加失败)
                    {
                        Response.Write("添加失败:" + regionId);
                    }
                }
                Response.Write("添加成功");
            }
            else
            {
                Response.Write("未查到任何组织信息");
            }
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                permission();
                User user = (User)Session["user"];
                operatorId = user.UserId.ToString();
            }
            RegionBll        regBll = new RegionBll();
            ConfigurationBll cBll   = new ConfigurationBll();
            Result           result;

            regionds = regBll.select();
            string op = Request["op"];

            if (op == "sure")
            {
                string startTime  = Request["startDt"].ToString(),
                       endTime    = Request["endDt"].ToString(),
                       regionName = Request["regName"].ToString();
                string   type     = Request["type"].ToString();
                DateTime st       = DateTime.Parse(startTime);
                DateTime et       = DateTime.Parse(endTime);
                result = cBll.isExist(regionName);
                if (result == Result.记录不存在)
                {
                    result = cBll.Insert(st, et, regionName, type);
                    if (result == Result.添加成功)
                    {
                        Response.Write("添加成功");
                        Response.End();
                    }
                    else
                    {
                        Response.Write("添加失败");
                        Response.End();
                    }
                }
                else
                {
                    result = cBll.Update(st, et, regionName, type);
                    if (result == Result.更新成功)
                    {
                        Response.Write("更新成功");
                        Response.End();
                    }
                    else
                    {
                        Response.Write("更新失败");
                        Response.End();
                    }
                }
            }
            if (op == "goScreen")
            {
                string regionName = Request["regName"].ToString();
                if (regionName == "选择组织" || regionName == null)
                {
                    User user = (User)Session["user"];
                    regionName = user.ReginId.RegionName;
                }
                Session["regionName"] = regionName;
                result = cBll.isExist(regionName);
                if (result == Result.记录不存在)
                {
                    Response.Write("记录不存在");
                    Response.End();
                }
                else
                {
                    Response.Write("记录存在");
                    Response.End();
                }
            }
            if (op == "logout")
            {
                //删除身份凭证
                FormsAuthentication.SignOut();
                //设置Cookie的值为空
                Response.Cookies[FormsAuthentication.FormsCookieName].Value = null;
                //设置Cookie的过期时间为上个月今天
                Response.Cookies[FormsAuthentication.FormsCookieName].Expires = DateTime.Now.AddMonths(-1);
            }
        }