protected void btnCreate_Click(object sender, System.EventArgs e) { SaveRequest(); CManage.ASPCreateTrialCompany(ReqId); Response.Redirect("TrialRequests.aspx"); }
public TrialResult ActivateTrialCompany2( int requestId , string requestGuid , out string portalUrl , out string login , out string password , out string companyId ) { portalUrl = ""; login = ""; password = ""; companyId = ""; TrialResult ret = TrialResult.InvalidRequest; Guid guid = new Guid(requestGuid); if (DBTrialRequest.CheckGuid(requestId, guid)) { bool isActive = false; using (IDataReader reader = DBTrialRequest.Get(requestId, true, false)) { if (reader.Read()) { isActive = (bool)reader["IsActive"]; if (reader["Company_uid"] != DBNull.Value) { companyId = (string)reader["Company_uid"]; } } } if (isActive) { ret = TrialResult.AlreadyActivated; } else { Guid companyUid = CManage.ASPCreateTrialCompany(requestId); ret = TrialResult.Success; companyId = companyUid.ToString(); AspSettings settings = AspSettings.Load(); TemplateVariables vars = CManage.CompanyGetVariables(companyUid); TemplateVariables varsR = DBTrialRequest.GetVariables(requestId); vars["Login"] = varsR["Login"]; vars["Password"] = varsR["Password"]; vars["TrialUsers"] = settings.MaxUsers.ToString(); vars["TrialDiskSpace"] = settings.MaxHDD.ToString(); vars["TrialPeriod"] = settings.TrialPeriod.ToString(); portalUrl = vars["PortalLink"]; if (!string.IsNullOrEmpty(vars["ContactEmail"])) { CManage.SendEmail(vars["ContactEmail"], EmailType.UserActivated, vars); } if (!string.IsNullOrEmpty(settings.OperatorEmail)) { CManage.SendEmail(settings.OperatorEmail, EmailType.TrialActivated, vars); } login = varsR["Login"]; password = varsR["Password"]; } } return(ret); }