public void binding()
 {
     int eid;
     int.TryParse(Session["userid"].ToString(),out eid);
     string status="Ready";
     DateTime date=DateTime.Today.AddDays(1);
     obj = service.getAllCollectionItemByDepIdStatusDate(eid, status, date);
     gvRep.DataSource = obj;
     gvRep.DataBind();
     if (obj.Count > 0)
     {
         btnConfirm.Visible = true;
         dept = service.getDNameByEid(eid);
         cp = service.getAllCollectionPointByDeptID(dept.DepID);
         lblAddress.Text = cp.CollectionPointAddress;
         lblTime.Text = "Collection Time : " + cp.CollectionPointTime;
         lblDate.Text = "Collection Date : " + cp.CollectionPointDate;
         divmap.Visible = true;
         lblAdd.Visible = true;
         lblAddress.Visible = true;
         tot_content.Visible = true;
         template.Visible = true;
     }
     else
     {
         //btnConfirm.Visible = false;
         //divmap.Visible = false;
         //lblAdd.Visible = false;
         //lblAddress.Visible = false;
         tot_content.Visible = false;
         noContent.Visible = true;
         template.Visible = false;
     }
 }
 protected void btnConfirm_Click(object sender, EventArgs e)
 {
     int eid;
     int.TryParse(Session["userid"].ToString(), out eid);
     dept = service.getDNameByEid(eid);
     service.sendEmailToStoreClerk(eid);
     int deptId = dept.DepID;
     service.UpdateDisbursementReceiveDateByDepID(deptId);
     binding();
 }
示例#3
0
        public void UpdateDeptRapNameById(int currentDepartmentId, string DeptRapName)
        {
            try
            {
                department CurrentDept = new department();

                CurrentDept = (from r in se.departments
                               where r.DepID == currentDepartmentId
                               select r).FirstOrDefault();

                CurrentDept.DepRepName = DeptRapName;
                se.SaveChanges();
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
示例#4
0
        public void UpdateDepartment(department currentDepartment)
        {
            try
            {
                department CurrentDept = new department();

                CurrentDept = (from r in se.departments
                               where r.DepID == currentDepartment.DepID
                               select r).FirstOrDefault();

                CurrentDept.DepID = currentDepartment.DepID;
                CurrentDept.DepName = currentDepartment.DepName;
                CurrentDept.DepContactName = currentDepartment.DepContactName;
                CurrentDept.DepContactNumber = currentDepartment.DepContactNumber;
                CurrentDept.DepFax = currentDepartment.DepFax;
                CurrentDept.DepCollectionPointID = currentDepartment.DepCollectionPointID;
                CurrentDept.DepRepName = currentDepartment.DepRepName;
                CurrentDept.DepHeadName = currentDepartment.DepHeadName;
                se.SaveChanges();
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
示例#5
0
        public department GetdepartmentDetailsByDeptID(int searchDeptID)
        {
            try
            {
                department CurrentDept = new department();

                CurrentDept = (from r in se.departments
                               where r.DepID == searchDeptID
                               select r).FirstOrDefault();
                return CurrentDept;
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
示例#6
0
 public void UpdateDepartment(department curDept)
 {
     drep.UpdateDepartment(curDept);
 }
        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();
            }
        }
        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();
            }
        }