Exemplo n.º 1
0
        //
        // GET: /Teacher/Create
        public ActionResult Save()
        {
            List <Designation> desinationList = designationManager.GetAllDesignations();
            List <Department>  departments    = departmentManager.GetAllDepts();

            ViewBag.Designations = desinationList;
            ViewBag.Departments  = departments;
            return(View());
        }
        public ActionResult TeachersSave()
        {
            List <Department> departments = departmentManager.GetAllDepartments();

            ViewBag.Departments = departments;
            List <Designation> designation = designationManager.GetAllDesignations();

            ViewBag.Designation = designation;
            return(View());
        }
Exemplo n.º 3
0
        public ActionResult SaveTeacher()
        {
            DesignationManager aDesignationManager = new DesignationManager();
            DepartmentManager  aDepartmentManager  = new DepartmentManager();

            ViewBag.designations = aDesignationManager.GetAllDesignations();
            ViewBag.departments  = aDepartmentManager.GetAllDepartmentInfo();
            return(View());
        }
Exemplo n.º 4
0
        public ActionResult GetAllDesignation()
        {
            if (Session["UserRoleId"] == null)
            {
                return(RedirectToAction("Login", "Login"));
            }
            List <Designation> designations = designationManager.GetAllDesignations();

            return(Json(designations));
        }
        public ActionResult SaveTeacher(Teacher aTeacher)
        {
            DesignationManager aDesignationManager = new DesignationManager();
            DepartmentManager  aDepartmentManager  = new DepartmentManager();
            TeacherManager     aTeacherManager     = new TeacherManager();

            ViewBag.designations = aDesignationManager.GetAllDesignations();
            ViewBag.departments  = aDepartmentManager.GetAllDepartmentInfo();

            if (aTeacher.Name == null || aTeacher.Address == null || aTeacher.Email == null ||
                aTeacher.ContactNo == null || aTeacher.DesignationId == 0 || aTeacher.DepartmentId == 0 ||
                aTeacher.CreditTobeTaken == 0.0)
            {
                ViewBag.message = "Input Values";
            }
            else
            {
                List <Teacher> aList        = aTeacherManager.GetAllTeachers();
                var            teacheremail = aList.FirstOrDefault(e => e.Email == aTeacher.Email);

                if (aTeacher.CreditTobeTaken < 0 || teacheremail != null)
                {
                    if (aTeacher.CreditTobeTaken < 0 && teacheremail != null)
                    {
                        ViewBag.message = "Credit must contain a non-negative value And Email Already Exist";
                    }
                    else if (aTeacher.CreditTobeTaken < 0)
                    {
                        ViewBag.message = "Credit must contain a non-negative value";
                    }
                    else if (teacheremail != null)
                    {
                        ViewBag.message = "Email Already Exist";
                    }
                }
                else
                {
                    if (aTeacherManager.SaveTeacher(aTeacher) > 0)
                    {
                        ViewBag.message = "Teacher Saved Successfully";
                    }
                    else
                    {
                        ViewBag.message = "Save Failed";
                    }
                }
            }

            return(View());
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     msgLabel.Text = "";
     try
     {
         departmentDropDownList.DataTextField   = "DepartmentCode";
         departmentDropDownList.DataValueField  = "departmentId";
         designationDropDownList.DataTextField  = "DesignationName";
         designationDropDownList.DataValueField = "Id";
         if (!IsPostBack)
         {
             DepartmentManager aDepartmentManager = new DepartmentManager();
             departments = aDepartmentManager.GetAllDepartments();
             DesignationManager aDesignationManager = new DesignationManager();
             aTeacherManager = new TeacherManager();
             designation     = aDesignationManager.GetAllDesignations();
             departmentDropDownList.DataSource = departments;
             departmentDropDownList.DataBind();
             designationDropDownList.DataSource = designation;
             designationDropDownList.DataBind();
         }
     }
     catch (SqlException sqlException)
     {
         msgLabel.ForeColor = Color.Red;
         msgLabel.Text      = "Database error.See details error: " + sqlException.Message;
     }
     catch (Exception exception)
     {
         msgLabel.ForeColor = Color.Red;
         string errorMessage = "Unknow error occured.";
         errorMessage += exception.Message;
         if (exception.InnerException != null)
         {
             errorMessage += exception.InnerException.Message;
         }
         msgLabel.Text = errorMessage;
     }
 }
        public IActionResult ViewAll()
        {
            var employeeDataString = HttpContext.Session.GetString("employee");

            if (employeeDataString == "")
            {
                return(RedirectToAction("Login", "Auth"));
            }
            else
            {
                Employee employee = JsonConvert.DeserializeObject <Employee>(employeeDataString);

                if (userAccessManager.IsAccessExists(employee.Id, 3))
                {
                    ViewBag.Designations = designationManager.GetAllDesignations();
                    return(View());
                }
                else
                {
                    return(NotFound("No Access"));
                }
            }
        }
 public ActionResult SaveTeacher()
 {
     ViewBag.Designations = designationManager.GetAllDesignations();
     ViewBag.Departments  = departmentManager.GetAllDepartments();
     return(View());
 }
Exemplo n.º 9
0
 public ActionResult AddTeacher()
 {
     ViewBag.deps = DepMan.GetAllDepartments();
     ViewBag.Des  = DesMan.GetAllDesignations();
     return(View());
 }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var role = (string)Session["role"];

            if (Session["username"] == null || role != "Admin")
            {
                Response.Redirect("Login.aspx");
            }

            if (string.IsNullOrEmpty(Request.QueryString["Id"]))
            {
                Response.Redirect("EmployeeEntry.aspx?Id=" + 0);
            }

            if (!IsPostBack)
            {
                ListItem listItem = new ListItem("---------Select One---------", "-1");
                roleDropDownBox.DataSource = _roleManager.GetAllRoles().ToList();
                roleDropDownBox.DataBind();

                sectionDropDownBox.DataSource = _sectionManager.GetAllSections();
                sectionDropDownBox.DataBind();

                designationDropDownBox.DataSource = _designationManager.GetAllDesignations();
                designationDropDownBox.DataBind();

                branchDropDownBox.DataSource = _branchManager.GetAllBranch();
                branchDropDownBox.DataBind();

                roleDropDownBox.Items.Insert(0, listItem);
                sectionDropDownBox.Items.Insert(0, listItem);
                designationDropDownBox.Items.Insert(0, listItem);
                branchDropDownBox.Items.Insert(0, listItem);

                int id = int.Parse(Request.QueryString["Id"].ToString());
                if (id > 0)
                {
                    passwordTextBox.Visible        = false;
                    confirmPasswordTextBox.Visible = false;
                    emailTextBox.Visible           = false;
                    passwordLabel.Visible          = false;
                    confirmPasswordLabel.Visible   = false;
                    emailLabel.Visible             = false;


                    Employee employee = _employeeUserManager.GetEmployeeById(id);
                    employeeIdHiddenField.Value = employee.Id.ToString();
                    fullNameTextBox.Text        = employee.FullName;
                    firstNameTextBox.Text       = employee.FirstName;
                    lastNameTextBox.Text        = employee.LastName;
                    roleDropDownBox.DataSource  = _roleManager.GetAllRoles().ToList();
                    roleDropDownBox.DataBind();
                    roleDropDownBox.Items.FindByValue(employee.RoleId.ToString()).Selected = true;
                    mobileTextBox.Text = employee.MobileNo;
                    sectionDropDownBox.Items.FindByValue(employee.SectionId.ToString()).Selected         = true;
                    designationDropDownBox.Items.FindByValue(employee.DesignationId.ToString()).Selected = true;
                    salaryTextBox.Text = employee.BasicSalary.ToString();
                    if (employee.Gander == "Male")
                    {
                        maleRadioButton.Checked = true;
                    }
                    else
                    {
                        femaleRadioButton.Checked = true;
                    }
                    dateOfBirthTextBox.Text = employee.DateOfBirth.ToString();
                    joinDateTextBox.Text    = employee.JoinDate.ToString();
                    branchDropDownBox.Items.FindByValue(employee.BranchId.ToString()).Selected = true;
                    addressTextBox.Text = employee.Address;
                }
            }
        }
        //private void EmployeeInfoUI_Load(object sender, EventArgs e)
        //{
        //    designationComboBox=(ComboBox)
        //}

        public void LoadAllDesignation()
        {
            designationComboBox.DataSource    = designationManager.GetAllDesignations();
            designationComboBox.DisplayMember = "Title";
            designationComboBox.ValueMember   = "Id";
        }