Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["sign"].ToString() == "")
            {
                Response.Redirect("~/LoginNew.aspx");
            }
            lab_session.Text = Session["sign"].ToString();
            Boolean results = empauthentication.DeleAuthentication(Session["sign"].ToString());

            if (results == false)
            {
                Response.Redirect("~/LoginNew.aspx");
            }
            List <User> users = DepartmentBusinessLogic.ListUserByName(lab_session.Text);
            Model1      ctx   = new Model1();
            int         count = ctx.Users.Count();

            User[] user = new User[count];
            user = ctx.Users.ToArray();
            //  Label1.Text =;
            User u = ctx.Users.Where(x => x.UserName == lab_session.Text).First();

            lab_user.Text         = lab_session.Text.ToString();
            lab_employeeID.Text   = u.UserID.ToString();
            lab_employeeName.Text = u.UserName.ToString();
            lab_department.Text   = u.DeptName.ToString();
            lab_userRole.Text     = u.Role.ToString();
        }
        public ActionResult Edit(string id)
        {
            sp_DepartmentSelect_Result model = new sp_DepartmentSelect_Result();
            var deptData = DepartmentBusinessLogic.getInstance().getDepartmentById(id);

            model.DepartmentId   = deptData.DepartmentId;
            model.DepartmentName = deptData.DepartmentName;
            return(View(model));
        }
 public ActionResult Delete(string id)
 {
     if (DepartmentBusinessLogic.getInstance().DeleteDepartment(id) == -1)
     {
         TempData["Success"] = "Department was successfully deleted";
     }
     else
     {
         TempData["Error"] = "Department was unsuccessfully deleted";
     }
     return(RedirectToAction("Index"));
 }
 public ActionResult Edit(sp_DepartmentSelect_Result model)
 {
     if (DepartmentBusinessLogic.getInstance().UpdateDepartment(model) == -1)
     {
         TempData["Success"] = "Department was successfully updated";
     }
     else
     {
         TempData["Error"] = "Department was unsuccessfully updated";
     }
     return(RedirectToAction("Index"));
 }
Example #5
0
        public ActionResult Edit(string id)
        {
            sp_UserSelect_Result model = new sp_UserSelect_Result();
            var userData = UserBusinessLogic.getInstance().getUserById(id);

            model.UserId           = userData.UserId;
            model.UserName         = userData.UserName;
            model.Name             = userData.Name;
            model.Password         = userData.Password;
            model.RoleId           = userData.RoleId;
            model.DepartmentId     = userData.DepartmentId;
            ViewBag.RoleList       = common.ToSelectList(RoleBusinessLogic.getInstance().getRoleDDL(), "ID", "NAME", model.RoleId);
            ViewBag.DepartmentList = common.ToSelectList(DepartmentBusinessLogic.getInstance().getDepartmentDDL(), "ID", "NAME", model.DepartmentId);
            return(View(model));
        }
Example #6
0
 public ActionResult Create()
 {
     ViewBag.RoleList       = common.ToSelectList(RoleBusinessLogic.getInstance().getRoleDDL(), "ID", "NAME", string.Empty);
     ViewBag.DepartmentList = common.ToSelectList(DepartmentBusinessLogic.getInstance().getDepartmentDDL(), "ID", "NAME", string.Empty);
     return(View());
 }
 public ActionResult Index()
 {
     return(View(DepartmentBusinessLogic.getInstance().ListDepartment()));
 }