Example #1
0
        protected void btEnter_Click(object sender, EventArgs e)
        {
            try
            {
                User dataUser = new User();
                dataUser            = loginBLL.checkUsers(txtUser.Text, txtPassword.Text);
                Session["Name"]     = dataUser.name.ToString() + " " + dataUser.firstSurname.ToString();
                Session["UserName"] = dataUser.userName;
                Session["Profile"]  = dataUser.Roles.Name;
                Hashtable has = new Hashtable();
                has = new AccessBLL().getAccesUser(Session["Profile"].ToString());
                Session["access"] = has;



                if (Session["UserName"] != null)
                {
                    Response.Redirect("~/Content/Home.aspx");
                }
                else
                {
                }
            }
            catch {
            }
        }
 public void InsertMetadataInAccessDB()
 {
     try
     {
         ComponentsUtil.AppendTextToRichTextBox(form1.GetRichTextBoxInfo(), "\tStep3:Insert data in Access DB", Color.Blue, true);
         AccessBLL.InsertDataDB(listMetadata);
         ComponentsUtil.AppendTextToRichTextBox(form1.GetRichTextBoxInfo(), "\t\tOK...", Color.Blue, true);
     }
     catch (Exception ex) { throw ex; };
 }
Example #3
0
        public ActionResult Login(LoginModel model)
        {
            var employee = AccessBLL.LoginUser(model.UserName, model.Password);

            if (employee == null)
            {
                TempData["Hata"] = "Kullanıcı bulunamadı";
                return(RedirectToAction("Index"));
            }
            else
            {
                Session["Employee"] = employee;
                return(RedirectToAction("Index", "Home"));
            }
        }
Example #4
0
        // GET: Order
        public ActionResult Index()
        {
            var employee = Session["Employee"] as Employee;

            ViewBag.OnaylaVisibilityText  = "hidden";
            ViewBag.ReddetVisibilityText  = "hidden";
            ViewBag.KargolaVisibilityText = "hidden";

            if (AccessBLL.UserHasRole(employee.Email, "Admin"))
            {
                ViewBag.OnaylaVisibilityText  = "visible";
                ViewBag.ReddetVisibilityText  = "visible";
                ViewBag.KargolaVisibilityText = "visible";
            }

            return(View());
        }
Example #5
0
        public ActionResult Approve()
        {
            if (Session["Employee"] == null)
            {
                return(RedirectToAction("Hata", "Home"));
            }

            var employee = Session["Employee"] as Employee;

            if (!AccessBLL.UserHasRole(employee.Email, "Admin"))
            {
                return(RedirectToAction("Hata", "Home"));
            }

            //Onaylama işlemini yap

            return(RedirectToAction("Index"));
        }
        /// <summary>
        /// Role实体和权限字符串
        /// </summary>
        /// <param name="auth"></param>
        /// <param name="json"></param>
        /// <returns></returns>
        public string addRole(string auth, string json)
        {
            if (string.IsNullOrEmpty(json))
            {
                return(new MyHttpResult(false, "提交数据错误!").ToString());
            }
            RoleModel model = JsonExtensions.FromJson <RoleModel>(json);
            int       result;

            //1.判断是新增角色还是编辑角色
            if (model.id == 0)//新增
            {
                //1.新增角色
                result = model.Insert();
                //2.获得该实体的ID
                model.id = (new RoleBLL()).getByMax().id;
            }
            else  //编辑
            {
                result = model.Update();
            }
            //2.删除该角色的所有权限
            AccessBLL accessbll = new AccessBLL();

            accessbll.deleteByRoleId(model.id.ToString());
            //3.insert所有权限
            if (!string.IsNullOrEmpty(auth))
            {
                foreach (string roleAuth in auth.Split(",".ToCharArray()))
                {
                    if (roleAuth != "")
                    {
                        AccessModel accessModel = new AccessModel();
                        accessModel.node_id = int.Parse(roleAuth);
                        accessModel.role_id = model.id;
                        result = accessModel.Insert();
                    }
                }
            }
            return(new MyHttpResult(result > 0 ? true : false, "").ToString());
        }
Example #7
0
        public ActionResult loginpage(LoginModel model)
        {
            if (ModelState.IsValid)
            {
                var person = AccessBLL.LoginUser(model.Email, model.Password);

                if (person == null)
                {
                    ModelState.AddModelError("", "Böyle Bir Kullanıcı Yok");


                    ViewBag.Result = "Mail Adresi Kayıtlı Değil.";
                    ViewBag.Status = "danger";
                    return(View());
                }
                else
                {
                    Session["Person"] = person;
                    return(RedirectToAction("homepage", "Home"));
                }
            }

            return(View());
        }