Exemplo n.º 1
0
    protected void LoginSubmit_Click(object sender, EventArgs e)
    {
        UserService us1 = new UserService();
        DataSet     ds  = us1.Login(LoginIdTB.Text, LoginPasswordTB.Text);

        if (ds.Tables[0].Rows.Count == 1)
        {
            Label6.Text = "התחברת בהצלחה";
            UserService us = new UserService();
            us.UpdateLastLoginDate(LoginIdTB.Text, DateTime.Now);
            User u = GetAllData.GetAllUserDataById(LoginIdTB.Text);
            Session["user"] = u;
            Response.Redirect("http://localhost:49675/Personal.aspx");
        }
        else
        {
            DoctorService doc1 = new DoctorService();
            DataSet       ds1  = doc1.DoctorLogin(LoginIdTB.Text, LoginPasswordTB.Text);
            if (ds1.Tables[0].Rows.Count == 1)
            {
                Doctor d = GetAllData.GetAllDoctorDataById(LoginIdTB.Text);
                Session["doctor"] = d;
                Response.Redirect("http://localhost:49675/DoctorInfo.aspx");
                Label6.Text = "התחברת בהצלחה";
            }
            else
            {
                ManagerService ms  = new ManagerService();
                DataSet        ds2 = ms.ManagerLogin(LoginIdTB.Text, LoginPasswordTB.Text);
                if (ds2.Tables[0].Rows.Count == 1)
                {
                    Manager m = GetAllData.GetAllManagerDataById(LoginIdTB.Text);
                    Session["manager"] = m;
                    Response.Redirect("http://localhost:49675/ManagerHome.aspx");
                }
                else
                {
                    Label6.Text = "תעודת זהות או סיסמא אינם נכונים";
                }
            }
        }
    }
Exemplo n.º 2
0
    protected void SubmitEdit_Click(object sender, EventArgs e)
    {
        NewSpecValid.Text     = "";
        NewCityValid.Text     = "";
        NewUniValid.Text      = "";
        NewPhoneValid.Text    = "";
        NewLiceValid.Text     = "";
        NewPasswordValid.Text = "";
        int spec = SpecDDL.SelectedIndex, city = DropDownList1.SelectedIndex;

        if (!Validation.IsPasswordValid(NewPassword.Text))
        {
            NewPasswordValid.Text = "סיסמא לא עונה על הדרישות";
        }
        if (!Validation.IsPhoneValid(NewPhone.Text))
        {
            NewPhoneValid.Text = "מספר טלפון לא תקין";
        }
        //temp
        if (DropDownList1.SelectedIndex == 0)
        {
            NewCityValid.Text = "עיר לא תקינה";
        }
        if (SpecDDL.SelectedIndex == 0)
        {
            NewSpecValid.Text = "התמחות לא תקינה";
        }
        if (!Validation.IsHouseNumberValid(NewLice.Text))
        {
            NewLiceValid.Text = "מספר שנים במקצוע לא תקין";
        }
        if (!Validation.IsNameValid(NewUni.Text))
        {
            NewUniValid.Text = "אוניברסיטה לא תקינה";
        }
        if (NewUniValid.Text == "" && NewLiceValid.Text == "" && NewSpecValid.Text == "" && NewCityValid.Text == "" && NewPhoneValid.Text == "" && NewPasswordValid.Text == "")
        {
            //update all the data
            string s = "DoctorCity=" + (DropDownList1.SelectedIndex + 1) + ",DoctorSpecailty=" + (SpecDDL.SelectedIndex + 1) + ",DoctorLicense=" + Convert.ToInt32(NewLice.Text) + ",DoctorUniversity='" + NewUni.Text + "',DoctorPhone='" + NewPhone.Text + "',DoctorPassword='******'";
            s = s + " WHERE DoctorId ='" + ShowId.Text + "'";
            DoctorService docser = new DoctorService();
            docser.UpdateDoctorInfo(s);
            NewLice.Visible       = false;
            NewUni.Visible        = false;
            SpecDDL.Visible       = false;
            NewPhone.Visible      = false;
            NewPassword.Visible   = false;
            DropDownList1.Visible = false;
            NewLiceValid.Text     = "";
            NewCityValid.Text     = "";
            NewUniValid.Text      = "";
            NewPhoneValid.Text    = "";
            NewSpecValid.Text     = "";
            NewPasswordValid.Text = "";
            SubmitEdit.Visible    = false;
            Doctor d = GetAllData.GetAllDoctorDataById(ShowId.Text);
            Session["doctor"] = d;
            NewLice.Text      = "";
            NewUni.Text       = "";
            NewPassword.Text  = "";
            NewPhone.Text     = "";
            Page_Load(sender, e);
            EditInfo.Text = "ערוך";
            System.Threading.Thread.Sleep(1000);
        }
    }