Esempio n. 1
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            string ad2;

            try
            {
                emp = new EMPLOYEE();

                emp.EmployeeID = userID;
                emp.Type       = rdoType.SelectedValue.ToString();

                emp.Bio = txtBio.InnerText.ToString();

                try
                {
                    viewSpec = handler.viewStylistSpecialisationAndBio(emp.EmployeeID);
                }
                catch (Exception Err)
                {
                    function.logAnError("Could not view stylist specialisation[btnUpdate of updateEmp] error:" +
                                        Err.ToString());
                }

                if (rdoType.SelectedValue == "S")
                {
                    if (viewSpec == null)
                    {
                        stylistService            = new STYLIST_SERVICE();
                        stylistService.EmployeeID = userID;
                        stylistService.ServiceID  = drpSpecs.SelectedValue;
                        handler.addSpecialisation(stylistService);
                    }

                    emp.Specialisation = drpSpecs.SelectedValue;
                }
                else
                {
                    emp.Specialisation = drpSpecs.Text;
                }

                emp.AddressLine1 = txtAddLine1.Text;

                if (txtAddLine2.Text == null)
                {
                    ad2 = "";
                }
                else
                {
                    ad2 = txtAddLine2.Text;
                }
                emp.AddressLine2 = ad2;
                emp.Suburb       = txtSuburb.Text;
                emp.City         = txtCity.Text;

                if (handler.updateEmployee(emp))
                {
                    Response.Redirect("../Manager/Employee.aspx?EmployeeID=" + emp.EmployeeID.ToString().Replace(" ", string.Empty), false);
                }
                else
                {
                    phUpdateErr.Visible = true;
                    lblUpdateErr.Text   = "Unable to update the employees details.<br/>" +
                                          "<br/>Please report to management or the administrator.";
                }
            }
            catch (Exception Err)
            {
                phUpdateErr.Visible = true;
                lblUpdateErr.Text   = "An error has occured.We are unable to update the employees details at this point in time.<br/>"
                                      + "Please report to management or the administrator.";
                function.logAnError("btnUpdateEmployee err:" + Err.ToString());
            }
        }