protected void submit_Click(object sender, EventArgs e) { try { string companyname = ""; companyname = CompanyTextBox.Text; int countryid = Convert.ToInt32(countryDropDownList.SelectedValue); string rolename = "Administrator"; UserBL userBL = new UserBL(); ACLRoleBL aclroleBL = new ACLRoleBL(); bool existcompany = false; bool emailaddress = false; existcompany = userBL.IsCompanyExists(companyname); emailaddress = userBL.IsEmailExists(PrimaryEmailTextBox.Text); if ( existcompany == false && emailaddress == false && companyname != "" && FirstNameTextBox.Text != "" && LastNameTextBox.Text != "" && TitleTextBox.Text != "" && StreetTextBox.Text != "" && CityTextBox.Text != "" && PostalCodeTextBox.Text != "" && MobilePhoneTextBox.Text != "" && PrimaryEmailTextBox.Text != "" ) { Int32 companyID = userBL.GetCompanyID(companyname, countryid); Int32 roleID = userBL.GetRoleID(rolename, companyID); string password = userBL.GenerateRandomPassword(); string m = aclroleBL.InsertCompanyModules(companyID); aclroleBL.InsertACLAction(roleID, companyID); object[] objp; int i = 0; objp = new object[12]; objp.SetValue(FirstNameTextBox.Text, i++); objp.SetValue(LastNameTextBox.Text, i++); objp.SetValue(TitleTextBox.Text, i++); objp.SetValue(StreetTextBox.Text, i++); objp.SetValue(CityTextBox.Text, i++); //objp.SetValue(StateTextBox.Text, i++); objp.SetValue(PostalCodeTextBox.Text, i++); objp.SetValue(countryDropDownList.SelectedValue, i++); objp.SetValue(MobilePhoneTextBox.Text, i++); objp.SetValue(PrimaryEmailTextBox.Text, i++); objp.SetValue(companyID, i++); objp.SetValue(roleID, i++); objp.SetValue(password, i++); long id = userBL.RegisterUser(objp); /// Code done by Pavel to Activate Registered User /// Start string emailID = PrimaryEmailTextBox.Text; // String mailbody = null; Guid? activationID = userBL.GetActivationID(emailID); ListDictionary templateValues = new ListDictionary(); templateValues.Add("<%=PrimaryEmail%>", emailID); templateValues.Add("<%=ActivationID%>", activationID); templateValues.Add("<%=Password%>", password); Session["CompanyID"] = companyID; Session["UserID"] = id; C3App.App_Code.Notification.Notify("User", id, 1, emailID, 1, templateValues); Session.Clear(); Session.Abandon(); Literal1.Text = "Registration Successfull"; Label1.Text = "To activate your account please check your email.<br>"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true); CloseHyperLink.NavigateUrl = "~/UserLogin.aspx"; // ClientScript.RegisterClientScriptBlock(Page.GetType(), "validation", "<script language='javascript'>ShowAlertModal();</script>"); } else { Literal1.Text = "Registration Error"; Label1.Text = "Registration is not completed.Please try again"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "$('#myModal').reveal();", true); CloseHyperLink.NavigateUrl = "~/UserRegister.aspx"; //ClientScript.RegisterClientScriptBlock(Page.GetType(), "validation", "<script language='javascript'>ShowAlertModal();</script>"); } } catch (Exception ex) { throw ex; } }