Exemple #1
0
        public ICollection GetUserOrganizations(int UserID)
        {
            Hashtable oOrgs = new Hashtable();

            Where.UserID.Value    = UserID;
            Where.UserID.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal;
            Query.Load();

            if (0 == RowCount)
            {
                return(oOrgs);
            }

            do
            {
                if (!oOrgs.ContainsKey(OrganizationID))
                {
                    Organization org = new Organization();
                    org.LoadByPrimaryKey(OrganizationID);
                    oOrgs.Add(OrganizationID, org);
                }
            } while (MoveNext());

            return(oOrgs);
        }
    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();
    }
        public static int GetOrganizationDataBaseID(int organizationID)
        {
            Organization org = new Organization();

            if (org.LoadByPrimaryKey(organizationID))
            {
                return(org.DatabaseID);
            }
            else
            {
                return(0);
            }
        }
    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 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
    }