Пример #1
0
    protected void loginButton_Click(object sender, EventArgs e)
    {
        string staffId    = staffIdTextBox.Text;
        string password   = passwordTextBox.Text;
        bool   staffExist = false;

        //call method to check for valid staff
        FMSWCFService.ServiceClient client = new FMSWCFService.ServiceClient();
        staffExist = client.IsValidAccount(staffId, password);
        if (staffExist == true)
        {
            Session.Add("staffId", staffId);
            Session.Add("staffName", (string)client.getStaffName(staffId));
            Response.Redirect("Home.aspx");
        }
        else
        {
            messageLabel.Text = "Invalid Login, please try again.";
        }
    }
Пример #2
0
    protected void updateButton_Click(object sender, EventArgs e)
    {
        string staffId       = (string)Session["StaffId"];
        string password      = passwordTextBox.Text;
        string email         = emailTextBox.Text;
        string phoneNo       = phoneNumberTextBox.Text;
        string title         = titleDropDownList.SelectedValue;
        bool   updateProfile = false;

        FMSWCFService.ServiceClient client = new FMSWCFService.ServiceClient();
        updateProfile = client.editProfile(staffId, password, email, phoneNo, title);

        if (updateProfile == true)
        {
            messageLabel.Text = "Changes updated successfully.";
        }
        else
        {
            messageLabel.Text = "Fail to update changes.";
        }
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string staffId = (string)Session["StaffId"];
            FMSWCFService.ServiceClient getInfo = new FMSWCFService.ServiceClient();
            string   staffInfo = getInfo.staffInfo(staffId);
            string[] info      = staffInfo.Split(',');
            string   staffName = info[0];
            string   password  = info[1];
            string   email     = info[2];
            string   phoneNo   = info[3];
            string   title     = info[4];

            staffLabel.Text                 = staffId;
            staffNameTextBox.Text           = staffName;
            passwordTextBox.Text            = password;
            emailTextBox.Text               = email;
            phoneNumberTextBox.Text         = phoneNo;
            titleDropDownList.SelectedValue = title;
        }
    }