public void CanAdd2Numbers() { BalClass sut = new BalClass(); int res = sut.AddTwoNumbers(6, 7); Assert.That(res, Is.EqualTo(13)); }
protected void BtnPasschangeSubmit_Click(object sender, EventArgs e) { BeChange a = new BeChange(); BalClass b = new BalClass(); a.NewPassword = NewPassChange.Text; a.OldPassword = OldPassChange.Text; int error = b.CheckOldPass(a); if (error == -1) { string script = "alert('Incorrect OLD Password !!');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", script, true); } else { if (b.StartChangePass(a) == 1) { Response.Redirect("../Pages/LogOut2.aspx"); } else { } } }
public DataTable tblCountry() { BeAddUser obj1 = new BeAddUser(); BalClass obj = new BalClass(); DataTable dt = obj.UpdateCountry(); return(dt); }
public DataTable tblcity(string state) { BeAddUser obj1 = new BeAddUser(); BalClass obj = new BalClass(); obj1.State = state; DataTable dt = obj.UpdateCity(obj1); return(dt); }
public DataTable tblstate(string count) { BeAddUser obj1 = new BeAddUser(); BalClass obj = new BalClass(); obj1.Country = count; DataTable dt = obj.UpdateState(obj1); return(dt); }
private void RegisterUser(User user) { if (user != null) { _isSuccess = BalClass.RegisterUser(user); if (_isSuccess != 1) { Submit.PostBackUrl = "~/Register.aspx"; } Submit.PostBackUrl = "~/Default.aspx"; } }
private void IsRegisteredUser(User user) { if (user != null) { _isLoggedIn = BalClass.IsRegisteredUser(user); if (_isLoggedIn != 1) { Signin.PostBackUrl = "~/Account/Register.aspx"; } Signin.PostBackUrl = "~/Account/Manage.aspx"; } }
protected void Button2_Click(object sender, EventArgs e) { BeLogin a = new BeLogin(); // Business Entity object to store login info a.LoginName = TxtLoginName.Text; a.LoginPassword = TxtLoginPass.Text; BalClass b = new BalClass(); // BAL object int error = b.CheckLogin(a); if (error == 1) { Response.Redirect("~/Pages/Home.aspx"); } else if (error == 2) { string script = "alert('Invalid User !!');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", script, true); } else if (error == 3) { string script = "alert('Wrong Password !!');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", script, true); } else if (error == -1) { string script = "alert('Wrong Credentials !!');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", script, true); } else { string script = "alert('Fields Cannot be Empty !!');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", script, true); } }
private void DeleteEntry(Record record) { BalClass.DeleteEntry(record); }
private void UpdateEntry(Record record) { BalClass.UpdateEntry(record); }
protected void BtnAddSubmit_Click(object sender, EventArgs e) { BeAddUser a = new BeAddUser(); BalClass b = new BalClass(); char gender; if (RdoAddMale.Checked) { gender = 'M'; } else if (RdoAddFemale.Checked) { gender = 'F'; } else { gender = 'O'; } if (gender != 'O') { Random rnd = new Random(); int num = rnd.Next(1000, 9999); DateTime dt = DateTime.Now; string[] date = dt.ToString("MM/dd/yyyy").Split(' '); a.uid = Convert.ToInt64(date[0].Substring(6, 4) + date[0].Substring(0, 2) + num.ToString()); a.Name = TxtAddName.Text.Trim(); a.Address = TxtAddAddress.Text.Trim(); a.Country = LstAddCountry.SelectedItem.ToString(); a.State = LstAddState.SelectedItem.ToString(); a.City = LstAddCity.SelectedItem.ToString(); a.PinCode = Convert.ToInt64(TxtAddPin.Text.Trim()); a.Email = TxtAddEmail.Text.Trim(); a.Contact = Convert.ToInt64(TxtAddContact.Text.Trim()); a.Dob = Convert.ToDateTime(TxtAddDob.Text.Trim()); a.Gender = gender; int error = b.AddUser(a); //passing BE to BAL layer if (error == 1) { string script = "alert('User Added Successfully !!');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", script, true); Session["a_uid"] = a.uid; Response.Redirect("Success.aspx"); } else { string script = "alert('User could not be added !! Check Database Connection !!');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", script, true); } } else { string script = "alert('Gender needs to be filled !!');"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", script, true); } }
private void AddEntry(Record record) { BalClass.AddEntry(record); }
protected void Page_Load(object sender, EventArgs e) { BalClass objBal = new BalClass(); objBal.AddTwoNumbers(2, 4); }