protected void Page_Load(object sender, EventArgs e)
        {
            noContent.Visible = false;
            if (HttpContext.Current.User.IsInRole("Department Employee") == true)
            {
                string username = HttpContext.Current.User.Identity.Name;
                employee newemp = new employee();
                var q = from emp in se.employees
                        where emp.EmployeeEmail == username
                        select emp;
                newemp = q.FirstOrDefault();

                if(newemp.EmpIsDepRep!=true)
                {
                    Response.Redirect("/Presentation/Login.aspx");
                }

            }
            else
            {
                Response.Redirect("/Presentation/Login.aspx");
            }

            if (!IsPostBack)
            {
                int eid;
                int.TryParse(Session["userid"].ToString(),out eid);
                dept = service.getDNameByEid(eid);
                lblDName.Text = dept.DepName;
                binding();
            }
        }
Beispiel #2
0
        public employee GetEmployeeDetailsByEmpID(int searchEmpID)
        {
            try
            {
                employee currentEmp = new employee();
                currentEmp = (from e in se.employees
                              where e.EmployeeID == searchEmpID
                              select e).FirstOrDefault();
                return currentEmp;
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
        public void SendDisbEmail()
        {
            List<disbursement> disbList=new List<disbursement>();
            List<String> emails = new List<string>();
            MailMessage mail = new MailMessage();

            //disbursement disb = new disbursement();
            var q = from d in se.disbursements
                    where d.DisbStatus == "Ready"
                    select d;
            disbList = q.ToList();
            foreach (disbursement disb in disbList)
            {
                employee emp = new employee();
                 List<employee> emps=new List<employee>();
                 emps = disb.department.employees.ToList();
                 foreach (employee e in emps)
                 {
                     bool ans = false;
                     ans = e.EmpIsDepRep ?? default(bool);

                     if (ans ==true)
                     {
                         emails.Add(e.EmployeeEmail);

                     }

                 }

            }
            var allrecipients = String.Join(",", emails);
            MailMessage disbmail = new MailMessage();
            disbmail.To.Add(allrecipients);
            disbmail.Subject = "Notifications about Stationery Items Disbursement";
            String msgcontent = "The Stationery Items that your Department requested are ready for Delivery, please Login to the Logic University Stationery Management System for more details";
            disbmail.Body = msgcontent;

            disbmail.IsBodyHtml = true;
            disbmail.From = new MailAddress("*****@*****.**");

            SmtpClient sc = new SmtpClient();
            sc.Host = "smtp.gmail.com";
            sc.Port = 25;
            sc.Credentials = new System.Net.NetworkCredential("*****@*****.**", "12345678!");
            sc.EnableSsl = true;
            sc.Send(disbmail);
        }
Beispiel #4
0
        public employee GetEmployeeDetailsByReqID(int searchReqID)
        {
            try
            {
                employee currentEmp = new employee();
                currentEmp = (from r in se.requisitions
                         join e in se.employees on r.ReqEmpId equals e.EmployeeID
                         where r.ReqID == searchReqID
                         select e).FirstOrDefault();
                return currentEmp;
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Beispiel #5
0
        public string getuserempIDofemp(string email)
        {
            string empID;
            List<employee> empl = new List<employee>();
            employee emp = new employee();
            var q = from e in se.employees
                    where e.EmployeeEmail == email
                    select e;
            empl = q.ToList();
            emp = empl.First();
            if (emp.EmpIsDepRep == true)
            {
                empID = Convert.ToString(emp.EmployeeID);
            }
            else
            {
                empID = "false";

            }

            return empID;
        }
Beispiel #6
0
        public bool registeremployee(string empName, string empEmail, int empDepId, int roleId, string empContact)
        {
            try
            {

                employee emp = new employee();
                emp.EmpIsDepRep = false;
                emp.EmployeeContact = Convert.ToInt32(empContact);
                emp.EmployeeName = empName;
                emp.EmployeeDepId = empDepId;
                emp.EmployeeEmail = empEmail;
                emp.EmployeeRoleID = roleId;
                erep.saveemployee(emp);

                return true;

            }
            catch (Exception e)
            {
                return false;

            }
        }
        public void LoadAllGridViewWithReqStatus()
        {
            String searchStatus = ddlRequisitionList.SelectedValue;
            int LoginId = Convert.ToInt32(Session["userid"].ToString());

            currentEmp = new employee();
            currentEmp = _EmployeeService.GetEmployeeDetailsByEmpID(LoginId);
            if (currentEmp != null)
            {
                int curdeptID = currentEmp.EmployeeDepId ?? default(int);
                if (searchStatus == "All")
                {
                    LoadAllGridView(curdeptID);
                }
                else
                {
                    requisitionListObj = new List<object>();
                    requisitionListObj = _RequisitionService.GetRequisitionListByStatus(curdeptID, searchStatus);
                    gvRequisitionList.DataSource = requisitionListObj;
                    gvRequisitionList.DataBind();
                }

            }
        }
Beispiel #8
0
 public bool saveemployee(employee emp)
 {
     try
     {
         se.employees.Add(emp);
         se.SaveChanges();
         return true;
     }
     catch (Exception e)
     {
         return false;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool isTempHead = false;
            RegistrationService rser = new RegistrationService();
            string userId = HttpContext.Current.User.Identity.Name;
            isTempHead=rser.IsTempDepHead(userId);

            if ((HttpContext.Current.User.IsInRole("Department Head") != true) && (isTempHead != true))
            {
                Response.Redirect("/Presentation/Login.aspx");

            }

            _EmployeeService = new EmployeeService();
            _DepartmentService = new DepartmentService();
            _DelegationService = new DelegationService();

            if (!IsPostBack)
            {
                #region ** ClearAll
                ClearNewAllData();
                BtnEnable(false);
                #endregion

                #region ** DataBind for ddl with DeptID
                int LoginId = Convert.ToInt32(Session["userid"].ToString());

                currentEmp = new employee();
                currentEmp = _EmployeeService.GetEmployeeDetailsByEmpID(LoginId);

                int curdeptID = currentEmp.EmployeeDepId ?? default(int);
                employeeList = new List<employee>();
                employeeList = _EmployeeService.GetEmployeeDetailsByDeptID(curdeptID, LoginId);
                ddlEmpName.DataSource = employeeList;
                ddlEmpName.DataBind();
                #endregion

                searchDelegation();
            }
        }
Beispiel #10
0
        public string getusernameofemp(string email)
        {
            string name;
            List<employee> empl=new List<employee>();
            employee emp = new employee();

            var q = from e in se.employees
                    where e.EmployeeEmail == email
                    select e;
            empl = q.ToList();
            emp = empl.First();
            name = emp.EmployeeName;
            return name;
        }
Beispiel #11
0
        public int getUseridofemp(string email)
        {
            int id;
            List<employee> empl = new List<employee>();
            employee emp = new employee();

            var q = from e in se.employees
                    where e.EmployeeEmail == email
                    select e;
            empl = q.ToList();
            emp = empl.First();
            id = emp.EmployeeID;
            return id;
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            currentDepartment = new department();
            currentEmployee = new employee();

            int UserId = Convert.ToInt32(Session["userid"].ToString());
            currentEmployee = _EmployeeService.GetEmployeeDetailsByEmpID(UserId);

            if (currentEmployee!=null)
            {
                #region Update Department
                int DepID = currentEmployee.EmployeeDepId ?? default(int);
                currentDepartment = _DepartmentService.GetdepartmentDetailsByDeptID(DepID);

                if (currentDepartment!=null)
                {
                    #region Make All Dept Rep to be 0 If there is existing
                    employeeList = new List<employee>();
                    employeeList = _EmployeeService.GetEmployeeDetailsByDeptID(DepID, UserId);
                    foreach (employee emp in employeeList)
                    {
                        _EmployeeService.UpdateEmployeeDetailsTobeDeptRep(emp.EmployeeID, false);
                    }
                    #endregion

                    department toUpdateDept = new department();
                    toUpdateDept.DepID = currentDepartment.DepID;
                    toUpdateDept.DepName = currentDepartment.DepName;
                    toUpdateDept.DepContactName = txtDeptContactName.Text;
                    toUpdateDept.DepContactNumber = Convert.ToInt32(txtDeptContactNum.Text);
                    toUpdateDept.DepFax = currentDepartment.DepFax;
                    toUpdateDept.DepCollectionPointID = int.Parse(ddlCollectionID.SelectedValue);
                    toUpdateDept.DepHeadName = currentDepartment.DepHeadName;

                    if (PanelDeptRepName.Visible == true)
                    {
                        toUpdateDept.DepRepName = ddlDeptRep.SelectedItem.Text;
                        _EmployeeService.UpdateEmployeeDetailsTobeDeptRep(int.Parse(ddlDeptRep.SelectedValue),true);
                    }
                    else
                    {
                        toUpdateDept.DepRepName = currentDepartment.DepRepName;
                    }
                    _DepartmentService.UpdateDepartment(toUpdateDept);
                    ResetAll();
                    PanelSubmit.Visible = true;

                }
                else
                {
                    PanelError.Visible = true;
                }
                #endregion

            }
            else
            {
                PanelError.Visible = true;
            }

            //int EmpID = int.Parse(ddlDeptRep.SelectedItem.Value);
            //currentEmployee = new employee();
            //currentEmployee = _EmployeeService.GetEmployeeDetailsByEmpID(EmpID);

            //if (currentEmployee != null)
            //{
            //    if (currentEmployee.EmpIsDepRep == false)
            //    {
            //        _EmployeeService.UpdateEmployeeDetailsTobeDeptRep(EmpID, true);
            //        ResetAll();
            //        PanelSubmit.Visible = true;
            //    }
            //    else
            //    {
            //        PanelSubmit.Visible = true;
            //    }
            //}
            //else
            //{
            //    PanelError.Visible = true;
            //}
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool isTempHead = false;
            RegistrationService rser = new RegistrationService();
            string userId = HttpContext.Current.User.Identity.Name;
            isTempHead = rser.IsTempDepHead(userId);

            if ((HttpContext.Current.User.IsInRole("Department Head") != true) && (isTempHead != true))
            {
                Response.Redirect("/Presentation/Login.aspx");

            }

            _EmployeeService = new EmployeeService();
            _DepartmentService = new DepartmentService();

            if (!IsPostBack)
            {
                int i = Convert.ToInt32(Session["userid"].ToString());
                currentEmployee = new employee();
                currentEmployee = _EmployeeService.GetEmployeeDetailsByEmpID(i);

                if (currentEmployee!=null)
                {
                    int DepID = currentEmployee.EmployeeDepId ?? default(int);
                    currentDepartment = new department();
                    currentDepartment = _DepartmentService.GetdepartmentDetailsByDeptID(DepID);

                    lblDeptName.Text = currentDepartment.DepName;
                    txtDeptContactName.Text = currentDepartment.DepContactName;
                    txtDeptContactNum.Text = currentDepartment.DepContactNumber.ToString();
                    lblCurrentDeptRep.Text = currentDepartment.DepRepName;

                }
                else
                {
                    PanelError.Visible = true;
                }

                int curdeptID = currentEmployee.EmployeeDepId ?? default(int);
                employeeList = new List<employee>();
                employeeList = _EmployeeService.GetEmployeeDetailsByDeptID(curdeptID, i);

                if (employeeList!=null)
                {
                    ddlDeptRep.DataSource = employeeList;
                    ddlDeptRep.DataTextField = "EmployeeName";
                    ddlDeptRep.DataValueField = "EmployeeID";
                    ddlDeptRep.DataBind();
                }
                else
                {
                    PanelError.Visible = true;
                }
                ddlCollectionID.SelectedValue = currentDepartment.DepCollectionPointID.ToString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HttpContext.Current.User.IsInRole("Department Employee") == true)
            {
                string username = HttpContext.Current.User.Identity.Name;
                employee newemp = new employee();
                var q = from emp in se.employees
                        where emp.EmployeeEmail == username
                        select emp;
                newemp = q.FirstOrDefault();

                if (newemp.EmpIsDepRep != true)
                {
                    Response.Redirect("/Presentation/Login.aspx");
                }

            }
            else
            {
                Response.Redirect("/Presentation/Login.aspx");
            }

            if (!IsPostBack)
            {
                Binding();
            }
        }
        public bool searchDelegation()
        {
            int LoginId = Convert.ToInt32(Session["userid"].ToString());

            currentEmp = new employee();
            currentEmp = _EmployeeService.GetEmployeeDetailsByEmpID(LoginId);

            Currentdelegation = new delegation();
            Currentdelegation = _DelegationService.SearchDelegationWithDelgApproveEmpId_Status_Date(LoginId, "approved");

            if (Currentdelegation != null)
            {
                PanelSubmit.Visible = true;
                lblDelegated.Text = "You may assign a temporary Department Head.";

                ddlEmpName.SelectedValue = Currentdelegation.DelgEmpID.ToString();
                txtEmpID.Text = Currentdelegation.DelgEmpID.ToString();
                currentEmp = new employee();
                currentEmp = _EmployeeService.GetEmployeeDetailsByEmpID(Currentdelegation.DelgEmpID);
                txtEmpContact.Text = currentEmp.EmployeeContact.ToString();
                this.FromDate = Currentdelegation.DelgFromDate.ToString("MM/dd/yyyy");
                this.ToDate = Currentdelegation.DelgToDate.ToString("MM/dd/yyyy");

                BtnEnable(true);
                return true;
            }
            else
            {
                BtnEnable(false);
                return false;
            }
        }
Beispiel #16
0
 //method to check Dep Rep
 public bool isDepRep(string email)
 {
     bool ans = false;
        List<employee> empl1 = new List<employee>();
        employee emp1 = new employee();
        var l = from e in se.employees
            where e.EmployeeEmail == email
            select e;
        empl1 = l.ToList();
        emp1 = empl1.First();
        if (emp1.EmpIsDepRep == true)
        {
        ans = true;
        }
        else
        ans = false;
     return ans;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HttpContext.Current.User.IsInRole("Department Employee") == true)
            {
                string username = HttpContext.Current.User.Identity.Name;
                employee newemp = new employee();
                var q = from emp in se.employees
                        where emp.EmployeeEmail == username
                        select emp;
                newemp = q.FirstOrDefault();

                if (newemp.EmpIsDepRep != true)
                {
                    Response.Redirect("/Presentation/Login.aspx");
                }

            }
            else
            {
                Response.Redirect("/Presentation/Login.aspx");
            }

            if (!IsPostBack)
            {
                //ddlSearch.DataTextField = "itemDescription";
                //ddlSearch.DataValueField = "itemID";
                //itm = requisition.getAllItem();
                //ddlSearch.DataSource = itm;
                //ddlSearch.DataBind();
                //gvRequisition.DataSource = items;
                //gvRequisition.DataBind();

                binding();
                if (items.Count > 0)
                {
                    btnComfirm.Visible = true;
                }
                else
                {
                    btnComfirm.Visible = false;
                }
            }
        }
Beispiel #18
0
        //method to check Dep Head
        public bool isTempDepHead(string email)
        {
            bool ans = false;
            int id2;
            delegation delg = new delegation();
            List<employee> empl2 = new List<employee>();
            employee emp2 = new employee();

            var q = from e in se.employees
                    where e.EmployeeEmail == email
                    select e;
            emp2 = q.FirstOrDefault();
            id2 = emp2.EmployeeID;

            //checking the delegation Table

            var m = from del in se.delegations
                    where del.DelgEmpID == id2 &&
                    del.DelgToDate >= DateTime.Today &&
                    del.DelgStatus == "approved"
                    select del;
            delg = m.FirstOrDefault();
            if (delg != null)
            {
                ans = true;
            }
            else
                ans = false;

            return ans;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool isTempHead = false;
            RegistrationService rser = new RegistrationService();
            string userId = HttpContext.Current.User.Identity.Name;
            isTempHead = rser.IsTempDepHead(userId);

            if ((HttpContext.Current.User.IsInRole("Department Head")!= true) && (isTempHead!=true))
            {
                Response.Redirect("/Presentation/Login.aspx");

            }

            _RequisitionService = new RequisitionService();
            _EmployeeService = new EmployeeService();

            if (!IsPostBack)
            {
                int LoginId = Convert.ToInt32(Session["userid"].ToString());
                currentEmp = new employee();
                currentEmp = _EmployeeService.GetEmployeeDetailsByEmpID(LoginId);
                if (currentEmp!=null)
                {
                    int curdeptID = currentEmp.EmployeeDepId ?? default(int);
                    LoadAllGridView(curdeptID);
                }
            }
        }
        protected void EmpName_SelectedIndexChanged(object sender, EventArgs e)
        {
            #region ** ClearAll
            ClearNewAllData();
            BtnEnable(false);
            #endregion

            #region ** DataBindinEmployeeDetails
            currentEmp = new employee();
            currentEmp = _EmployeeService.GetEmployeeDetailsByEmpID(int.Parse(ddlEmpName.SelectedItem.Value));

            if (currentEmp != null)
            {
                txtEmpContact.Text = currentEmp.EmployeeContact.ToString();
                txtEmpID.Text = ddlEmpName.SelectedItem.Value;
            }
            else
            {
                PanelError.Visible = true;
            }
            #endregion

            BtnEnable(true);
            btnResetDelegation.Enabled = false;

            #region ** CheckDelegationForLoginId
            int LoginId = Convert.ToInt32(Session["userid"].ToString());

            currentEmp = new employee();
            currentEmp = _EmployeeService.GetEmployeeDetailsByEmpID(int.Parse(ddlEmpName.SelectedItem.Value));

            Currentdelegation = new delegation();
            Currentdelegation = _DelegationService.SearchDelegationWithDelgEmpId_ApprovedID_Status_Date(int.Parse(ddlEmpName.SelectedItem.Value), LoginId,"approved");

            if (Currentdelegation != null)
            {
                PanelSubmit.Visible = true;
                lblDelegated.Text = "You may assign a temporary Department Head.";

                ddlEmpName.SelectedValue = Currentdelegation.DelgEmpID.ToString();
                txtEmpID.Text = Currentdelegation.DelgEmpID.ToString();
                txtEmpContact.Text = currentEmp.EmployeeContact.ToString();
                this.FromDate = Currentdelegation.DelgFromDate.ToString("MM/dd/yyyy");
                this.ToDate = Currentdelegation.DelgToDate.ToString("MM/dd/yyyy");
                btnResetDelegation.Enabled = true;
                btnSubmitDeligation.Enabled = true;

            }
            #endregion
        }