Example #1
0
        // GET: Part40DisplayForFormatText/Details/5
        public ActionResult Details(int id)
        {
            EmployeeBusiness emp      = new EmployeeBusiness();
            EmployeeBO       employee = (EmployeeBO)emp.DeptEmployees().Where(m => m.EmpID == id).FirstOrDefault();

            return(View(employee));
        }
        private static void DisplayAllEmployees()
        {
            try
            {
                EmployeeBO      BO        = new EmployeeBO();
                List <Employee> Employees = BO.GetEmployees();

                if (Employees.Count == 0)
                {
                    Console.WriteLine("No employee found");
                }
                else
                {
                    Console.WriteLine();
                    Console.WriteLine("ID\tName\tEmail");
                    foreach (Employee emp in Employees)
                    {
                        Console.WriteLine($"{emp.Id}\t{emp.Name}\t{emp.Email}");
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.Message);
            }
        }
        static void AddEmployee()
        {
            try
            {
                Employee emp = new Employee();
                Console.WriteLine("Enter name");
                emp.Name = Console.ReadLine();

                Console.WriteLine("Enter email");
                emp.Email = Console.ReadLine();

                EmployeeBO BO      = new EmployeeBO();
                bool       IsAdded = BO.Add(emp);
                if (IsAdded)
                {
                    Console.WriteLine("Added successfull");
                }
                else
                {
                    Console.WriteLine("Add failed. Try later");
                }
            }
            catch (EmployeeException ex)
            {
                Console.WriteLine("Validation failed : " + ex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error : " + ex.Message);
            }
        }
Example #4
0
        public void TestAdd(EmployeeDto _EmployeeDto)
        {
            var  _EmployeeBO = new EmployeeBO(new FakeEmployeeConverter());
            bool hasAdded    = _EmployeeBO.CreateEntiy(_EmployeeDto);

            Assert.True(hasAdded);
        }
        //Change Representatvie Page
        //1.. Get Department Employees ID this method is accessed by delegate head and change rep pages
        public List <EmployeeBO> getDepartmentEmployees(int departmentID, string status)
        {
            List <Employee>   elst   = new List <Employee>();
            List <EmployeeBO> eboLst = new List <EmployeeBO>();
            int count = 0;

            if (status.Equals("head"))
            {
                elst = da.getDeptEmployeeForDelegateHead(departmentID); //For Delegated Head Page
            }
            else if (status.Equals("rep"))
            {
                elst = da.getDepartmentEmployees(departmentID); //For Change Rep Page
            }
            foreach (Employee e in elst)
            {
                count++;
                EmployeeBO emp = new EmployeeBO();
                emp.SerialNo     = count;
                emp.EmployeeID   = e.EmployeeID;
                emp.FirstName    = e.FirstName;
                emp.LastName     = e.LastName;
                emp.FullName     = e.FirstName + " " + e.LastName;
                emp.Email        = e.Email;
                emp.Phone        = e.Phone;
                emp.Address      = e.Address;
                emp.DepartmentID = e.DepartmentID;
                eboLst.Add(emp);
            }
            return(eboLst);
        }
Example #6
0
        protected void btnResubmit_Click(object sender, EventArgs e)
        {
            purchaseOrderBL = new PurchaseOrderBL();
            poId            = Request.QueryString["poId"];
            string     clerkComment = tbClerkComments.Text;
            EmployeeBO ebo          = (EmployeeBO)Session["employee"];
            string     empId        = ebo.EmployeeId;

            Boolean flag = purchaseOrderBL.resubmitPO(poId, clerkComment);

            if (flag)
            {
                SendEmailResubmit(poId);
            }
            else
            {
                string script = "alert('There is some issue in sending email. We apologize for this!');";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script, true);
            }
            Response.Redirect("~/Store/POList.aspx");

            gvPurchaseOrderList.DataSource = purchaseOrderBL.getPurchaseOrderList(empId);
            gvPurchaseOrderList.DataBind();
            footableSettings();
        }
Example #7
0
        public void SendEmailApproveReject(string poId, int value)
        {
            purchaseOrderBL = new PurchaseOrderBL();
            PurchaseOrderBO po          = purchaseOrderBL.getStatusAndOrderDateDetails(poId);
            string          requestorId = po.RequestorId;
            EmployeeBO      emp         = purchaseOrderBL.getRequestorName(requestorId);
            SendEmail       se          = new SendEmail();
            string          subject     = "";
            string          body        = "";

            if (value == 1)
            {
                subject = "Purchase Order Approved";
                body    = "Dear " + emp.EmployeeName + ", \n"
                          + "\n" + "The Purchase Order with ID: " + poId + " requested by you has been approved."
                          + "\n" + "(This is an auto-generated email, please do not reply.)"
                          + "\n\n\n" + "Regards,"
                          + "\n" + "Admin";
            }
            else
            {
                subject = "Purchase Order Rejected";
                body    = "Dear " + emp.EmployeeName + ", \n"
                          + "\n" + "The Purchase Order with ID: " + poId + " requested by you has been rejected. Please contact your supervisor for further information"
                          + "\n" + "(This is an auto-generated email, please do not reply.)"
                          + "\n\n\n" + "Regards,"
                          + "\n" + "Admin";
            }
            se.sendCPEmail(subject, body, emp.EmployeeEmail);
        }
Example #8
0
        public Boolean checkDelegate(string title)
        {
            EmployeeBO ebo = ada.checkDelegate(title);

            if (DateTime.Today >= ebo.DelegateStartDate)
            {
                if (ebo.DelegateEndDate >= DateTime.Today)
                {
                    if (ebo.Delegate.Equals(1))
                    {
                        if (title.Equals("Manager"))
                        {
                            return(true);
                        }

                        else if (title.Equals("Supervisor"))
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(false);
        }
Example #9
0
        public void TestUpdateEntiyWithGet(EmployeeDto _EmployeeDto)
        {
            var _EmployeeBO = new EmployeeBO(new FakeEmployeeConverter());
            var dbResult    = _EmployeeBO.UpdateEntiyWithGet(_EmployeeDto);

            Assert.NotNull(dbResult);
        }
Example #10
0
 public ActionResult AddRecords(EmployeeBO emp)
 {
     try
     {
         if (ModelState.IsValid)
         {
             ViewBag.MaritalStatus = _empBL.GetMaritalStatus();
             ViewBag.Location      = _empBL.GetLocationList();
             ViewBag.Message       = _empBL.Savedata(emp);
             ModelState.Clear();
             return(View());
         }
         else
         {
             ViewBag.MaritalStatus = _empBL.GetMaritalStatus();
             ViewBag.Location      = _empBL.GetLocationList();
             ViewBag.ErrorMessage  = _empBL.GeneralErrorMessage();
             return(View(emp));
         }
     }
     catch (Exception ex)
     {
         ViewBag.MaritalStatus = _empBL.GetMaritalStatus();
         ViewBag.Location      = _empBL.GetLocationList();
         ViewBag.ErrorMessage  = ex.Message.ToString();
         return(View(emp));
     }
 }
        public void getEmployees()
        {
            this.GetMemoContext().Database.EnsureDeleted();
            EmployeeBO employee1 = new EmployeeBO()
            {
                Firstname  = "Bo",
                Lastname   = "Pedersen",
                Username   = "******",
                Password   = "******",
                MacAddress = "asdDDFASFDSF"
            };

            this.GetService().Create(employee1);
            EmployeeBO employee2 = new EmployeeBO()
            {
                Firstname  = "Bent",
                Lastname   = "Nygaard",
                Username   = "******",
                Password   = "******",
                MacAddress = "asdDDFASFDSF"
            };

            employee2 = this.GetService().Create(employee2);
            Assert.AreEqual(this.GetService().Get(employee2.Id).Firstname, "Bent");
        }
Example #12
0
        public EmployeeBO getStoreSupervisorBO()
        {
            Employee   ss   = da.getStoreSupervisor();
            EmployeeBO ssbo = convertEmployeeBO(ss);

            return(ssbo);
        }
Example #13
0
        public EmployeeBO getStoreManagerBO()
        {
            Employee   sm   = da.getStoreManager();
            EmployeeBO smbo = convertEmployeeBO(sm);

            return(smbo);
        }
Example #14
0
        // GET: Part40DisplayForFormatText/Edit/5
        public ActionResult Edit(int id)
        {
            EmployeeBusiness emp      = new EmployeeBusiness();
            EmployeeBO       employee = (EmployeeBO)emp.DeptEmployees().SingleOrDefault(m => m.EmpID == id);

            return(View(employee));
        }
Example #15
0
        protected void btnActivate_Click(object sender, EventArgs e)
        {
            ebo   = (EmployeeBO)Session["employee"];
            empId = ddlEmployee.SelectedValue;

            DateTime startDate = DateTime.Parse(tbStartDate.Text);
            DateTime endDate   = DateTime.Parse(tbEndDate.Text);

            //activates delegation based on inputted values

            bl.activate(ebo.EmployeeDept, empId, startDate, endDate);

            //sending of email notification to delegated employee

            delegatedEmployee = bl.getDelegatedEmployee(ebo.Department.DeptId);
            string sub, body, emailid;

            sub     = "Department Head Delegation";
            body    = "Dear " + delegatedEmployee.EmployeeName + ",\n" + "\n" + "Congratulations! You have been selected as my delegate from " + tbStartDate.Text + " to " + tbEndDate.Text + ".\n\n" + "Warmest Regards,\n" + ebo.EmployeeName + "\nDepartment Head";;
            emailid = delegatedEmployee.EmployeeEmail;

            email.sendCPEmail(sub, body, emailid);

            ebo.Delegate          = 1;
            ebo.DelegateStartDate = startDate;
            ebo.DelegateEndDate   = endDate;
            Session["employee"]   = ebo;
            Response.Redirect(Request.RawUrl);
        }
Example #16
0
        public void TestUpdateWithAttachEntiy(EmployeeDto _EmployeeDto)
        {
            var  _EmployeeBO = new EmployeeBO(new FakeEmployeeConverter());
            bool isUpdated   = _EmployeeBO.UpdateWithAttachEntiy(_EmployeeDto);

            Assert.True(isUpdated);
        }
Example #17
0
        protected void btnReject_Click(object sender, EventArgs e)
        {
            purchaseOrderBL = new PurchaseOrderBL();
            poId            = Request.QueryString["poId"];
            string     status            = "Rejected";
            string     supervisorComment = tbSupervisorComments.Text;
            EmployeeBO ebo        = (EmployeeBO)Session["employee"];
            string     approverId = ebo.EmployeeId;
            Boolean    flag       = purchaseOrderBL.updateStatusByPoId(poId, status, supervisorComment, approverId);
            int        value      = 2;

            if (flag)
            {
                SendEmailApproveReject(poId, value);
            }
            else
            {
                string script = "alert('There is some issue in sending email. We apologize for this!');";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script, true);
            }
            Response.Redirect("~/Store/POList.aspx");

            gvPurchaseOrderList.DataSource = purchaseOrderBL.getPurchaseOrderListAll();
            gvPurchaseOrderList.DataBind();
            footableSettings();
        }
Example #18
0
        public void TestDeleteEntiy(EmployeeDto _EmployeeDto)
        {
            var  _EmployeeBO = new EmployeeBO(new FakeEmployeeConverter());
            bool isDeleted   = _EmployeeBO.DeleteEntiy(_EmployeeDto);

            Assert.True(isDeleted);
        }
Example #19
0
        public void doProcess()
        {
            if (Session["employee"] != null)
            {
                EmployeeBO ebo           = (EmployeeBO)Session["employee"];
                string     title         = ebo.EmployeeTitle;
                int        delegateValue = ebo.Delegate;
                poId            = Request.QueryString["poId"];
                lblPOID.Text    = poId;
                lblName.Text    = ebo.EmployeeName;
                purchaseOrderBL = new PurchaseOrderBL();
                PurchaseOrderBO pbo = purchaseOrderBL.getStatusAndOrderDateDetails(poId);
                lblOrderDate.Text         = String.Format("{0:dd/MMM/yyyy}", pbo.DateOfOrder);
                lblStatus.Text            = pbo.Status;
                tbClerkComments.Text      = pbo.CommentByClerk;
                tbSupervisorComments.Text = pbo.CommentBySupervisor;

                if (title.Equals("Supervisor") && (lblStatus.Text.Equals("Pending")))
                {
                    btnResubmit.Visible = false;
                    this.gvPurchaseOrderList.Columns[7].Visible = false;
                    tbClerkComments.Enabled = false;
                }
                else if (title.Equals("Manager") && (lblStatus.Text.Equals("Pending")) && delegateValue == 1)
                {
                    btnResubmit.Visible = false;
                    this.gvPurchaseOrderList.Columns[7].Visible = false;
                    tbClerkComments.Enabled = false;
                }
                else if (title.Equals("Clerk") && lblStatus.Text.Equals("Pending"))
                {
                    btnResubmit.Enabled          = true;
                    tbSupervisorComments.Enabled = false;
                    this.gvPurchaseOrderList.Columns[7].Visible = true;
                    btnApprove.Visible = false;
                    btnReject.Visible  = false;
                }
                else
                {
                    this.gvPurchaseOrderList.Columns[7].Visible = false;
                    tbClerkComments.Enabled      = false;
                    tbSupervisorComments.Enabled = false;
                    btnResubmit.Visible          = false;
                    btnApprove.Visible           = false;
                    btnReject.Visible            = false;
                }
                List <PurchaseOrderDetailsJoinBO> poDetailList = purchaseOrderBL.getPurchaseOrderDetailsList(poId);

                if (poDetailList.Count != 0)
                {
                    gvPurchaseOrderList.DataSource = poDetailList;
                    gvPurchaseOrderList.DataBind();
                    footableSettings();
                }
            }
            else
            {
                Console.WriteLine("Something is wrong!!!!!!");
            }
        }
Example #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ebo = (EmployeeBO)Session["employee"];
            Page.DataBind();

            //populate the dropdown list with employees from the logged in head's dept

            if (!IsPostBack)
            {
                ddlEmployee.DataSource     = bl.getEmployeeListByDepartmentId(ebo.Department.DeptId);
                ddlEmployee.DataTextField  = "EmployeeName";
                ddlEmployee.DataValueField = "EmployeeId";
                ddlEmployee.DataBind();
            }

            //check delegate for the controls' visiblity

            if (ebo.Delegate.Equals(0))
            {
                btnDeactivate.Visible = false;
            }

            if (ebo.Delegate.Equals(1))
            {
                btnActivate.Visible = false;
                ddlEmployee.Enabled = false;
                tbStartDate.Enabled = false;
                tbEndDate.Enabled   = false;

                delegatedEmployee         = bl.getDelegatedEmployee(ebo.EmployeeDept);
                ddlEmployee.SelectedValue = Convert.ToString(delegatedEmployee.EmployeeId);
                tbStartDate.Text          = DateTime.Parse(Convert.ToString(ebo.DelegateStartDate)).ToString("yyyy-MM-dd");
                tbEndDate.Text            = DateTime.Parse(Convert.ToString(ebo.DelegateEndDate)).ToString("yyyy-MM-dd");
            }
        }
        public EmployeeBO getDeptHeadByDepId(string depId)
        {
            Employee   head = da.getHeadByDepId(depId);
            EmployeeBO hbo  = convertEmployeeBO(head);

            return(hbo);
        }
Example #22
0
 /// <summary>
 /// Creates the password with hash and salt
 /// </summary>
 /// <param name="emp"></param>
 private void createPassword(EmployeeBO emp)
 {
     password = emp.Password;
     PasswordHash.CreatePasswordHash(password, out passwordHash, out passwordSalt);
     userFromDb.PasswordHash = passwordHash;
     userFromDb.PasswordSalt = passwordSalt;
 }
Example #23
0
        public void checkPrimaryRole(int deptID)
        {
            EmployeeBO emp = bl.getDepartmentManager(deptID);

            lblCurrentManager.Text  = emp.FullName;
            ViewState["oldManager"] = emp.EmployeeID.ToString();

            checkDate(emp);

            ViewState["oldManager"] = emp.EmployeeID.ToString();

            changeManagerGV.DataSource = bl.getDepartmentStoreEmployeeForManager(deptID);
            changeManagerGV.DataBind();

            if (emp.PrimaryRole.Equals("Store Manager"))
            {
                btnRemoveManager.Visible = false;
            }
            else
            {
                btnRemoveManager.Visible = true;
            }

            //Check One Radio
            for (int i = 0; i < changeManagerGV.Rows.Count; i++)
            {
                if (i == 0)
                {
                    RadioButton btn = changeManagerGV.Rows[i].FindControl("radbtnChoose") as RadioButton;
                    btn.Checked = true;
                }
            }
        }
Example #24
0
        protected void btnChange_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime startDate = DateTime.Parse(txtStartDate.Text);
                DateTime endDate   = DateTime.Parse(txtEndDate.Text);

                if (DateTimeValidate(startDate, endDate))
                {
                    int empID = int.Parse(ViewState["newManager"].ToString());
                    bl.assignDeptManager(empID, startDate, endDate);

                    int oldEmpID = int.Parse(ViewState["oldManager"].ToString());
                    bl.removeDeptManager(oldEmpID);

                    checkPrimaryRole(int.Parse(ViewState["depID"].ToString()));

                    //Get the Employee By EmpID
                    EmployeeBO emp      = delegateBl.getEmpByID(empID);
                    string     fullName = emp.FirstName + " " + emp.LastName;
                    sendMail(emp.Email, fullName);
                }
            } catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Example #25
0
        private void checkPrimaryOrDelegate(int depID)
        {
            EmployeeBO empBO = delegateBL.getDepartmentDelegateHead(depID);

            lblDeptHead.Text = empBO.FirstName + " " + empBO.LastName;
            checkDate(empBO);//Check Date

            ViewState["oldHead"] = empBO.EmployeeID;

            string status = "head";

            delegateHeadGV.DataSource = empBL.getDepartmentEmployees(depID, status);
            delegateHeadGV.DataBind();

            if (empBO.PrimaryRole.Equals("Dept Head"))
            {
                btnRemoveHead.Visible = false;
            }
            else
            {
                btnRemoveHead.Visible = true;
            }

            //Check One Radio
            for (int i = 0; i < delegateHeadGV.Rows.Count; i++)
            {
                if (i == 0)
                {
                    RadioButton btn = delegateHeadGV.Rows[i].FindControl("radbtnChoose") as RadioButton;
                    btn.Checked = true;
                }
            }
        }
        protected void Submit_Click(object sender, EventArgs e)
        {
            EmployeeBO ebo = new EmployeeBO();

            ebo.Username = txtUsername.Text;
            string pass = GetSHA1HashData(txtPassword.Text);

            Label1.Text  = pass;
            ebo.Password = pass;
            EmployeeBL ebl        = new EmployeeBL();
            int        returntype = ebl.VerifyAuth(ebo);

            if (returntype == 0)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertMessage", "alert('Invalid username / Password')", true);
                txtUsername.Text = "";
                txtPassword.Text = "";
            }
            else if (returntype == 1)
            {
                Session["UserID"] = txtUsername.Text;
                ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Logged in as Employee Successfully');window.location='EmployeeHome.aspx';", true);
            }
            else if (returntype == 2)
            {
                Session["UserID"] = txtUsername.Text;
                ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Logged in as Unit Head Successfully');window.location='UnitheadHome.aspx';", true);
            }
            else if (returntype == 3)
            {
                Session["UserID"] = txtUsername.Text;
                ClientScript.RegisterStartupScript(Page.GetType(), "alertMessage", "alert('Logged in as HR Successfully');window.location='HRHome.aspx';", true);
            }
        }
Example #27
0
        public EmployeeBO getDelegatedEmployee(string deptId)
        {
            Employee e = da.getDelegatedEmp(deptId);

            ebo = new EmployeeBO();
            ebo = convertEmployeeBO(e);
            return(ebo);
        }
        public EmployeeBO getDepartmentRep(string deptId)
        {
            Employee e = da.getDeptRep(deptId);

            ebo = new EmployeeBO();
            ebo = convertEmployeeBO(e);
            return(ebo);
        }
        public static bool UpdateEmployee(EmployeeBO employee)
        {
            EmployeeDAS employeeDAS         = new EmployeeDAS();
            int         numberOfRowImpacted = 0;

            numberOfRowImpacted = employeeDAS.UpdateEmployee(employee);
            return(numberOfRowImpacted > 0);
        }
Example #30
0
        public void UpdateEmployee(EmployeeBO employee)
        {
            var employeeData = _unitOfWork.EmployeeTable.GetSingle(employee.Id);

            employeeData.EmployeeDetail.Family_name = employee.FamilyName;
            employeeData.EmployeeDetail.Given_name  = employee.GivenName;
            _unitOfWork.Commit();
        }