コード例 #1
0
        //
        //On Form Load: Displays Welcome Message, displays today's schedule, if any
        //
        private void EmpHome_Load(object sender, EventArgs e)
        {
            emp = b.getEmployee(emp);
            welcomeLabel.Text = "Welcome " + emp.first_Name + " " + emp.last_Name;

            ResultsBS r = new ResultsBS();
            int count = r.getExamCountForEmployee(emp);
            Exam_Details[] er = new Exam_Details[count];
            er = r.getExamIDsForEmployee(emp, count);
            er = eb.getSchedule(er);
            int[] index = eb.checkTodaysSchedule(er);
            Results[] res = new Results[index.Length];
            for (int i = 0; i < index.Length; i++)
            {
                res[i] = new Results();
                res[i].employee_ID = emp.employee_Id;
                res[i].exam_ID = er[index[i]].exam_ID;
            }

            //bool[] feed = new bool[index.Length];
            res = r.checkIfAppeared(res);

            int total = 0;
            for (int i = res.Length - 1; i >= 0; i--)
            {
                if (res[i].score == -1)
                {
                    total++;
                    ed.exam_ID = res[i].exam_ID;
                }
            }

            if (total == 0)
            {
                examIDLabel.Text = "Sorry.";
                examTypeLabel.Text = "You dont have any test scheduled today.";
                dateLabel.Text = "";
                durationLabel.Text = "";
                noteLabel.Text = "";
                skipTutorial.Enabled = false;
                takeTutorial.Enabled = false;
            }
            else
            {
                ed = eb.getExamDetails(ed);
                Exam_Types et1 = new Exam_Types();
                et1.exam_Type = ed.exam_Type;
                et1 = et.getExamType(et1);

                examIDLabel.Text += ed.exam_ID;
                examTypeLabel.Text +=" " +et1.exam_Type + " (" + et1.subject + " Level " + et1.level_Number+")";
                dateLabel.Text += ed.datetime.Date.ToShortDateString(); ;
                durationLabel.Text += +ed.duration;
                total--;
                if (total >= 1)
                    noteLabel.Text += "You have " + total + " more exams scheduled today.";
                else
                    noteLabel.Text = "";
            }
        }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     emp = (Employee)Session["employee"];
     ed = (Exam_Details)Session["exam"];
     nameLabel.Text = emp.first_Name + " " + emp.last_Name;
     examIDLabel.Text = "Exam ID:" + ed.exam_ID;
 }
コード例 #3
0
 public Result(Employee e1, Exam_Details e2,Questions[] q1, Answers[] a1)
 {
     InitializeComponent();
     emp = e1;
     ed = e2;
     a = a1;
     q = q1;
 }
コード例 #4
0
 public CheckSolution(Questions[] q1, Answers[] a1, Employee e1, Exam_Details ed1)
 {
     InitializeComponent();
     q = q1;
     a = a1;
     emp = e1;
     ed = ed1;
 }
コード例 #5
0
 //
 //Accepts and assigns Question, Answers, Bookmark array, index, time left, Employee and Exam Details
 //
 public PictureQuestionSingleAns(Questions[] que, Answers[] ans, Bookmark[] b1, int ind, int timeleft1, Employee e, Exam_Details exd)
 {
     InitializeComponent();
     q = que;
     a = ans;
     b = b1;
     index = ind;
     timeLeft = timeleft1;
     emp = e;
     ed = exd;
 }
コード例 #6
0
 //
 //Accepts and assigns Question, Answers, Bookmark array, index, time left, Employee and Exam Details
 //
 public MatchTheColumnTest(Questions[] que, Answers[] ans, Bookmark[] b1, int ind, int timeleft1, Employee e, Exam_Details exd)
 {
     InitializeComponent();
     q = que;
     a = ans;
     index = ind;
     b = b1;
     timeLeft = timeleft1;
     emp = e;
     ed = exd;
 }
コード例 #7
0
 //
 //Initializes the fields of Answers array including answers
 //
 public Answers[] initializeAnswersArray(Answers[] a, Questions[] q, Exam_Details ed, Employee emp)
 {
     for (int i = 0; i < q.Length; i++)
     {
         a[i] = new Answers();
         a[i].exam_ID = ed.exam_ID;
         a[i].employee_Id = emp.employee_Id;
         a[i].question_ID = q[i].question_ID;
         a = this.storeAnswer(a, i, "");
     }
     return a;
 }
コード例 #8
0
        //
        //On changing the Employee ID
        //
        private void employeeIDc_SelectedIndexChanged(object sender, EventArgs e)
        {
            //Resets the other controls on change of Employee ID, also disables then in case of an invalid selection
            lastNameText.Text = firstNameText.Text = addressText.Text = cityText.Text = regionText.Text = postalCodeText.Text = mobileNumberText.Text =  countryLText.Text= "";
            lastNameText.Enabled = false;
            firstNameText.Enabled = false;
            birthdatePicker.Enabled = false;
            hireDatePicker.Enabled = false;
            addressText.Enabled = false;
            cityText.Enabled = false;
            regionText.Enabled = false;
            postalCodeText.Enabled = false;
            mobileNumberText.Enabled = false;
            countryLText.Enabled = false;
            update.Enabled = false;

            if (employeeIDcombo.SelectedIndex != -1)
            {
                //Gets the details of the selected Employee
                Employee et = new Employee();
                string temp = employeeIDcombo.SelectedItem.ToString();
                int pos = temp.IndexOf(":");
                et.employee_Id = temp.Substring(0, pos);
                et = ed.getEmployee(et);

                //Enables the other controls
                lastNameText.Enabled = true;
                firstNameText.Enabled = true;
                birthdatePicker.Enabled = true;
                hireDatePicker.Enabled = true;
                addressText.Enabled = true;
                cityText.Enabled = true;
                regionText.Enabled = true;
                postalCodeText.Enabled = true;
                mobileNumberText.Enabled = true;
                countryLText.Enabled = true;
                update.Enabled = true;

                //Loads the Employee Details
                lastNameText.Text = et.last_Name;
                firstNameText.Text = et.first_Name;
                birthdatePicker.Value = et.birthdate;
                hireDatePicker.Value = et.hire_Date;
                addressText.Text = et.address;
                cityText.Text = et.city;
                regionText.Text = et.region;
                postalCodeText.Text = et.postalCode + "";
                countryLText.Text = et.country;
                mobileNumberText.Text = et.mobile_Number;
            }
            else
                MessageBox.Show("Please select a valid Employee ID.");
        }
コード例 #9
0
        //
        //Calculates marks for each question and the total, stores them in Answers array, DAL call to store the answers in the Answers table, and final results in the Result table
        //
        public bool submit(Answers[] a, Questions[] q, Employee emp, Exam_Details ed)
        {
            //Calculates marks for each question (stores them in Answers array), total and percentage
            int score = 0;
            int outOf = 0;
            float per = 0;
            for (int i = 0; i < q.Length; i++)
            {
                if (a[i].answer.Equals(q[i].solution))
                    a[i].marks = q[i].marks;
                else
                    a[i].marks = 0;
                score += a[i].marks;
                outOf += q[i].marks;
            }
            per = (score *100) / outOf;

            //DAL call to store the answers in the Answers table
            bool feed = d.submitAnswers(a);

            //DAL call to store final result in the Result table
            if (feed)
            {
                Results re = new Results();
                re.employee_ID = emp.employee_Id;
                re.exam_ID = ed.exam_ID;
                re.score = score;
                re.percentage = per;
                ResultsDAL rb = new ResultsDAL();
                bool feed1 = rb.addScore(re);
                if (feed1)
                {
                    ResultStatusDAL rsd = new ResultStatusDAL();
                    ResultStatus rs = new ResultStatus();
                    rs.employee_ID = emp.employee_Id;
                    rs.exam_Type = ed.exam_Type;
                    if (re.percentage >= 50.0)
                        rs.status = "Passed";
                    else
                        rs.status = "Failed";
                    bool feed2 = rsd.updateStatus(rs);
                    if (feed2)
                        return true;
                    else
                        return false;
                }
                else
                    return false;
            }
            else
                return false;
        }
コード例 #10
0
        private void Set_Click(object sender, EventArgs e)
        {
            int count = listBox.SelectedIndices.Count;

            ListBox.SelectedIndexCollection l = listBox.SelectedIndices;
            Employee [] r = new Employee[count];
            for (int i = 0; i < count; i++)
            {
                r[i] = new Employee();
                r[i].employee_Id = earray[l[i]].employee_Id;
            }
            string feedback = eb.setAdmin(r);
            MessageBox.Show(feedback, "Set Admin", MessageBoxButtons.OK);
        }
コード例 #11
0
 //
 //On click of Add button, validates, adds Employee & displays assigned Employee ID
 //
 protected void register_Click(object sender, EventArgs e)
 {
     Employee emp = new Employee();
     emp.first_Name = firstNameText.Text.ToString();
     emp.last_Name = lastNameText.Text.ToString();
     emp.birthdate = DateTime.Parse(Request.Form[birthdatePicker.UniqueID]);
     emp.hire_Date = DateTime.Parse(Request.Form[hireDatePicker.UniqueID]);
     emp.address = addressText.Text.ToString();
     emp.city = cityText.Text.ToString();
     emp.region = regionText.Text;
     string temp = emp.birthdate + "";
     emp.password = temp.Substring(0, 10);
     if (postalCodeText.Text.Length == 0)
         emp.postalCode = 9999999;
     else
         emp.postalCode = Convert.ToInt32(postalCodeText.Text);
     emp.country = countryText.Text.ToString();
     emp.mobile_Number = mobileText.Text.ToString();
     emp.password = passwordText.Text.ToString();
     string confirm = confirmPasswordText.Text.ToString();
     emp.type = 2;
     EmployeeBS cs = new EmployeeBS();
     string feedback = cs.addEmployee(emp, confirm);
     if (feedback.Contains("successfully"))
     {
         /*DialogResult result = MessageBox.Show(feedback + "   Click Ok to go to Home Page. Click Cancel to Logout", "Add Employee", MessageBoxButtons.OKCancel);
         //if (result == DialogResult.OK)
         //{
             //    EmpHome f = new EmpHome(emp);
             //    this.Close();
             //    f.Show();
             //ParentForm f = new ParentForm(emp);
             //this.Close();
             //f.Show();
         //}
         else if (result == DialogResult.Cancel)
         {
             Application.Exit();
         }*/
         Response.Redirect("~/EmpHome.aspx");
     }
     else
         myMessageFromCodeBehind = feedback;
         //ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "showMessage({0});",    true);
                //ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", feedback);
         //ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert(feedback);", true);
         //System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Some error! Please Check again!')</SCRIPT>");
         //MessageBox.Show(feedback, "Error", MessageBoxButtons.OK);
 }
コード例 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            emp = (Employee)Session["employee"];
            ed = (Exam_Details)Session["exam"];

            employeeNameLabel.Text = emp.first_Name + " " + emp.last_Name;
            examIDLabel.Text = "Exam ID:" + ed.exam_ID;

            for (int i = 0; i <= 5; i++)
            {
                comboBox1.Items.Add(i+"");
                comboBox2.Items.Add(i+"");
                comboBox3.Items.Add(i+"");
                comboBox4.Items.Add(i+"");
                comboBox5.Items.Add(i+"");
                comboBox1.SelectedIndex = comboBox2.SelectedIndex = comboBox3.SelectedIndex = comboBox4.SelectedIndex = comboBox5.SelectedIndex = 0;
            }
        }
コード例 #13
0
        protected void login_Click(object sender, EventArgs e)
        {
            Employee l = new Employee();
            l.employee_Id = UserName.Text.ToString();
            l.password = Password.Text.ToString();

            if (adminRadioButton.Checked)
            {
                l.type = 1;
                string feed = b.validateLogin(l);
                if (feed.Equals("true"))
                {
                    Session["admin"] = l;
                    //AdminHome f = new AdminHome(l);
                    //this.MdiParent.Hide();
                    //this.Close();
                    //f.Show();
                    Response.Redirect("~/AdminHome.aspx");
                }
                else
                {
                    System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('login error')</SCRIPT>");
                }
            }
            else if (employeeRadioButton.Checked)
            {
                l.type = 2;
                string feed = b.validateLogin(l);
                if (feed.Equals("true"))
                {
                    Session["employee"] = l;
                    /*ParentForm f2 = new ParentForm(l);
                    this.MdiParent.Hide();
                    this.Close();
                    f2.Show();*/
                    Response.Redirect("~/EmpHome.aspx");
                }
                else
                {
                    System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('login error')</SCRIPT>");
                }
            }
        }
コード例 #14
0
 //
 //Deletes an Employee with given Employee ID, and returns a success or error message
 //
 public string deleteEmployee(Employee e)
 {
     try
     {
         conn.Open();
         cmd = new SqlCommand( "Delete Employee where Employee_ID='"+e.employee_Id+"'", conn);
         int i =cmd.ExecuteNonQuery();
         conn.Close();
         if(i==1)
             return "Employee " + e.employee_Id + " is successfully deleted";
         else
             return "Attempt unsuccessful. Sorry for the inconvenience.";
     }
     catch (Exception ex)
     {
         conn.Close();
         return "Attempt unsuccessful. Sorry for the inconvenience.";
     }
 }
コード例 #15
0
 //
 //Changes password of Employee
 //
 public string changePassword(Employee e, String newp)
 {
     try
     {
         cmd = new SqlCommand("Update Employee SET Password = '******' WHERE Employee_ID= '" + e.employee_Id + "'", conn);
         conn.Open();
         int i =cmd.ExecuteNonQuery();
         conn.Close();
         if (i == 1)
             return "Password Successfully Changed";
         else
             return "Sorry, Some Problem Occured During The Process. Please Try Later";
     }
     catch (Exception ex)
     {
         conn.Close();
         return "Sorry, Some Problem Occured During The Process. Please Try Later";
     }
 }
コード例 #16
0
 //
 //On click of Add button, validates, adds Employee & displays assigned Employee ID
 //
 private void register_Click(object sender, EventArgs e)
 {
     Employee emp = new Employee();
     emp.first_Name = firstNameText.Text.ToString();
     emp.last_Name = lastNameText.Text.ToString();
     emp.birthdate = birthdatePicker.Value;
     emp.hire_Date = hireDatePicker.Value;
     emp.address = addressText.Text.ToString();
     emp.city = cityText.Text.ToString();
     emp.region = regionText.Text;
     string temp = emp.birthdate + "";
     emp.password = temp.Substring(0, 10);
     if (postalCodeText.TextLength == 0)
         emp.postalCode = 9999999;
     else
         emp.postalCode = Convert.ToInt32(postalCodeText.Text);
     emp.country = countryText.Text.ToString();
     emp.mobile_Number = mobileText.Text.ToString();
     emp.password = passwordText.Text.ToString();
     string confirm = confirmPasswordText.Text.ToString();
     emp.type = 2;
     EmployeeBS cs = new EmployeeBS();
     string feedback = cs.addEmployee(emp,confirm);
     if (feedback.Contains("successfully"))
     {
         DialogResult result = MessageBox.Show(feedback + "   Click Ok to go to Home Page. Click Cancel to Logout", "Add Employee", MessageBoxButtons.OKCancel);
         if (result == DialogResult.OK)
         {
         //    EmpHome f = new EmpHome(emp);
         //    this.Close();
         //    f.Show();
             ParentForm f = new ParentForm(emp);
             this.Close();
             f.Show();
         }
         else if (result == DialogResult.Cancel)
         {
             Application.Exit();
         }
     }
     else
         MessageBox.Show(feedback,"Error",MessageBoxButtons.OK);
 }
コード例 #17
0
        //Calculate Detailed Result
        public bool calculateResult(Answers[] a, Questions[] q, Results r, Employee emp)
        {
            bool flag = true;
            int count = q.Length;
            int total = 0;
            string[] abc;
            ResultsDAL d = new ResultsDAL();

            int i = d.getSectionCount(r);
            DetailedReports[] re = new DetailedReports[i];
            abc = new string[i];
            int[] section = new int[i];
            abc = d.loadSection(r, i);

            int[] totalQuestions = d.totalSectionQuestions(abc, r);

            for (int j = 0; j < count; j++)
            {

                //total = total + q[j].marks;
                if (a[j].answer.Equals(q[j].solution))
                {
                    string click = q[j].section;
                    for (int k = 0; k < i; k++)
                    {
                        if (click == abc[k])
                            section[k]++;
                    }
                }
            }

            for (int k = 0; k < i; k++)
            {
                re[k] = new DetailedReports();
                re[k].employee_ID = emp.employee_Id;
                re[k].exam_ID = r.exam_ID;
                re[k].section = abc[k];
                re[k].percentage = (section[k] * 100) / totalQuestions[k];
                flag = d.addDetailedResult(re[k]);
            }
            return flag;
        }
コード例 #18
0
 //
 //Adds Employee and returns assigned Employee ID (or Error Message)
 //
 public string addEmployee(Employee e)
 {
     //try
     //{
         e.employee_Id = this.getNext();
         conn.Open();
         cmd = new SqlCommand("Insert into Employee(Employee_ID,Last_Name,First_Name,Birthdate,Hire_Date,Address,City,Region,PostalCode,Country,Mobile_Number,Password,Type) values('" + e.employee_Id + "','" + e.last_Name + "','" + e.first_Name + "','" + e.birthdate + "','" + e.hire_Date + "' ,'" + e.address + "','" + e.city + "','" + e.region + "'," + e.postalCode + ",'" + e.country + "','" + e.mobile_Number + "','" + e.password +"',"+e.type+")", conn);
         int i=cmd.ExecuteNonQuery();
         conn.Close();
         if(i==1)
             return e.first_Name +" "+e.last_Name+" you have successfully registered yourself & have been assigned ID " + e.employee_Id + ".";
         else
             return "Some error occured. Sorry for the inconvenience.";
     //}
     //catch (Exception ex)
     //{
     //    conn.Close();
     //    return "Some error occured. Sorry for the inconvenience.";
     //}
 }
コード例 #19
0
        //
        //Deletes the selected Exam & pops up a Success or Error message
        //
        protected void delete_Click(object sender, EventArgs e)
        {
            if (employeeIDCombo.SelectedIndex != -1)
            {
                //DialogResult result = MessageBox.Show("Are you sure you want delete " + employeeIDCombo.SelectedItem.ToString() + "?", "Delete Employee", MessageBoxButtons.YesNo);
                //if (result == DialogResult.Yes)

                    Employee r = new Employee();
                    string temp = employeeIDCombo.SelectedItem.ToString();
                    int pos = temp.IndexOf(":");
                    r.employee_Id = temp.Substring(0, pos - 1);
                    string feed = ed.deleteEmployee(r);
                    System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Succesfully deleted.')</SCRIPT>");
                    //MessageBox.Show(feed);
            }
            else
                System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Please select a valid Employee ID.')</SCRIPT>");
                //MessageBox.Show("Please select a valid Employee ID.");

            this.Page_Load(sender, e);
        }
コード例 #20
0
        //
        //Ong click on Login: Validates Employee ID, password,type and navigates to appropriate Home page
        //
        private void login_Click(object sender, EventArgs e)
        {
            Employee l = new Employee();
            l.employee_Id = userNameText.Text.ToString();
            l.password = passwordText.Text.ToString();

            if (adminRadioButton.Checked)
            {
                l.type = 1;
                string feed = b.validateLogin(l);
                if (feed.Equals("true"))
                {
                    AdminHome f = new AdminHome(l);
                    this.MdiParent.Hide();
                    this.Close();
                    f.Show();
                }
                else
                {
                    MessageBox.Show(feed,"Login Error");
                }
            }
            else if (employeeRadioButton.Checked)
            {
                l.type = 2;
                string feed = b.validateLogin(l);
                if (feed.Equals("true"))
                {
                    ParentForm f2 = new ParentForm(l);
                    this.MdiParent.Hide();
                    this.Close();
                    f2.Show();
                }
                else
                {
                    MessageBox.Show(feed, "Login Error");
                }
            }
        }
コード例 #21
0
        protected void Set_Click(object sender, EventArgs e)
        {
            int count = 0, i = 0;
            //int count = listBox.SelectedIndices.Count;
            //Employee[] r;
            //listBox.Items.CopyTo(r,0);
            foreach (ListItem l in listBox.Items)
            {
                if (l.Selected)
                    count++;
            }
            Employee[] r = new Employee[count];
            String h = count + "";

            //l1.Text = h;
            //System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert(h)</SCRIPT>");
            //int c = count.Count();

            /*for (int i = 0; i( < count.Count(); i++)
            {
                r[i] = new Employee();
                r[i].employee_Id = earray[listBox.Items.[i]].employee_Id;
            }*/
            foreach (ListItem li in listBox.Items)
            {
                if (li.Selected)
                {
                    r[i] = new Employee();
                    r[i].employee_Id = li.Value;
                    i++;
                }
            }
            string feedback = eb.setAdmin(r);
            System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Successfully')</SCRIPT>");
            //MessageBox.Show(feedback, "Set Admin", MessageBoxButtons.OK);
        }
コード例 #22
0
 //
 //DAl call to delete an Employee with the given Employee ID
 //
 public string deleteEmployee(Employee e)
 {
     string abc = em.deleteEmployee(e);
     return abc;
 }
コード例 #23
0
 //
 //Validates current password, verifies new password and updates it
 //
 public string validatePassword(String oldpassword, String newpassword, String verifypassword, Employee e)
 {
     String old = em.getPassword(e);
     if (old != oldpassword)
     {
         return "Please enter the correct current password.";
     }
     else if (newpassword != verifypassword)
     {
         return "New Password does not match Verify Password.";
     }
     else
     {
         string feed = em.changePassword(e, newpassword);
         return feed;
     }
 }
コード例 #24
0
        //
        //Validates fields before adding Employee
        //
        public string addEmployee(Employee e,string confirmPassword)
        {
            string feedback="";
            bool feed = false;
            int i = 0;

            if (e.last_Name.Length == 0)
            {
                feedback += (++i)+". Last Name  ";
                feed = true;
            }
            if (e.first_Name.Length == 0)
            {
                feedback += (++i)+". First Name  ";
                feed = true;
            }
            if ((DateTime.Today.Year - e.birthdate.Year) < 18)
            {
                feedback += (++i)+". Birth Date ";
                feed = true;
            }
            if (e.address.Length == 0)
            {
                feedback += (++i) + ". Address ";
                feed = true;
            }
            if (e.city.Length == 0)
            {
                feedback += (++i) + ". City ";
                feed = true;
            }
            if (e.region.Length==0)
            {
                feedback += (++i) + ". State ";
                feed = true;
            }
            if ((e.postalCode.ToString().Length==0 ) ||  e.postalCode.ToString().Length != 6 )
            {
                feedback += (++i) + ". Postal Code ";
                feed = true;
            }
            if (e.country.Length == 0)
            {
                feedback += (++i) + ". Country ";
                feed = true;
            }
            if (e.mobile_Number.Length != 10)
            {
                feedback += (++i) + ". Mobile Number  ";
                feed = true;
            }
            if ((!(e.password.Equals(confirmPassword))) ||e.password.Length==0)
            {
                feedback += (++i) + ". Password & Confirm Password ";
                feed = true;
            }
            if (feed)
            {
                //Not valid: Returns erroneous fields
                return ("Please enter valid entries for: " + feedback);
            }
            else
            {
                //Valid: Adds Employee and returns assigned Employee ID or Error Message
                string eid = em.addEmployee(e);
                return eid;
            }
        }
コード例 #25
0
 //
 //Validates login details
 //
 public string validateLogin(Employee l)
 {
     Employee l1 = em.formvalidate(l);
     if (l1.employee_Id == "E00")
         return "Some error occured.Sorry for the inconveneince.";
     if (l1.employee_Id == "E000")
         return "Wrong Employee ID.";
     if(l1.password != l.password)
         return "Wrong Password";
     if (l1.type != 1)
     {
         if (l.type != l1.type)
         {
             return "Wrong entry. Are you a admin?";
         }
         else
             return "true";
     }
     else
         return "true";
 }
コード例 #26
0
        //
        //Validates fields before updating Employee
        //
        public string updateEmployee(Employee e)
        {
            string feedback = "";
            bool feed = false;
            int i = 0;

            if (e.last_Name.Length == 0)
            {
                feedback += (++i) + ". Last Name  ";
                feed = true;
            }
            if (e.first_Name.Length == 0)
            {
                feedback += (++i) + ". First Name  ";
                feed = true;
            }
            if ((DateTime.Today.Year - e.birthdate.Year) < 18)
            {
                feedback += (++i) + ". Birth Date ";
                feed = true;
            }
            if (e.address.Length == 0)
            {
                feedback += (++i) + ". Address ";
                feed = true;
            }
            if (e.city.Length == 0)
            {
                feedback += (++i) + ". City ";
                feed = true;
            }
            if (e.region.Length == 0)
            {
                feedback += (++i) + ". Region ";
                feed = true;
            }
            if ((e.postalCode.ToString().Length == 0) || e.postalCode.ToString().Length != 6)
            {
                feedback += (++i) + ". Postal Code ";
                feed = true;
            }
            if (e.country.Length == 0)
            {
                feedback += (++i) + ". country ";
                feed = true;
            }
            if (e.mobile_Number.Length != 10)
            {
                feedback += (++i) + ". Mobile Number  ";
                feed = true;
            }
            if (feed)
            {
                //Not valid: Returns erroneous fields
                return ("Please enter valid entries for: " + feedback);
            }
            else
            {
                //Valid: Updates Employee and returns Success or Error Message
                string eid = em.updateEmployee(e);
                return eid;
            }
        }
コード例 #27
0
 //
 //DAL call to set new Admins
 //
 public string setAdmin(Employee [] e)
 {
     string feedback = em.setAdmin(e);
     return feedback;
 }
コード例 #28
0
 //
 //DAL call to get all the Employees who do not have admin access in an array
 //
 public Employee[] loadNonAdmins(int i)
 {
     Employee[] abc = new Employee[i];
     abc = em.loadNonAdmins(i);
     return abc;
 }
コード例 #29
0
 //
 //DAL call to get other fields of a Exam given the Employee ID
 //        
 public Employee getEmployee(Employee et)
 {
     et = em.getEmployee(et);
     return et;
 }
コード例 #30
0
 public LogoutForm(Employee e, Exam_Details exd)
 {
     InitializeComponent();
     emp = e;
     ed = exd;
 }