protected void RegisterButton_Click(object sender, EventArgs e) { UserDetails NewUser = new UserDetails(); UserRegistrationClient ClientCompany = new UserRegistrationClient(); Company[] Companynames = ClientCompany.RetriveCompanyNames(); string companyName = CompanyID.Text; int i = 0; for (i = 0; i < Companynames.Length; i++) { int res = string.Compare(Companynames[i].Name, companyName, true); if (res == 0) { NewUser.CompanyId = Companynames[i].CompanyID; break; } } if (i == Companynames.Length) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "err_msg", "alert('Enter correct company name or Register your Company.');", true); return; } NewUser.FirstName = FirstName.Text; NewUser.LastName = LastName.Text; NewUser.UserEmail = Email.Text; NewUser.EncryptedPassword = Password.Text; NewUser.IsOwner = false; UserRegistrationClient client = new UserRegistrationClient(); bool success = client.UserRegistration(NewUser); if (success) ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "err_msg", "alert('You are registered');window.location='Login.aspx'", true); else ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "err_msg", "alert('error');", true); return; }
protected void Page_Load(object sender, EventArgs e) { UserRegistrationClient ClientCompany = new UserRegistrationClient(); Company[] Companynames = ClientCompany.RetriveCompanyNames(); for (int i = 0; i < Companynames.Length; i++) { CompanyID.Items.Add(new ListItem(Companynames[i].Name, Companynames[i].CompanyID.ToString())); } }
protected void RegisterButton_Click(object sender, EventArgs e) { UserDetails NewUser = new UserDetails(); UserRegistrationClient ClientCompany = new UserRegistrationClient(); Company[] Companynames = ClientCompany.RetriveCompanyNames(); string companyName = CompanyID.Text; int i = 0; for (i = 0; i < Companynames.Length; i++) { int res = string.Compare(Companynames[i].Name, companyName, true); if (res == 0) { NewUser.CompanyId = Companynames[i].CompanyID; break; } } if (i == Companynames.Length) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "err_msg", "alert('Enter correct company name or Register your Company.');", true); return; } NewUser.FirstName = FirstName.Text; NewUser.LastName = LastName.Text; NewUser.UserEmail = Email.Text; NewUser.EncryptedPassword = Password.Text; NewUser.IsOwner = false; UserRegistrationClient client = new UserRegistrationClient(); bool success = client.UserRegistration(NewUser); if (success) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "err_msg", "alert('You are registered');window.location='Login.aspx'", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "err_msg", "alert('error');", true); } return; }