예제 #1
0
        protected void fetchparametersButton_Click(object sender, EventArgs e)
        {
            PERSONALDETAILS pd  = pdlist.FirstOrDefault(p => (p.FirstName + " " + p.LastName) == NameTextBox.Text);
            EMPLOYEE        emp = elist.FirstOrDefault(em => em.PersonalDetailId == pd.PersonalDetailId);

            jt = getJobTitle(emp.JobtitleId.Value);

            List <PERFORMANCEPARAMETER> pplist = getparameters(jt.JobTitleId);
            int i = 1;

            foreach (PERFORMANCEPARAMETER p in pplist)
            {
                TableRow  tr       = new TableRow();
                TableCell tc       = new TableCell();
                Label     parlabel = new Label();
                parlabel.Text = i + ". " + p.ParameterName + " (" + p.MinRating + "-" + p.MaxRating + ")";
                tc.Controls.Add(parlabel);
                tr.Cells.Add(tc);
                SelectedParametersTable.Rows.Add(tr);
                i++;
            }
            if (pplist.Count == 0)
            {
                JobTitleLabel.Text    = "No parameters set for " + jt.JobTitleName;
                manageparameters.Text = "Add parameters...";
            }
            else
            {
                JobTitleLabel.Text = "Selected Parameters for: " + jt.JobTitleName;
                parametersfetched  = true;
            }
            manageparameters.Visible = true;
        }
예제 #2
0
        private string getEmployeeName(string employeeId)
        {
            EMPLOYEE        e  = elist.Find(emp => emp.EmployeeId == employeeId);
            PERSONALDETAILS pd = pdlist.Find(p => p.PersonalDetailId == e.PersonalDetailId);

            return(pd.FirstName + " " + pd.LastName);
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                EMPLOYEE emp;
                String   eid = Session["EID"].ToString();
                emp = getselectedemployee(eid);
                PERSONALDETAILS pd = getpersonaldetails(emp.PersonalDetailId);

                String fname = pd.FirstName;
                FirstName.Text = fname;

                String mname = pd.MiddleName;
                MiddleName.Text = mname;

                String lname = pd.LastName;
                LastName.Text = lname;

                String empid = emp.EmployeeId;
                IDValue.Text = empid;

                DateTime dob = pd.DateOfBirth.Value;
                DOBValue.Text = dob.ToString("dd-MM-yyyy");

                String gen = pd.Gender;
                GenValue.Text = gen;

                String nat = pd.Nationality;
                NationalityValue.Text = nat;

                String ms = pd.MartialStatus;
                MaritalSatusValue.Text = ms;
            }
        }
예제 #4
0
        protected void Add_Click(object sender, EventArgs e)
        {
            string          name = NewSupervisorNameValue.Text;
            PERSONALDETAILS pd   = pdlist.Find(p => (p.FirstName + " " + p.MiddleName + " " + p.LastName).Equals(name));
            EMPLOYEE        emp  = elist.Find(em => em.PersonalDetailId == pd.PersonalDetailId);
            string          eid  = emp.EmployeeId;
            SUPERVISOR      sup  = new SUPERVISOR();

            sup.EmployeeId = eid;

            var client = new HttpClient();

            client.BaseAddress = new Uri(Global.URIstring);

            var postTask = client.PostAsJsonAsync <SUPERVISOR>("supervisor", sup);

            postTask.Wait();

            var result = postTask.Result;

            if (result.IsSuccessStatusCode)
            {
                Response.Write("Add successfull!");
            }
        }
예제 #5
0
        private void getemployees()
        {
            elist  = new List <EMPLOYEE>();
            pdlist = new List <PERSONALDETAILS>();
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Global.URIstring);
                //HTTP GET
                var responseTask = client.GetAsync("Employees/");
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <EMPLOYEE[]>();
                    readTask.Wait();

                    var employees = readTask.Result;
                    foreach (EMPLOYEE e in employees)
                    {
                        if (e.SupervisorId == supervisorid)
                        {
                            elist.Add(e);
                            PERSONALDETAILS pd = getpersonaldetails(e.PersonalDetailId.Value);
                            pdlist.Add(pd);
                        }
                    }
                }
            }
        }
예제 #6
0
파일: Login.aspx.cs 프로젝트: yashc1/EMS
        private string getEmployeeName(string employeeId)
        {
            var client = new HttpClient();

            client.BaseAddress = new Uri(Global.URIstring);
            var responseTask = client.GetAsync("Employees/" + Username.Text.ToLower());

            responseTask.Wait();
            var      result = responseTask.Result;
            EMPLOYEE emp    = null;

            if (result.IsSuccessStatusCode)
            {
                var readTask = result.Content.ReadAsAsync <EMPLOYEE>();
                readTask.Wait();

                emp = readTask.Result;
            }
            responseTask = client.GetAsync("PersonalDetails/" + emp.PersonalDetailId.ToString());
            responseTask.Wait();
            result = responseTask.Result;
            PERSONALDETAILS per = null;

            if (result.IsSuccessStatusCode)
            {
                var readTask = result.Content.ReadAsAsync <PERSONALDETAILS>();
                readTask.Wait();

                per = readTask.Result;
            }
            return(per.FirstName);
        }
예제 #7
0
        //load data in table with filters
        private void filterdata()
        {
            getgeneratedreviews();
            List <GENERATEREVIEW> filterlist = grlist;

            //date filter not selected
            if (fromdatetb.Text != "")
            {
                foreach (GENERATEREVIEW g in filterlist.ToList())
                {
                    DateTime date = Convert.ToDateTime(fromdatetb.Text);
                    if (g.DueDate <= date)
                    {
                        filterlist.Remove(g);
                    }
                }
            }
            if (todatetb.Text != "")
            {
                foreach (GENERATEREVIEW g in filterlist.ToList())
                {
                    DateTime date = Convert.ToDateTime(todatetb.Text);
                    if (g.DueDate >= date)
                    {
                        filterlist.Remove(g);
                    }
                }
            }
            if (statusddl.SelectedValue != "0")
            {
                foreach (GENERATEREVIEW g in filterlist.ToList())
                {
                    if (!g.Status.Equals(statusddl.SelectedValue))
                    {
                        filterlist.Remove(g);
                    }
                }
            }
            if (EnameTextBox.Text != "")
            {
                PERSONALDETAILS pd = pdlist.Find(p => (p.FirstName + " " + p.LastName).Equals(EnameTextBox.Text));
                EMPLOYEE        e  = elist.Find(emp => emp.PersonalDetailId == pd.PersonalDetailId);

                if (pd != null)
                {
                    foreach (GENERATEREVIEW g in filterlist.ToList())
                    {
                        if (!g.EmployeeId.Equals(e.EmployeeId))
                        {
                            filterlist.Remove(g);
                        }
                    }
                }
                else
                {
                    filterlist.RemoveAll(g => true);
                }
            }
            loadtable(filterlist);
        }
예제 #8
0
        protected void Change_Click(object sender, EventArgs e)
        {
            string          empname = EmployeeNameValue.Text;
            PERSONALDETAILS pd      = pdlist.Find(p => (p.FirstName + " " + p.MiddleName + " " + p.LastName).Equals(empname));
            EMPLOYEE        emp     = elist.Find(em => em.PersonalDetailId == pd.PersonalDetailId);
            string          eid     = emp.EmployeeId;


            string          supname = SupervisorNameValue.Text;
            PERSONALDETAILS pd1     = pdlist.Find(p => (p.FirstName + " " + p.MiddleName + " " + p.LastName).Equals(supname));
            EMPLOYEE        supemp  = elist.Find(em => em.PersonalDetailId == pd1.PersonalDetailId);

            SUPERVISOR sup1 = suplist.Find(s => s.EmployeeId == supemp.EmployeeId);

            emp.SupervisorId = sup1.SupervisorId;

            var client = new HttpClient();

            client.BaseAddress = new Uri(Global.URIstring);

            var putTask = client.PutAsJsonAsync <EMPLOYEE>("employees/" + emp.EmployeeId, emp);

            putTask.Wait();

            var result = putTask.Result;

            if (result.IsSuccessStatusCode)
            {
                Response.Write("Change successfull!");
            }
        }
예제 #9
0
        protected void Add_Click(object sender, EventArgs e)
        {
            if (parametersfetched == false)
            {
                employeeError.Visible = true;
            }
            else
            {
                employeeError.Visible = false;
                //post to generatereview table
                GENERATEREVIEW g = new GENERATEREVIEW();
                g.DueDate   = Convert.ToDateTime(DueDateTextBox.Text);
                g.StartDate = Convert.ToDateTime(FromDateTextBox.Text);
                g.EndDate   = Convert.ToDateTime(ToDateTextBox.Text);
                PERSONALDETAILS pd = pdlist.FirstOrDefault(p => (p.FirstName + " " + p.LastName) == NameTextBox.Text);
                g.EmployeeId = elist.FirstOrDefault(em => em.PersonalDetailId == pd.PersonalDetailId).EmployeeId;
                g.Status     = "Generated";

                var client = new HttpClient();
                client.BaseAddress = new Uri(Global.URIstring);
                var postTask = client.PostAsJsonAsync <GENERATEREVIEW>("generatedreviews/", g);
                postTask.Wait();

                var result = postTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    Response.Write("Successfuly genertated review!");
                    Response.Redirect("PendingReviews.aspx");
                }
            }
        }
예제 #10
0
        protected void ViewPayslip_Click(object sender, EventArgs e)
        {
            Table2.Visible = true;
            Table3.Visible = true;
            Print.Visible  = true;
            prlist         = getallpaymentrecord();

            int             month = Convert.ToInt32(MonthValue.SelectedValue);
            int             year  = Convert.ToInt32(YearValue.SelectedValue);
            string          name  = TextBox1.Text;
            PERSONALDETAILS pd    = pdlist.Find(p => (p.FirstName + " " + p.MiddleName + " " + p.LastName).Equals(name));
            EMPLOYEE        emp   = elist.Find(em => em.PersonalDetailId == pd.PersonalDetailId);
            string          eid   = emp.EmployeeId;
            PAYMENTRECORD   pr    = prlist.Find(p => p.PaymentMonth == month && p.PaymentYear == year && p.EmployeeId.Equals(eid));

            PaymentDateValue.Text     = pr.PaymentMonth + " / " + pr.PaymentYear;
            EmployeeNameValue.Text    = TextBox1.Text;
            JobTitleValue.Text        = pr.JobTitle;
            BasicPayValue.Text        = pr.BasicPay.ToString();
            TAValue.Text              = pr.TA.ToString();
            HRAValue.Text             = pr.HRA.ToString();
            OtherAllowancesValue.Text = pr.OtherAllowances.ToString();
            EPFValue.Text             = pr.EPF.ToString();
            TaxValue.Text             = pr.Tax.ToString();
            AbsenceValue.Text         = pr.Absence.ToString();
            TotalEarningsValue.Text   = (pr.BasicPay + pr.TA + pr.HRA + pr.OtherAllowances).ToString();
            TotalDeductionsValue.Text = (pr.EPF + pr.Tax + pr.Absence).ToString();
            NetSalaryValue.Text       = (Convert.ToInt32(TotalEarningsValue.Text) - Convert.ToInt32(TotalDeductionsValue.Text)).ToString();
        }
예제 #11
0
        private string getEmployeeName(string employeeId)
        {
            EMPLOYEE e = getEmployee(employeeId);

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Global.URIstring);
                //HTTP GET
                var responseTask = client.GetAsync("PersonalDetails/" + e.PersonalDetailId.ToString());
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <PERSONALDETAILS>();
                    readTask.Wait();

                    PERSONALDETAILS pd = readTask.Result;
                    return(pd.FirstName + " " + pd.LastName);
                }
                else
                {
                    return("");
                }
            }
        }
예제 #12
0
        protected void Save_Click(object sender, EventArgs e)
        {
            PERSONALDETAILS pd  = new PERSONALDETAILS();
            EMPLOYEE        emp = new EMPLOYEE();

            pd.FirstName     = FirstName.Text;
            pd.MiddleName    = MiddleName.Text;
            pd.LastName      = LastName.Text;
            pd.DateOfBirth   = Convert.ToDateTime(DOBValue.Text);
            emp.JobtitleId   = Convert.ToInt32(JobTitleValue.SelectedValue);
            emp.SupervisorId = Convert.ToInt32(SupervisorValue.SelectedValue);

            string JoinYear = DateTime.Now.ToString("yy");

            string firstname = FirstName.Text.ToLower();
            char   finitial  = firstname[0];

            string middlename = MiddleName.Text.ToLower();
            char   minitial   = middlename[0];

            string lastname = LastName.Text.ToLower();
            char   linitial = lastname[0];

            DateTime birthday = Convert.ToDateTime(DOBValue.Text);
            string   bday     = birthday.ToString("dd");

            emp.EmployeeId     = JoinYear + "" + finitial + "" + minitial + "" + linitial + "" + bday;
            EmployeeId.Visible = true;
            EmployeeId.Text    = "Employee ID:" + emp.EmployeeId;

            var client = new HttpClient();

            client.BaseAddress = new Uri(Global.URIstring);

            var postTask1 = client.PostAsJsonAsync <PERSONALDETAILS>("personaldetails", pd);

            postTask1.Wait();

            var result1 = postTask1.Result;

            string url  = result1.Headers.Location.ToString();
            int    pdid = Convert.ToInt32(url.Split('/').Last());

            emp.PersonalDetailId = pd.PersonalDetailId;

            var postTask = client.PostAsJsonAsync <EMPLOYEE>("employees", emp);

            postTask.Wait();

            var result = postTask.Result;

            if (result.IsSuccessStatusCode && result1.IsSuccessStatusCode)
            {
                Response.Write("Add successfull!");
            }
        }
예제 #13
0
 protected void DirectView_Click(object sender, EventArgs e)
 {
     if (CustomValidator1.IsValid)
     {
         string          name = TextBox1.Text;
         PERSONALDETAILS pd   = pdlist.Find(p => (p.FirstName + " " + p.MiddleName + " " + p.LastName).Equals(name));
         EMPLOYEE        emp  = elist.Find(em => em.PersonalDetailId == pd.PersonalDetailId);
         Session["EID"] = emp.EmployeeId;
         Response.Redirect("PersonalDetails.aspx");
     }
 }
예제 #14
0
        protected void Show_Click(object sender, EventArgs e)
        {
            if (CustomValidator1.IsValid)
            {
                string          name = TextBox1.Text;
                PERSONALDETAILS pd   = pdlist.Find(p => (p.FirstName + " " + p.MiddleName + " " + p.LastName).Equals(name));
                emp = elist.Find(em => em.PersonalDetailId == pd.PersonalDetailId);


                filterdata();
            }
        }
예제 #15
0
        private static List <string> GetNonSupervisorName()
        {
            List <string> namelist = new List <string>();

            foreach (EMPLOYEE emp in elist)
            {
                if (!issupervisor(emp.EmployeeId))
                {
                    PERSONALDETAILS p = pdlist.Find(pd => pd.PersonalDetailId == emp.PersonalDetailId);
                    namelist.Add(p.FirstName + " " + p.MiddleName + " " + p.LastName);
                }
            }
            return(namelist);
        }
예제 #16
0
        private PERSONALDETAILS getpersonaldetails(int?personalDetailId)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Global.URIstring);
                //HTTP GET
                var responseTask = client.GetAsync("PersonalDetails/" + personalDetailId);
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <PERSONALDETAILS>();
                    readTask.Wait();

                    PERSONALDETAILS pd = readTask.Result;
                    return(pd);
                }
                return(null);
            }
        }
예제 #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["userid"] != null)
            {
                var client = new HttpClient();
                client.BaseAddress = new Uri(Global.URIstring);
                //HTTP GET
                var responseTask = client.GetAsync("Employees?id=" + Session["userid"]);
                responseTask.Wait();

                var      result = responseTask.Result;
                EMPLOYEE emp    = new EMPLOYEE();;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <EMPLOYEE>();
                    readTask.Wait();

                    emp = readTask.Result;
                }
                //HTTP GET
                responseTask = client.GetAsync("PersonalDetails/" + emp.PersonalDetailId);
                responseTask.Wait();

                result = responseTask.Result;
                PERSONALDETAILS emppd = new PERSONALDETAILS();
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <PERSONALDETAILS>();
                    readTask.Wait();

                    emppd = readTask.Result;
                    Label l = Master.FindControl("Label1") as Label;
                    l.Text = emppd.FirstName;
                }
            }
            else
            {
                Response.Redirect("Login.aspx");
            }
        }
예제 #18
0
        private void loadtable(List <GENERATEREVIEW> filterlist)
        {
            if (filterlist.Count == 0)
            {
                Table1.Visible         = false;
                noreviewslabel.Visible = true;
            }
            else
            {
                noreviewslabel.Visible = false;
                Table1.Visible         = true;
            }

            for (int i = 1; i < Table1.Rows.Count; i++)
            {
                Table1.Rows.RemoveAt(i);
            }

            foreach (GENERATEREVIEW g in filterlist)
            {
                EMPLOYEE        e   = elist.Find(emp => emp.EmployeeId == g.EmployeeId);
                PERSONALDETAILS pd  = pdlist.Find(p => p.PersonalDetailId == e.PersonalDetailId);
                TableRow        row = new TableRow();
                row.ID = g.GenerateReviewId.ToString();
                TableCell employee = new TableCell();
                employee.HorizontalAlign = HorizontalAlign.Center;
                Label employeelabel = new Label();
                employeelabel.Text = pd.FirstName + " " + pd.LastName;
                employee.Controls.Add(employeelabel);
                row.Cells.Add(employee);


                TableCell duration = new TableCell();
                duration.HorizontalAlign = HorizontalAlign.Center;
                Label dlabel = new Label();
                dlabel.Text = g.StartDate.ToShortDateString() + " to " + g.EndDate.ToShortDateString();
                duration.Controls.Add(dlabel);
                row.Cells.Add(duration);

                TableCell dd      = new TableCell();
                Label     ddlabel = new Label();
                dd.HorizontalAlign = HorizontalAlign.Center;
                ddlabel.Text       = g.DueDate.ToShortDateString();
                dd.Controls.Add(ddlabel);
                row.Cells.Add(dd);

                TableCell status = new TableCell();
                status.HorizontalAlign = HorizontalAlign.Center;
                Label statuslabel = new Label();
                statuslabel.Text = g.Status;
                status.Controls.Add(statuslabel);
                row.Cells.Add(status);



                TableCell review = new TableCell();
                review.HorizontalAlign = HorizontalAlign.Center;
                Table reviewtable = new Table();
                reviewtable.GridLines = GridLines.Both;
                TableHeaderRow hr = new TableHeaderRow();

                TableHeaderCell h1      = new TableHeaderCell();
                Label           h1label = new Label();
                h1label.Text = "Parameter";
                h1.Controls.Add(h1label);
                hr.Cells.Add(h1);

                TableHeaderCell h2      = new TableHeaderCell();
                Label           h2label = new Label();
                h2label.Text = "Rating";
                h2.Controls.Add(h2label);
                hr.Cells.Add(h2);

                TableHeaderCell h3      = new TableHeaderCell();
                Label           h3label = new Label();
                h3label.Text = "Comment";
                h3.Controls.Add(h3label);
                hr.Cells.Add(h3);
                reviewtable.Rows.Add(hr);
                List <REVIEW> rlist = getreviews(g.GenerateReviewId);
                foreach (REVIEW r in rlist)
                {
                    TableRow tr = new TableRow();


                    TableCell parameter = new TableCell();
                    parameter.HorizontalAlign = HorizontalAlign.Center;
                    parameter.Width           = 200;
                    PERFORMANCEPARAMETER p = getparameter(r.PerameterId);
                    String pname           = p.ParameterName;
                    Label  parametername   = new Label();
                    parametername.Text = pname;
                    parameter.Controls.Add(parametername);
                    tr.Cells.Add(parameter);

                    TableCell rating = new TableCell();
                    rating.HorizontalAlign = HorizontalAlign.Center;
                    rating.Width           = 200;
                    double rate        = ((double)r.Rating / ((double)p.MaxRating - (double)p.MinRating + 1)) * 100.0;
                    Label  ratinglabel = new Label();
                    ratinglabel.Text = rate + "% ";
                    rating.Controls.Add(ratinglabel);
                    tr.Cells.Add(rating);

                    TableCell comment = new TableCell();
                    comment.HorizontalAlign = HorizontalAlign.Center;
                    comment.Width           = 200;
                    Label commentlabel = new Label();
                    commentlabel.Text = r.Comment;
                    comment.Controls.Add(commentlabel);
                    tr.Cells.Add(comment);

                    reviewtable.Rows.Add(tr);
                }
                review.Controls.Add(reviewtable);
                row.Cells.Add(review);

                TableCell c1 = new TableCell();
                c1.HorizontalAlign = HorizontalAlign.Center;
                if (g.DueDate >= DateTime.Today)
                {
                    Button edit = new Button();
                    edit.Text            = "Edit";
                    edit.Command        += new CommandEventHandler(editbutton_Click);
                    edit.CommandArgument = g.GenerateReviewId.ToString();
                    c1.Controls.Add(edit);
                }
                row.Cells.Add(c1);
                Table1.Rows.Add(row);
            }
        }