protected void Signin_btn_Click(object sender, EventArgs e) { int ID = int.Parse(Userid_txt.Text); string Pwd = Txt_pwd.Text; LoginUserTableAdapter LU = new LoginUserTableAdapter(); object Check = LU.LoginUser(ID, Pwd); string d = Convert.ToString(Check); string p = "null"; bool sr = Convert.ToBoolean(string.Compare(d, p)); if (sr == true) { ID_hfd.Value = Convert.ToString(Check); Session["User"] = Userid_txt.Text; Session.Timeout = 1; Response.Redirect("Vote.aspx?id=" + ID_hfd.Value); } else { Error_lbl.Text = "UserID or Password Does Not Match"; } /*bool Chk = Convert.ToBoolean(Check); * if (Chk == false) * { * Response.Write("false"); * } * else * { * ID_hfd.Value = Convert.ToString(Check); * Response.Write("success"); * }*/ }
private void Create_Click(object sender, EventArgs e) { count = 0; lnameMsg.Text = ""; unameMsg.Text = ""; cpassMsg.Text = ""; nameMsg.Text = ""; createMsg.Text = ""; passMsg.Text = ""; if (nameTxtBox.Text == "" || nameTxtBox.Text == null) { nameMsg.Text = "Fill the field Name"; count++; } if (lnameTxtBox.Text == "" || lnameTxtBox.Text == null) { lnameMsg.Text = "Fill the field Last Name"; count++; } if (userTxtBox.Text == "" || userTxtBox.Text == null) { unameMsg.Text = "Give a Username for login"; count++; } if (passTxtBox.Text == "" || passTxtBox.Text == null) { passMsg.Text = "First fill this field"; count++; } else if (cpassTxtBox.Text == "" || cpassTxtBox.Text == null || !cpassTxtBox.Text.Equals(passTxtBox.Text)) { cpassMsg.Text = "Please fill correctly the field Confirm Password"; count++; } if (count > 0) { return; } if (LoginUserTableAdapter.checkRegister(userTxtBox.Text).Value == 1) { createMsg.Text = "There is already a user with this Username try again"; unameMsg.Text = "*****"; } else { LoginUserTableAdapter.Insert(nameTxtBox.Text, lnameTxtBox.Text, cpassTxtBox.Text, 0, 0, 0, "", "", 0, 0, userTxtBox.Text, 0); createMsg.Text = "Successful Register... Welcome to Health Companion"; } }
private void button1_Click(object sender, EventArgs e) { errorMsg.Text = ""; if (LoginUserTableAdapter.checkLogin(loginUserTxtBox.Text, loginPassTxtBox.Text).Value == 1) { UserClass.firstTime = true; UserClass.Name = loginUserTxtBox.Text; UserClass.Password = loginPassTxtBox.Text; int n = int.Parse(LoginUserTableAdapter.GetFindUser(UserClass.Name, UserClass.Password).Rows[0][0].ToString()); if (int.Parse(LoginUserTableAdapter.GetCheckForUpdated(UserClass.Name, UserClass.Password).Rows[0]["BMI"].ToString()) != 0) { if (goalsTableAdapter1.getGoalsAndStatus(n, "Incomplete") < 1) { TrainningForm tf = new TrainningForm(); tf.Show(); this.Hide(); } else if (userRoutineTableAdapter1.checkRoutine(n) < 1) { RoutineMenu rm = new RoutineMenu(); rm.Show(); this.Hide(); } else if (userDietPlanTableAdapter1.checkDietPlan(n) < 1) { DietForm df = new DietForm(); df.Show(); this.Hide(); } else { FinalForm ff = new FinalForm(); UserClass.firstTime = false; ff.Show(); this.Hide(); } } else { PersonalData pd = new PersonalData(); pd.Show(); this.Hide(); } } else { errorMsg.Text = "Wrong Username or Password. \nPlease try again!"; } }
public void FillDistrict() { DataTable dt = new DataTable(); LoginUserTableAdapter gt = new LoginUserTableAdapter(); dt = gt.GetDistrictByState(" "); District_ddl.DataSource = dt; District_ddl.DataValueField = "DistrictID"; District_ddl.DataTextField = "DistrictName"; District_ddl.DataBind(); ListItem lit = new ListItem("--select---", "-1"); District_ddl.Items.Insert(0, lit); }
protected void State_ddl_SelectedIndexChanged(object sender, EventArgs e) { DataTable dt = new DataTable(); LoginUserTableAdapter gt = new LoginUserTableAdapter(); string guid = State_ddl.SelectedValue; dt = gt.GetDistrictByState(guid); District_ddl.DataSource = dt; District_ddl.DataValueField = "DistrictID"; District_ddl.DataTextField = "DistrictName"; District_ddl.DataBind(); ListItem lit = new ListItem("--select---", "-1"); District_ddl.Items.Insert(0, lit); Page.MaintainScrollPositionOnPostBack = true; }
protected void Stategrd_ddl_SelectedIndexChanged(object sender, EventArgs e) { GridViewRow gvr = (GridViewRow)((DropDownList)sender).Parent.Parent; //finding which row has fired dropdownlist event DropDownList ddl = (DropDownList)sender; //converting to dropdownlist DropDownList Ddlsecond = gvr.FindControl("Districtgrd_ddl") as DropDownList; DropDownList State = (DropDownList)sender; //converting to dropdownlist DropDownList DdlFirst = gvr.FindControl("Stategrd_ddl") as DropDownList; DataTable dt = new DataTable(); LoginUserTableAdapter gt = new LoginUserTableAdapter(); string guid = DdlFirst.SelectedValue; dt = gt.GetDistrictByState(guid); Ddlsecond.DataSource = dt; Ddlsecond.DataValueField = "DistrictID"; Ddlsecond.DataTextField = "DistrictName"; Ddlsecond.DataBind(); ListItem lit = new ListItem("--select---", "-1"); Ddlsecond.Items.Insert(0, lit); }