protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (Request.QueryString["action"] != null) { if (Request.QueryString["action"].ToLower().CompareTo("delete") == 0) { int CurrentId = this.OrganizationID; DL_WEB.DAL.Master.Organization oOrganization = new DL_WEB.DAL.Master.Organization(); oOrganization.LoadByPrimaryKey(CurrentId); string CurrentName = oOrganization.Name; oOrganization.IsDeleted = true; oOrganization.Save(); DL_WEB.DAL.Client.ActivityLog.Instance.RegisterActivity(ActivityTypes.OrganizationDeleted, "Organization " + CurrentName + " deleted", ActivityObject.Organization, CurrentId, this.UserGUID, Context.User.Identity.Name); } } } DL_DAL.Master.OrganizationView oOrganizationView = new DL_DAL.Master.OrganizationView(); oOrganizationView.ConnectionString = DL_WEB.DAL.Master.Master.DBConnectionString; oOrganizationView.Where.IsDeleted.Value = false; oOrganizationView.Where.IsDeleted.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; oOrganizationView.Query.Load(); OrganizationList.DataSource = oOrganizationView.DefaultView; OrganizationList.DataBind(); }
protected string GetClientDBConnectionString() { DL_WEB.DAL.Master.Organization oOrganization = new DL_WEB.DAL.Master.Organization(); oOrganization.LoadByPrimaryKey(OrganizationID); DL_WEB.DAL.Master.Database oDatabase = new DL_WEB.DAL.Master.Database(); if (oOrganization.RowCount > 0) { oDatabase.LoadByPrimaryKey(oOrganization.DatabaseID); } DL_WEB.DAL.Master.Server oServer = new DL_WEB.DAL.Master.Server(); if (0 == oDatabase.RowCount) { return(string.Empty); } oServer.LoadByPrimaryKey(oDatabase.ServerID); return(oDatabase.DBConnectionString); }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (Context.User.Identity.IsAuthenticated) { if (null == Session["Organization"]) { if (!(Request.FilePath.Contains("ActiveOrganization.aspx") || Request.FilePath.Contains("Logoff.aspx"))) { Response.Redirect("./ActiveOrganization.aspx?redirecturl=" + HttpUtility.UrlEncode(Request.FilePath)); } else { MyGeneration.dOOdads.BusinessEntity.ClearConnectionString(); } } else { DL_WEB.DAL.Master.Organization org = Session["Organization"] as DL_WEB.DAL.Master.Organization; ProfileTopLink.Visible = ProfileBottomLink.Visible = true; lblOrganizationName.Text = ": " + org.Name; if (Session["RoleActions"] == null) { DL_WEB.DAL.Master.UserRole oUserRole = new DL_WEB.DAL.Master.UserRole(); oUserRole.Where.UserID.Operator = WhereParameter.Operand.Equal; oUserRole.Where.UserID.Value = DL_WEB.DAL.Master.User.GetUserID(Context.User.Identity.Name); oUserRole.Where.OrganizationID.Operator = WhereParameter.Operand.Equal; oUserRole.Where.OrganizationID.Value = org.OrganizationID; oUserRole.Query.Load(); DL_WEB.DAL.Master.RoleAction oRoleAction = new DL_WEB.DAL.Master.RoleAction(); DataTable dtRoleActions = oRoleAction.LoadRoleActionsByRoleID(oUserRole.RoleID); Session.Add("RoleActions", dtRoleActions); } } } }
protected void btnSubmit_Click(object sender, EventArgs e) { BusinessEntity.PushStaticConnectionString(); BusinessEntity.StaticConnectionString = ConfigurationSettings.AppSettings["dbConnection"]; DL_WEB.DAL.Master.Organization oOrganization = new DL_WEB.DAL.Master.Organization(); oOrganization.LoadByPrimaryKey(OrganizationID); DL_WEB.DAL.Master.Database oDatabase = new DL_WEB.DAL.Master.Database(); if (oOrganization.RowCount > 0) { oDatabase.LoadByPrimaryKey(oOrganization.DatabaseID); } DL_WEB.DAL.Master.Server oServer = new DL_WEB.DAL.Master.Server(); if (oDatabase.RowCount > 0) { oServer.LoadByPrimaryKey(oDatabase.ServerID); MyGeneration.dOOdads.BusinessEntity.StaticConnectionString = oDatabase.DBConnectionString; } AddressBook oAddressBook = new AddressBook(); oAddressBook.AddNew(); oAddressBook.FirstName = tbFirstName.Text; oAddressBook.LastName = tbLastName.Text; oAddressBook.Company = tbCompany.Text; oAddressBook.PrimaryEmail = tbEmail.Text; oAddressBook.ProjectID = this.ProjectID; oAddressBook.IsApproved = false; oAddressBook.GUID = Guid.NewGuid(); oAddressBook.Save(); ProjectNotification oProjectNotification = new ProjectNotification(); oProjectNotification.AddNew(); oProjectNotification.AddressBookEntryID = oAddressBook.EntryID; oProjectNotification.ProjectID = this.ProjectID; oProjectNotification.ImpactLevelID = Micajah.Common.Helper.Convert.o2i(this.ImpactLevelList.SelectedValue); oProjectNotification.NotificationTypeID = 1; oProjectNotification.Save(); BusinessEntity.PopStaticConnectionString(); #region Sending confirmation request to this contact SmtpClient client = new SmtpClient(oServer.MailHost); client.Credentials = new NetworkCredential(oServer.MailUser, oServer.MailPass); MailAddress from = new MailAddress(oServer.MailEmail, "Deployment Logger"); MailAddress to = new MailAddress(tbEmail.Text, tbFirstName.Text + " " + tbLastName.Text); MailMessage message = new MailMessage(from, to); message.Subject = "Welcome to Deployment Logger"; message.Body = String.Format("Dear, {3},\n\nThank you for registering with Deployment Logger.\n" + "To activate your account and verify your e-mail address, please click on the following link:\n" + "{0}anonymous/SubscribeConfirmation.aspx?addressbookid={1}&databaseid={2}&guid={4}\n\n" + "If you have received this mail in error, you do not need to take any action to cancel the account. " + "The account will not be activated, and you will not receive any further emails.\n\n" + "If clicking the link above does not work, copy and paste the URL in a new browser window instead.\n\n" + "Thank you for using Micajah Deployment Logger!" + "---" + "This is a post-only mailing. Replies to this message are not monitored or answered.", oServer.WebReference, oAddressBook.EntryID, oDatabase.DatabaseID, tbFirstName.Text + " " + tbLastName.Text, HttpUtility.UrlEncode(oAddressBook.GUID.ToString())); client.Send(message); message.Dispose(); #endregion }