Exemple #1
0
    protected void btnYes_Click(object sender, EventArgs e)
    {
        if (Session["adminID"] != null)
        {
            lblDescription.Visible = false;
            tableProfile.Visible   = false;
            tableFinished.Visible  = true;

            //dsCompanyTableAdapters.legacyusersTableAdapter legacyusersTA = new dsCompanyTableAdapters.legacyusersTableAdapter();
            dsUserTableAdapters.licenseeTableAdapter licenseeTA = new dsUserTableAdapters.licenseeTableAdapter();

            //dsCompany.legacyusersDataTable legacyusersDT = new dsCompany.legacyusersDataTable();
            dsUser.licenseeDataTable licenseeDT = new dsUser.licenseeDataTable();

            //legacyusersDT = legacyusersTA.GetCompanyByID(Convert.ToInt32(Request.QueryString["id"].ToString()));
            licenseeDT = licenseeTA.GetUserByID(Convert.ToInt32(Request.QueryString["id"].ToString()));

            AdminActionLogDAL.LogAdminAction(Convert.ToInt32(Session["adminID"].ToString()), 1, licenseeDT.Rows[0]["email"].ToString(), licenseeDT.Rows[0]["firstname"].ToString(), licenseeDT.Rows[0]["lastname"].ToString());

            //legacyusersDT.Rows[0].Delete();
            licenseeDT.Rows[0].Delete();

            //legacyusersTA.Update(legacyusersDT);
            licenseeTA.Update(licenseeDT);
        }
    }
    protected void btnYes_Click(object sender, EventArgs e)
    {
        dsCompanyTableAdapters.legacyusersTableAdapter legacyusersTA = new dsCompanyTableAdapters.legacyusersTableAdapter();
        dsCompany.legacyusersDataTable legacyusersDT = new dsCompany.legacyusersDataTable();
        legacyusersDT = legacyusersTA.GetCompanyByID(Convert.ToInt32(Request.QueryString["id"].ToString()));
        legacyusersDT.Rows[0].Delete();
        legacyusersTA.Update(legacyusersDT);
        //Changed to delete all users by default 041909
        //if (rblModifyAll.SelectedIndex == 1)//Delete all users belong to this company
        //{
        dsUserTableAdapters.licenseeTableAdapter licenseeTA = new dsUserTableAdapters.licenseeTableAdapter();
        dsUser.licenseeDataTable licenseeDT = new dsUser.licenseeDataTable();
        licenseeDT = licenseeTA.GetUsersByCID(Convert.ToInt32(Request.QueryString["id"].ToString()));

        for (int i = 0; i < licenseeDT.Rows.Count; i++)
        {
            licenseeDT.Rows[i].Delete();
            try
            {
                AdminActionLogDAL.LogAdminAction(Convert.ToInt32(Session["adminID"].ToString()), 1, licenseeDT.Rows[i]["email"].ToString(), licenseeDT.Rows[i]["firstname"].ToString(), licenseeDT.Rows[i]["lastname"].ToString());
            }
            catch (Exception exc)
            {
            }
        }

        licenseeTA.Update(licenseeDT);
        //}

        lblDescription.Visible = false;
        tableProfile.Visible   = false;
        tableFinished.Visible  = true;
    }
    protected void btnContinue2_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            licenseeTA = new dsUserTableAdapters.licenseeTableAdapter();
            //licenseeDT = new dsUser.licenseeDataTable();
            //licenseeDT = licenseeTA.GetAllUsers();
            licenseeTA.ResetBlast();
            if (ddlSitelet.SelectedValue != "0")
            {
                uspSiteletDT = (dsUser.uspLicenseesBySiteletIDDataTable)Session["uspSiteletDT"];
                for (int j = 0; j < uspSiteletDT.Rows.Count; j++)
                {
                    licenseeTA.UpdateBlast(Convert.ToInt32(uspSiteletDT.Rows[j]["id"].ToString()));
                    //licenseeDT.FindByID(Convert.ToInt32(uspSiteletDT.Rows[j]["id"].ToString()))["blast"] = Convert.ToBoolean(1);
                }
                //licenseeTA.Update(licenseeDT);
            }
            else if (ddlRequesters.SelectedValue != "0")
            {
                uspRequesterDT = (dsUser.uspLicenseesByRequesterIDDataTable)Session["uspRequesterDT"];
                for (int j = 0; j < uspRequesterDT.Rows.Count; j++)
                {
                    licenseeTA.UpdateBlast(Convert.ToInt32(uspRequesterDT.Rows[j]["id"].ToString()));
                }
                licenseeTA.Dispose();
                //tableRequestor.Visible = true;
                //UpdatePanel1.UpdateMode
            }
            else if (ddlUserLevel.SelectedValue != "0")
            {
                uspUserLevelDT = (dsUser.uspLicenseesByUserLevelDataTable)Session["uspUserLevelDT"];
                for (int j = 0; j < uspUserLevelDT.Rows.Count; j++)
                {
                    licenseeTA.UpdateBlast(Convert.ToInt32(uspUserLevelDT.Rows[j]["id"].ToString()));
                }
            }
            else if (ddlCategory.SelectedValue != "0")
            {
                uspUserCategoryDT = (dsUser.uspLicenseesByUserCategoryDataTable)Session["uspUserCategoryDT"];
                for (int j = 0; j < uspUserCategoryDT.Rows.Count; j++)
                {
                    licenseeTA.UpdateBlast(Convert.ToInt32(uspUserCategoryDT.Rows[j]["id"].ToString()));
                }
            }

            Response.Redirect("emailblaster2.aspx");

            //lblStep.Text = "Step 3 of 4:";
            //bodyID.Attributes.Add("onload", "");
            //lblDescription.Text = "Provide the email subject and message";
            //tableUserLevel.Visible = false;
            //tableUserCategory.Visible = true;

            //btnContinue3.Attributes.Add("onclick", "return submitForm();");
        }
    }
Exemple #4
0
    public List <user> ChangePrimaryContact(string uID, string cID)
    {
        //TO DO: Use uID to delete the user
        dsUserTableAdapters.licenseeTableAdapter licenseeTA = new dsUserTableAdapters.licenseeTableAdapter();
        licenseeTA.ResetPrimaryContactByCID(Convert.ToInt32(cID));
        licenseeTA.MakeHerPrimaryContactByID(Convert.ToInt32(uID));

        //Get the user list after changing the primary contact
        List <user> users = GetUsersByCID(cID);

        return(users);
    }
    protected void SaveLevelA(bool bLicensee)
    {
        if (Session["licenseeDT"] != null)
        {
            licenseeDT = (dsUser.licenseeDataTable)(Session["licenseeDT"]);
            if (!bLicensee)
            {
                licenseeDT.Rows[0]["RequestorID"] = DBNull.Value;
            }
            licenseeDT.Rows[0]["FromDate"]    = DBNull.Value;
            licenseeDT.Rows[0]["ToDate"]      = DBNull.Value;
            licenseeDT.Rows[0]["AllowedYear"] = DBNull.Value;
            //tablesitlet.Visible = true;

            licenseeTA = new dsUserTableAdapters.licenseeTableAdapter();

            licenseeTA.Update(licenseeDT);

            //Let's update sitelets
            dsUserTableAdapters.licensee2siteletsTableAdapter licensee2siteletsTA = new dsUserTableAdapters.licensee2siteletsTableAdapter();
            //Delete the existing one first!
            licensee2siteletsTA.DeleteByUID(licenseeDT[0].ID);

            //Get all availaible sitelets
            dsCompanyTableAdapters.siteletsTableAdapter siteletsTA = new dsCompanyTableAdapters.siteletsTableAdapter();
            dsCompany.siteletsDataTable siteletsDT = new dsCompany.siteletsDataTable();
            siteletsDT = siteletsTA.GetAllSitelets();



            dsUser.licensee2siteletsDataTable licensee2siteletsDT = new dsUser.licensee2siteletsDataTable();
            licensee2siteletsDT = licensee2siteletsTA.GetAllu2s();

            for (int i = 0; i < siteletsDT.Rows.Count; i++)
            {
                dsUser.licensee2siteletsRow licensee2siteletR = licensee2siteletsDT.Newlicensee2siteletsRow();

                licensee2siteletR.uid = licenseeDT[0].ID;
                licensee2siteletR.sid = Convert.ToInt32(siteletsDT[i].id);
                licensee2siteletsDT.Addlicensee2siteletsRow(licensee2siteletR);
                licensee2siteletsTA.Update(licensee2siteletsDT);
            }



            lblStep.Visible           = false;
            lblDescription.Visible    = false;
            tableRequestor.Visible    = false;
            tableUserCategory.Visible = false;
            tableFinished.Visible     = true;
        }
    }
Exemple #6
0
    public List <user> DeleteUserAndReturnNewList(string uID, string cID)
    {
        //TO DO: Use uID to delete the user
        dsUserTableAdapters.licenseeTableAdapter licenseeTA = new dsUserTableAdapters.licenseeTableAdapter();
        dsUser.licenseeDataTable licenseeDT = new dsUser.licenseeDataTable();
        licenseeDT = licenseeTA.GetUserByID(Convert.ToInt32(uID));
        licenseeDT.Rows[0].Delete();
        licenseeTA.Update(licenseeDT);
        //Get the user list after deleteion
        List <user> users = GetUsersByCID(cID);

        return(users);
    }
    protected void btnContinue5_Click(object sender, EventArgs e)
    {
        if (Session["licenseeDT"] != null)
        {
            if (Page.IsValid)
            {
                licenseeTA = new dsUserTableAdapters.licenseeTableAdapter();
                licenseeDT = (dsUser.licenseeDataTable)(Session["licenseeDT"]);
                licenseeDT.Rows[0]["cid"] = ddlCompany.SelectedValue;
                //Let's update sitelets
                dsUserTableAdapters.licensee2siteletsTableAdapter licensee2siteletsTA = new dsUserTableAdapters.licensee2siteletsTableAdapter();
                //Delete the existing one first!
                licensee2siteletsTA.DeleteByUID(licenseeDT[0].ID);

                dsUser.licensee2siteletsDataTable licensee2siteletsDT = new dsUser.licensee2siteletsDataTable();
                licensee2siteletsDT = licensee2siteletsTA.GetAllu2s();

                foreach (ListItem li in cblSitelet.Items)
                {
                    if (li.Selected)
                    {
                        dsUser.licensee2siteletsRow licensee2siteletR = licensee2siteletsDT.Newlicensee2siteletsRow();

                        licensee2siteletR.uid = licenseeDT[0].ID;
                        licensee2siteletR.sid = Convert.ToInt32(li.Value);
                        licensee2siteletsDT.Addlicensee2siteletsRow(licensee2siteletR);
                        licensee2siteletsTA.Update(licensee2siteletsDT);
                    }
                }


                licenseeTA.Update(licenseeDT);

                lblStep.Visible        = false;
                lblDescription.Visible = false;

                tablesitlet.Visible   = false;
                tableFinished.Visible = true;
            }
        }
        else
        {
            Response.Redirect("./");
        }
    }
    protected void SaveLevelA(bool bLicensee)
    {
        if (Session["legacyusersDT"] != null)
        {
            legacyusersDT = (dsCompany.legacyusersDataTable)(Session["legacyusersDT"]);
            if (!bLicensee)
            {
                legacyusersDT.Rows[0]["RequestorID"] = DBNull.Value;
            }
            //
            legacyusersDT.Rows[0]["FromDate"]    = DBNull.Value;
            legacyusersDT.Rows[0]["ToDate"]      = DBNull.Value;
            legacyusersDT.Rows[0]["AllowedYear"] = DBNull.Value;
            //lblStep.Text = "Step 4 of 4:";
            //lblDescription.Text = "Give permissions to '" + legacyusersDT[0].Company + "' to access the following sitelet(s)";
            tableUserCategory.Visible = false;
            //tablesitlet.Visible = true;

            //START!!!!!!!!!!!
            legacyusersTA = new dsCompanyTableAdapters.legacyusersTableAdapter();
            legacyusersTA.Update(legacyusersDT);


            dsCompanyTableAdapters.legacyusers2siteletsTableAdapter legacyusers2siteletsTA = new dsCompanyTableAdapters.legacyusers2siteletsTableAdapter();
            //Delete the existing one first!
            legacyusers2siteletsTA.DeleteQuery(legacyusersDT[0].ID);

            dsCompany.legacyusers2siteletsDataTable legacyusers2siteletsDT = new dsCompany.legacyusers2siteletsDataTable();
            legacyusers2siteletsDT = legacyusers2siteletsTA.GetAllc2s();


            //Get all availaible sitelets
            dsCompanyTableAdapters.siteletsTableAdapter siteletsTA = new dsCompanyTableAdapters.siteletsTableAdapter();
            dsCompany.siteletsDataTable siteletsDT = new dsCompany.siteletsDataTable();
            siteletsDT = siteletsTA.GetAllSitelets();


            for (int i = 0; i < siteletsDT.Rows.Count; i++)
            {
                dsCompany.legacyusers2siteletsRow legacyusers2siteletsR = legacyusers2siteletsDT.Newlegacyusers2siteletsRow();
                legacyusers2siteletsR.cid = legacyusersDT[0].ID;
                legacyusers2siteletsR.sid = Convert.ToInt32(siteletsDT[i].id);
                legacyusers2siteletsDT.Addlegacyusers2siteletsRow(legacyusers2siteletsR);
                legacyusers2siteletsTA.Update(legacyusers2siteletsDT);
            }



            //Always modify all 041909
            //if ((rblModifyAll2.SelectedIndex == 1) || (rblModifyAll3.SelectedIndex == 1))//Modify all users belong to this company
            //{
            //Response.Redirect("http://google.com");
            dsUserTableAdapters.licenseeTableAdapter licenseeTA = new dsUserTableAdapters.licenseeTableAdapter();
            dsUser.licenseeDataTable licenseeDT = new dsUser.licenseeDataTable();

            dsUserTableAdapters.licensee2siteletsTableAdapter licensee2siteletsTA = new dsUserTableAdapters.licensee2siteletsTableAdapter();
            dsUser.licensee2siteletsDataTable licensee2sitletsDT = new dsUser.licensee2siteletsDataTable();
            licenseeDT = licenseeTA.GetUsersByCID(legacyusersDT[0].ID);
            for (int i = 0; i < licenseeDT.Rows.Count; i++)
            {
                if (legacyusersDT.Rows[0]["RequestorID"] is DBNull)
                {
                    licenseeDT.Rows[i]["RequestorID"] = DBNull.Value;
                }
                else
                {
                    licenseeDT[i].RequestorID = legacyusersDT[0].RequestorID;
                }

                licenseeDT.Rows[i]["FromDate"]    = DBNull.Value;
                licenseeDT.Rows[i]["ToDate"]      = DBNull.Value;
                licenseeDT.Rows[i]["AllowedYear"] = DBNull.Value;

                licenseeDT[i].UserLevel    = legacyusersDT[0].UserLevel;
                licenseeDT[i].UserCategory = legacyusersDT[0].UserCategory;

                //Delete user's sitelets first
                licensee2siteletsTA.DeleteByUID(licenseeDT[i].ID);

                //Retrive the fresh entire sitlets to add new ones
                licensee2sitletsDT = licensee2siteletsTA.GetAllu2s();

                for (int j = 0; j < siteletsDT.Rows.Count; j++)
                {
                    dsUser.licensee2siteletsRow licensee2siteletsR = licensee2sitletsDT.Newlicensee2siteletsRow();
                    licensee2siteletsR.uid = licenseeDT[i].ID;
                    licensee2siteletsR.sid = Convert.ToInt32(siteletsDT[j].id);
                    licensee2sitletsDT.Addlicensee2siteletsRow(licensee2siteletsR);
                    licensee2siteletsTA.Update(licensee2sitletsDT);
                }

                licenseeTA.Update(licenseeDT);
            }
            //}

            lblStep.Visible        = false;
            lblDescription.Visible = false;
            tableRequestor.Visible = false;
            tableFinished.Visible  = true;
        }
        else
        {
            Response.Redirect("./");
        }
    }
    protected void btnContinue5_Click(object sender, EventArgs e)
    {
        if (Session["legacyusersDT"] != null)
        {
            if (Page.IsValid)
            {
                legacyusersTA = new dsCompanyTableAdapters.legacyusersTableAdapter();
                legacyusersDT = (dsCompany.legacyusersDataTable)(Session["legacyusersDT"]);

                //legacyusersDT[0].RegistrationDate = DateTime.Now;

                //Let's update sitelets
                dsCompanyTableAdapters.legacyusers2siteletsTableAdapter legacyusers2siteletsTA = new dsCompanyTableAdapters.legacyusers2siteletsTableAdapter();
                //Delete the existing one first!
                legacyusers2siteletsTA.DeleteQuery(legacyusersDT[0].ID);

                dsCompany.legacyusers2siteletsDataTable legacyusers2siteletsDT = new dsCompany.legacyusers2siteletsDataTable();
                legacyusers2siteletsDT = legacyusers2siteletsTA.GetAllc2s();

                foreach (ListItem li in cblSitelet.Items)
                {
                    if (li.Selected)
                    {
                        dsCompany.legacyusers2siteletsRow legacyusers2siteletsR = legacyusers2siteletsDT.Newlegacyusers2siteletsRow();
                        legacyusers2siteletsR.cid = legacyusersDT[0].ID;
                        legacyusers2siteletsR.sid = Convert.ToInt32(li.Value);
                        legacyusers2siteletsDT.Addlegacyusers2siteletsRow(legacyusers2siteletsR);
                        legacyusers2siteletsTA.Update(legacyusers2siteletsDT);
                    }
                }


                legacyusersTA.Update(legacyusersDT);

                //Default to always modify all users 041909
                //if (rblModifyAll.SelectedIndex == 1)//Modify all users belong to this company
                //{
                //Response.Redirect("http://google.com");
                dsUserTableAdapters.licenseeTableAdapter licenseeTA = new dsUserTableAdapters.licenseeTableAdapter();
                dsUser.licenseeDataTable licenseeDT = new dsUser.licenseeDataTable();

                dsUserTableAdapters.licensee2siteletsTableAdapter licensee2siteletsTA = new dsUserTableAdapters.licensee2siteletsTableAdapter();
                dsUser.licensee2siteletsDataTable licensee2sitletsDT = new dsUser.licensee2siteletsDataTable();
                licenseeDT = licenseeTA.GetUsersByCID(legacyusersDT[0].ID);
                for (int i = 0; i < licenseeDT.Rows.Count; i++)
                {
                    licenseeDT[i].UserLevel = legacyusersDT[0].UserLevel;
                    if (legacyusersDT[0].UserLevel == "D")
                    {
                        licenseeDT[i].FromDate = legacyusersDT[0].FromDate;
                        licenseeDT[i].ToDate   = legacyusersDT[0].ToDate;
                    }
                    else
                    {
                        licenseeDT.Rows[i]["FromDate"] = DBNull.Value;
                        licenseeDT.Rows[i]["ToDate"]   = DBNull.Value;
                    }

                    if (legacyusersDT[0].UserLevel == "C")
                    {
                        licenseeDT[i].AllowedYear = legacyusersDT[0].AllowedYear;
                    }
                    else
                    {
                        licenseeDT.Rows[i]["AllowedYear"] = DBNull.Value;
                    }



                    licenseeDT[i].UserCategory = legacyusersDT[0].UserCategory;
                    licenseeDT[i].RequestorID  = legacyusersDT[0].RequestorID;

                    licensee2siteletsTA.DeleteByUID(licenseeDT[i].ID);
                    licensee2sitletsDT = licensee2siteletsTA.GetAllu2s();

                    foreach (ListItem li in cblSitelet.Items)
                    {
                        if (li.Selected)
                        {
                            dsUser.licensee2siteletsRow licensee2siteletsR = licensee2sitletsDT.Newlicensee2siteletsRow();
                            licensee2siteletsR.uid = licenseeDT[i].ID;
                            licensee2siteletsR.sid = Convert.ToInt32(li.Value);
                            licensee2sitletsDT.Addlicensee2siteletsRow(licensee2siteletsR);
                            licensee2siteletsTA.Update(licensee2sitletsDT);
                        }
                    }

                    licenseeTA.Update(licenseeDT);
                }
                //}

                lblStep.Visible        = false;
                lblDescription.Visible = false;

                tablesitlet.Visible   = false;
                tableFinished.Visible = true;
            }
        }
        else
        {
            Response.Redirect("./");
        }
    }
    protected void btnContinue2_Click(object sender, EventArgs e)
    {
        if (Session["legacyusersDT"] != null)
        {
            if (Page.IsValid)
            {
                legacyusersDT = (dsCompany.legacyusersDataTable)(Session["legacyusersDT"]);

                legacyusersDT[0].UserLevel = rblUserLevel.SelectedValue;

                //Once "No access this time" is selected, finish it 041909
                if (rblUserLevel.SelectedValue == "X")
                {
                    //Block all users 041909
                    dsUserTableAdapters.licenseeTableAdapter licenseeTA = new dsUserTableAdapters.licenseeTableAdapter();
                    dsUser.licenseeDataTable licenseeDT = new dsUser.licenseeDataTable();

                    licenseeDT = licenseeTA.GetUsersByCID(legacyusersDT[0].ID);
                    for (int i = 0; i < licenseeDT.Rows.Count; i++)
                    {
                        licenseeDT[i].UserLevel = legacyusersDT[0].UserLevel;
                        licenseeTA.Update(licenseeDT);
                    }

                    legacyusersTA = new dsCompanyTableAdapters.legacyusersTableAdapter();
                    legacyusersTA.Update(legacyusersDT);

                    //Terminate update
                    tableUserLevel.Visible = false;
                    tableFinished.Visible  = true;
                    lblStep.Visible        = false;
                    lblDescription.Visible = false;
                }
                else
                {
                    if (rblUserLevel.SelectedValue == "D")
                    {
                        legacyusersDT[0].FromDate = Convert.ToDateTime(calendarPopupFrom.SelectedDate.ToString());
                        legacyusersDT[0].ToDate   = Convert.ToDateTime(calendarPopupTo.SelectedDate.ToString());
                    }
                    else if (rblUserLevel.SelectedValue == "C")
                    {
                        legacyusersDT[0].AllowedYear      = Convert.ToDateTime("12/31/" + DateTime.Now.Year);
                        legacyusersDT.Rows[0]["FromDate"] = DBNull.Value;
                        legacyusersDT.Rows[0]["ToDate"]   = DBNull.Value;
                    }
                    else
                    {
                        legacyusersDT.Rows[0]["FromDate"]    = DBNull.Value;
                        legacyusersDT.Rows[0]["ToDate"]      = DBNull.Value;
                        legacyusersDT.Rows[0]["AllowedYear"] = DBNull.Value;
                    }
                    //Populate the user category with the session
                    if (!(legacyusersDT.Rows[0]["UserCategory"] is DBNull))
                    {
                        rblUserCategory.Items.FindByValue(legacyusersDT[0].UserCategory).Selected = true;
                    }

                    //if (legacyusersDT[0].UserLevel == "A")
                    //{
                    //    lblStep.Text = "Step 3 of 4:";
                    //    rblModifyAll2.Visible = false;
                    //    rblModifyAll3.Visible = false;
                    //    bodyID.Attributes.Add("onload", "ShowHideModifyAll2();ChangeStep();");
                    //    rblUserCategory.Attributes.Add("onclick", "ShowHideModifyAll2();ChangeStep()");

                    //}
                    //else
                    //{
                    //rblModifyAll2.Visible = false;
                    //rblModifyAll3.Visible = false;
                    bodyID.Attributes.Add("onload", "");
                    rblUserCategory.Attributes.Add("onclick", "");
                    lblStep.Text = "Step 3 of 5:";
                    //}

                    Session["legacyusersDT"] = legacyusersDT;


                    lblDescription.Text       = "Choose a user category";
                    tableUserLevel.Visible    = false;
                    tableUserCategory.Visible = true;

                    //Let's populate the existing data



                    //Button1.Text = "Ready to SAVE!!!!";
                    //Response.Redirect("http://google.com");
                }
            }
        }
        else
        {
            Response.Redirect("./");
        }
    }
Exemple #11
0
    protected void btnBack2_Click(object sender, EventArgs e)
    {
        lblStep.Text           = "Step 1 of 5:";
        lblDescription.Text    = "Edit the user profile information";
        tableProfile.Visible   = true;
        cvMessage.Enabled      = true;
        tableUserLevel.Visible = false;
        ltrBack.Text           = "<input type=\"button\" name=\"btnBack\" value=\"<<< Go Back\" onclick=\"window.location.replace('./UserMgr.aspx')\"/>";

        if (Session["licenseeDT"] == null)
        {
            licenseeTA            = new dsUserTableAdapters.licenseeTableAdapter();
            licenseeDT            = new dsUser.licenseeDataTable();
            licenseeDT            = licenseeTA.GetUserByID(Convert.ToInt32(Request.QueryString["id"].ToString()));
            Session["licenseeDT"] = licenseeDT;
        }
        else
        {
            licenseeDT = (dsUser.licenseeDataTable)(Session["licenseeDT"]);
        }



        //Populate the existing data
        if (!(licenseeDT.Rows[0]["FirstName"] is DBNull))
        {
            tbFirstName.Text = licenseeDT[0].FirstName;
        }

        if (!(licenseeDT.Rows[0]["MI"] is DBNull))
        {
            tbMI.Text = licenseeDT[0].MI;
        }

        if (!(licenseeDT.Rows[0]["LastName"] is DBNull))
        {
            tbLastName.Text = licenseeDT[0].LastName;
        }


        if (!(licenseeDT.Rows[0]["Email"] is DBNull))
        {
            tbEmail.Text = licenseeDT[0].Email;
        }

        if (!(licenseeDT.Rows[0]["Contract"] is DBNull))
        {
            tbContract.Text = licenseeDT[0].Contract;
        }

        if (!(licenseeDT.Rows[0]["Address1"] is DBNull))
        {
            tbAddress1.Text = licenseeDT[0].Address1;
        }

        if (!(licenseeDT.Rows[0]["Address2"] is DBNull))
        {
            tbAddress2.Text = licenseeDT[0].Address2;
        }

        if (!(licenseeDT.Rows[0]["City"] is DBNull))
        {
            tbCity.Text = licenseeDT[0].City;
        }

        if (!(licenseeDT.Rows[0]["State"] is DBNull))
        {
            bool bProvince = true;
            foreach (ListItem l in ddlState.Items)
            {
                if (licenseeDT[0].State == l.Value)
                {
                    l.Selected = true;
                    bProvince  = false;
                }
            }
            if (bProvince)
            {
                tbProvince.Text = licenseeDT[0].State;
            }
        }



        if (!(licenseeDT.Rows[0]["Zip"] is DBNull))
        {
            tbZip.Text = licenseeDT[0].Zip;
        }

        if (!(licenseeDT.Rows[0]["Phone"] is DBNull))
        {
            tbPhone.Text = licenseeDT[0].Phone;
        }

        if (!(licenseeDT.Rows[0]["Fax"] is DBNull))
        {
            tbFax.Text = licenseeDT[0].Fax;
        }

        if (!(licenseeDT.Rows[0]["Password"] is DBNull))
        {
            tbPassword.Text = licenseeDT[0].Password;
        }
    }
Exemple #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["id"] != null)//Protection required ALL edits!
        {
            rblUserLevel.Attributes.Add("onclick", "CheckUserLevel()");

            if (rblUserLevel.SelectedValue == "D")//When Level D enforce the required field validator to the date range
            {
                bodyID.Attributes.Add("onload", "document.getElementById(\"dateLayer\").style.visibility=\"visible\";");
                rfvFrom.Enabled             = true;
                rfvTo.Enabled               = true;
                cvFrom.Enabled              = true;
                cvTo.Enabled                = true;
                cpvDateRange.Enabled        = true;
                Session["DateWasDisplayed"] = "yes";
            }
            else if (Session["DateWasDisplayed"] != null)//Choose "D" --> Change it to others --> w/o this code the date range fields are displayed
            {
                bodyID.Attributes.Add("onload", "document.getElementById(\"dateLayer\").style.visibility=\"hidden\";");
                rfvFrom.Enabled             = false;
                rfvTo.Enabled               = false;
                cvFrom.Enabled              = false;
                cvTo.Enabled                = false;
                cpvDateRange.Enabled        = false;
                Session["DateWasDisplayed"] = null;
            }

            if (!Page.IsPostBack)
            {
                licenseeTA            = new dsUserTableAdapters.licenseeTableAdapter();
                licenseeDT            = new dsUser.licenseeDataTable();
                licenseeDT            = licenseeTA.GetUserByID(Convert.ToInt32(Request.QueryString["id"].ToString()));
                Session["licenseeDT"] = licenseeDT;



                //Populate the existing data
                if (!(licenseeDT.Rows[0]["FirstName"] is DBNull))
                {
                    tbFirstName.Text = licenseeDT[0].FirstName;
                }

                if (!(licenseeDT.Rows[0]["MI"] is DBNull))
                {
                    tbMI.Text = licenseeDT[0].MI;
                }

                if (!(licenseeDT.Rows[0]["LastName"] is DBNull))
                {
                    tbLastName.Text = licenseeDT[0].LastName;
                }


                if (!(licenseeDT.Rows[0]["Email"] is DBNull))
                {
                    tbEmail.Text = licenseeDT[0].Email;
                }

                if (!(licenseeDT.Rows[0]["cid"] is DBNull))
                {
                    dsCompanyTableAdapters.legacyusersTableAdapter legacyusersTA = new dsCompanyTableAdapters.legacyusersTableAdapter();
                    dsCompany.legacyusersDataTable legacyusersDT = legacyusersTA.GetAllCompanies();
                    ddlCompany.DataSource     = legacyusersDT;
                    ddlCompany.DataTextField  = "Company";
                    ddlCompany.DataValueField = "ID";
                    ddlCompany.SelectedValue  = licenseeDT.Rows[0]["cid"].ToString();
                    ddlCompany.DataBind();
                }

                if (!(licenseeDT.Rows[0]["Contract"] is DBNull))
                {
                    tbContract.Text = licenseeDT[0].Contract;
                }

                if (!(licenseeDT.Rows[0]["Address1"] is DBNull))
                {
                    tbAddress1.Text = licenseeDT[0].Address1;
                }

                if (!(licenseeDT.Rows[0]["Address2"] is DBNull))
                {
                    tbAddress2.Text = licenseeDT[0].Address2;
                }

                if (!(licenseeDT.Rows[0]["City"] is DBNull))
                {
                    tbCity.Text = licenseeDT[0].City;
                }

                if (!(licenseeDT.Rows[0]["State"] is DBNull))
                {
                    bool bProvince = true;
                    foreach (ListItem l in ddlState.Items)
                    {
                        if (licenseeDT[0].State == l.Value)
                        {
                            l.Selected = true;
                            bProvince  = false;
                        }
                    }
                    if (bProvince)
                    {
                        tbProvince.Text = licenseeDT[0].State;
                    }
                }



                if (!(licenseeDT.Rows[0]["Zip"] is DBNull))
                {
                    tbZip.Text = licenseeDT[0].Zip;
                }

                if (!(licenseeDT.Rows[0]["Phone"] is DBNull))
                {
                    tbPhone.Text = licenseeDT[0].Phone;
                }

                if (!(licenseeDT.Rows[0]["Fax"] is DBNull))
                {
                    tbFax.Text = licenseeDT[0].Fax;
                }

                if (!(licenseeDT.Rows[0]["Password"] is DBNull))
                {
                    tbPassword.Text = licenseeDT[0].Password;
                }
            }
        }
        else//Take care of the deviants
        {
            Response.Redirect("./");
        }
    }
Exemple #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["id"] != null)//Protection required ALL edits!
        {
            if (!Page.IsPostBack)
            {
                licenseeTA            = new dsUserTableAdapters.licenseeTableAdapter();
                licenseeDT            = new dsUser.licenseeDataTable();
                licenseeDT            = licenseeTA.GetUserByID(Convert.ToInt32(Request.QueryString["id"].ToString()));
                Session["licenseeDT"] = licenseeDT;



                //Populate the existing data
                if (!(licenseeDT.Rows[0]["FirstName"] is DBNull))
                {
                    lblFirstName.Text = licenseeDT[0].FirstName;
                }

                if (!(licenseeDT.Rows[0]["MI"] is DBNull))
                {
                    lblMI.Text = licenseeDT[0].MI;
                }

                if (!(licenseeDT.Rows[0]["LastName"] is DBNull))
                {
                    lblLastName.Text = licenseeDT[0].LastName;
                }


                if (!(licenseeDT.Rows[0]["Email"] is DBNull))
                {
                    lblEmail.Text = licenseeDT[0].Email;
                }

                if (!(licenseeDT.Rows[0]["cid"] is DBNull))
                {
                    dsCompanyTableAdapters.legacyusersTableAdapter legacyusersTA = new dsCompanyTableAdapters.legacyusersTableAdapter();
                    dsCompany.legacyusersDataTable legacyusersDT = new dsCompany.legacyusersDataTable();
                    legacyusersDT = legacyusersTA.GetCompanyByID(licenseeDT[0].cid);

                    lblCompany.Text = legacyusersDT[0].Company;
                }

                if (!(licenseeDT.Rows[0]["Contract"] is DBNull))
                {
                    lblContract.Text = licenseeDT[0].Contract;
                }

                if (!(licenseeDT.Rows[0]["Address1"] is DBNull))
                {
                    lblAddress1.Text = licenseeDT[0].Address1;
                }

                if (!(licenseeDT.Rows[0]["Address2"] is DBNull))
                {
                    lblAddress2.Text = licenseeDT[0].Address2;
                }

                if (!(licenseeDT.Rows[0]["City"] is DBNull))
                {
                    lblCity.Text = licenseeDT[0].City;
                }

                if (!(licenseeDT.Rows[0]["State"] is DBNull))
                {
                    lblState.Text = licenseeDT[0].State;
                }
                if (!(licenseeDT.Rows[0]["Zip"] is DBNull))
                {
                    lblZip.Text = licenseeDT[0].Zip;
                }

                if (!(licenseeDT.Rows[0]["Phone"] is DBNull))
                {
                    lblPhone.Text = licenseeDT[0].Phone;
                }

                if (!(licenseeDT.Rows[0]["Fax"] is DBNull))
                {
                    lblFax.Text = licenseeDT[0].Fax;
                }

                if (!(licenseeDT.Rows[0]["Password"] is DBNull))
                {
                    lblPassword.Text = licenseeDT[0].Password;
                }

                if (!(licenseeDT.Rows[0]["UserLevel"] is DBNull))
                {
                    lblUserLevel.Text = licenseeDT[0].UserLevel;
                    if (licenseeDT[0].UserLevel == "D" && (!(licenseeDT.Rows[0]["FromDate"] is DBNull)) && (!(licenseeDT.Rows[0]["ToDate"] is DBNull)))//When Level D enforce the required field validator to the date range
                    {
                        lblDateRange.Text = "(" + licenseeDT[0].FromDate.ToShortDateString() + " ~ " + licenseeDT[0].ToDate.ToShortDateString() + ")";
                    }
                }

                if (!(licenseeDT.Rows[0]["UserCategory"] is DBNull))
                {
                    lblUserCategory.Text = licenseeDT[0].UserCategory;
                }

                if (!(licenseeDT.Rows[0]["RequestorID"] is DBNull))
                {
                    dsCompanyTableAdapters.requestorsTableAdapter requestorsTA = new dsCompanyTableAdapters.requestorsTableAdapter();
                    dsCompany.requestorsDataTable requestorsDT = new dsCompany.requestorsDataTable();
                    requestorsDT      = requestorsTA.GetRequestorByID(licenseeDT[0].RequestorID);
                    lblRequestor.Text = requestorsDT[0].name;
                }


                //dsCompanyTableAdapters.legacyusers2siteletsTableAdapter legacyusers2siteletsTA = new dsCompanyTableAdapters.legacyusers2siteletsTableAdapter();
                dsUserTableAdapters.licensee2siteletsTableAdapter licensee2siteletsTA = new dsUserTableAdapters.licensee2siteletsTableAdapter();

                //dsCompany.legacyusers2siteletsDataTable legacyusers2siteletsDT = new dsCompany.legacyusers2siteletsDataTable();
                dsUser.licensee2siteletsDataTable licensee2siteletsDT = new dsUser.licensee2siteletsDataTable();

                //legacyusers2siteletsDT = legacyusers2siteletsTA.Getc2sByCID(legacyusersDT[0].ID);
                licensee2siteletsDT = licensee2siteletsTA.Getu2sByUID(licenseeDT[0].ID);

                dsCompanyTableAdapters.siteletsTableAdapter siteletsTA = new dsCompanyTableAdapters.siteletsTableAdapter();
                dsCompany.siteletsDataTable siteletsDT = new dsCompany.siteletsDataTable();
                siteletsDT = siteletsTA.GetAllSitelets();

                string strSitelets = string.Empty;
                for (int i = 0; i < licensee2siteletsDT.Rows.Count; i++)
                {
                    for (int j = 0; j < siteletsDT.Rows.Count; j++)
                    {
                        if (siteletsDT[j].id == licensee2siteletsDT[i].sid)
                        {
                            strSitelets += siteletsDT[j].description + "<br>";
                        }
                    }
                }

                lblSitelets.Text = strSitelets;
            }
        }
        else//Take care of the deviants
        {
            Response.Redirect("./");
        }
    }
Exemple #14
0
    public List <user> GetUsersByCID(string cid)
    {
        string pID        = string.Empty;
        string pFirstName = string.Empty;
        string pLastName  = string.Empty;

        dsUserTableAdapters.licenseeTableAdapter licenseeTA = new dsUserTableAdapters.licenseeTableAdapter();
        dsUser.licenseeDataTable licenseeDT = new dsUser.licenseeDataTable();
        licenseeDT = licenseeTA.GetPrimaryContactByCID(Convert.ToInt32(cid));
        if (licenseeDT.Rows.Count > 0)
        {
            pID        = licenseeDT.Rows[0]["ID"].ToString();;
            pFirstName = licenseeDT.Rows[0]["FirstName"].ToString();
            pLastName  = licenseeDT.Rows[0]["LastName"].ToString();
        }

        dsUserTableAdapters.licensee4MgrTableAdapter licensee4MgrTA = new dsUserTableAdapters.licensee4MgrTableAdapter();
        dsUser.licensee4MgrDataTable licensee4MgrDT = new dsUser.licensee4MgrDataTable();
        licensee4MgrDT = licensee4MgrTA.GetLicenseesByCID(Convert.ToInt32(cid));
        for (int i = 0; i < licensee4MgrDT.Rows.Count; i++)
        {
            if (!(licensee4MgrDT.Rows[i]["UserLevel"] is DBNull))
            {
                switch (licensee4MgrDT[i].UserLevel)
                {
                case "A": licensee4MgrDT[i].Status = "<b><font color=\"cyan\">Current</font></b>"; break;

                case "B": licensee4MgrDT[i].Status = "<b><font color=\"cyan\">Current</font></b>"; break;

                case "C":
                    if (!(licensee4MgrDT.Rows[i]["AllowedYear"] is DBNull))
                    {
                        if (Convert.ToDateTime(DateTime.Now.ToShortDateString()) <= licensee4MgrDT[i].AllowedYear)
                        {
                            licensee4MgrDT[i].Status = "<b><font color=\"cyan\">Current</font></b>";
                        }
                        else
                        {
                            licensee4MgrDT[i].Status = "<b><font color=\"red\">Expired</font></b>";
                        }
                    }
                    else
                    {
                        licensee4MgrDT[i].Status = "<b>Unknown</b>";
                    }

                    break;

                case "D":
                    if (!(licensee4MgrDT.Rows[i]["FromDate"] is DBNull) && !(licensee4MgrDT.Rows[i]["ToDate"] is DBNull))
                    {
                        if ((Convert.ToDateTime(DateTime.Now.ToShortDateString()) >= licensee4MgrDT[i].FromDate) && (Convert.ToDateTime(DateTime.Now.ToShortDateString()) <= licensee4MgrDT[i].ToDate))
                        {
                            licensee4MgrDT[i].Status = "<b><font color=\"cyan\">Current</font></b>";
                        }
                        else
                        {
                            licensee4MgrDT[i].Status = "<b><font color=\"red\">Expired</font></b>";
                        }
                    }
                    else
                    {
                        licensee4MgrDT[i].Status = "<b>Unknown</b>";
                    }
                    break;

                case "X":
                    licensee4MgrDT[i].Status = "<b><font color=\"red\">Suspended</font></b>";
                    break;

                default: break;
                }
            }
        }
        List <user> users = new List <user>();

        foreach (DataRow dr in licensee4MgrDT.Rows)
        {
            user u = new user();
            u.uid            = dr["ID"].ToString();
            u.firstName      = dr["FirstName"].ToString();
            u.lastName       = dr["LastName"].ToString();
            u.email          = dr["Email"].ToString();
            u.userCategory   = dr["UserCategory"].ToString();
            u.requestorName  = dr["RequestorName"].ToString();
            u.status         = dr["Status"].ToString();
            u.cid            = cid;
            u.primaryContact = Convert.ToBoolean(dr["PrimaryContact"].ToString());
            //u.primaryContact = true;
            //u.requestorName = "Hudson Choi";
            //u.status = "Current";

            /*
             * if (dr["RequestorName"] != null)
             * {
             *  u.requestorName = dr["RequestorName"].ToString();
             * }
             * if (dr["Status"] != null)
             * {
             *  u.status = dr["Status"].ToString();
             * }
             */
            u.pid        = pID;
            u.pFirstName = pFirstName;
            u.pLastName  = pLastName;

            if (dr["RequestorEmail"] != null)
            {
                u.mlbEmail = dr["RequestorEmail"].ToString();
                u.mlbName  = dr["RequestorName"].ToString();
            }
            else
            {
                u.mlbEmail = "";
                u.mlbName  = "";
            }
            users.Add(u);
        }
        return(users);
        //List<CollectData>
        //return c;
    }
Exemple #15
0
    public string ContactTheUser(string email, string cID)
    {
        //return email + ":::::::" + cID;

        dsUserTableAdapters.licenseeTableAdapter licenseeTA = new dsUserTableAdapters.licenseeTableAdapter();
        dsUser.licenseeDataTable licenseeDT = new dsUser.licenseeDataTable();

        dsCompanyTableAdapters.legacyusersTableAdapter legacyusersTA = new dsCompanyTableAdapters.legacyusersTableAdapter();
        dsCompany.legacyusersDataTable legacyusersDT = new dsCompany.legacyusersDataTable();
        legacyusersDT = legacyusersTA.GetCompanyByID(Convert.ToInt32(cID));

        StringBuilder sbMsg = new StringBuilder();
        //StringBuilder sbMsgPop = new StringBuilder();
        string msgPop = string.Empty;

        sbMsg.Append("<img src=\"cid:Pic1\"><br>");
        sbMsg.Append("Welcome " + legacyusersDT.Rows[0]["Company"].ToString() + ",<br><br>");
        sbMsg.Append("Thank you for registering at www.mlbstyleguide.com.<br><br>");
        sbMsg.Append("Your temporary login information is shown below:<br><br>");

        sbMsg.Append("User name: " + legacyusersDT.Rows[0]["UserName"].ToString() + "<br>");
        sbMsg.Append("Password: "******"Password"].ToString() + "<br><br>");

        msgPop = "User name: " + legacyusersDT.Rows[0]["UserName"].ToString() + "<br>" +
                 "Password: "******"Password"].ToString() + "<br><br>" +
                 "https://www.mlbstyleguide.com/go.asp?ce=" + EncodeTo64(email);

        sbMsg.Append("You can login with this information by clicking <a href=\"" + "https://www.mlbstyleguide.com/go.asp?ce=" + EncodeTo64(email) + "\" style=\"color:#FF0000\"><b>here</b></a>. Once you log in you will be asked to complete a short form and create your own unique password. Future access to the site will then be done by simply entering your e-mail address and desired password.<br><br>");
        sbMsg.Append("If you have any questions or need any other assistance, please contact us at [email protected].<br><br>");
        sbMsg.Append("<br>Thank you,<br><br>Major League Baseball Properties");

        AlternateView avHthml = AlternateView.CreateAlternateViewFromString(sbMsg.ToString(), null, MediaTypeNames.Text.Html);

        LinkedResource pic1 = new LinkedResource(Server.MapPath("emailbanner.jpg"), MediaTypeNames.Image.Jpeg);

        pic1.ContentId = "Pic1";
        avHthml.LinkedResources.Add(pic1);

        string      _FromName  = "Major League Baseball";
        string      _FromEmail = "*****@*****.**";
        string      strSubject = "MLB Style Guide Registration";
        SmtpClient  smtpClient;
        MailMessage message;

        try
        {
            smtpClient      = new SmtpClient();
            smtpClient.Host = ConfigurationManager.AppSettings["SMTPServer"].ToString();
            smtpClient.Port = 25;
            message         = new MailMessage();

            MailAddress fromAddress = new MailAddress(_FromEmail, _FromName);
            message.From = fromAddress;

            MailAddress toAddress = new MailAddress(email);
            message.To.Clear();
            message.To.Add(toAddress);

            message.Subject    = strSubject;
            message.IsBodyHtml = true;
            //message.Body = sbMsg.ToString();
            message.AlternateViews.Add(avHthml);
            smtpClient.Send(message);
        }
        catch (Exception ex)
        {
            //throw ex;
            //iBadEmails++;
            //sbBadEmailList.Append("<a href=\"EditUser.aspx?id=" + strID + "\" target=\"_blank\">" + strRecepient + "</a><br/>");
        }

        return(msgPop);
    }
Exemple #16
0
    public string NotifyPrimaryContact(string pID, string cID)
    {
        //TO DO: Use pID and cID to send email;

        //Get the user list after deleteion
        //List<user> users = GetUsersByCID(cID);
        //return users;
        dsUserTableAdapters.licenseeTableAdapter licenseeTA = new dsUserTableAdapters.licenseeTableAdapter();
        dsUser.licenseeDataTable licenseeDT = new dsUser.licenseeDataTable();
        licenseeDT = licenseeTA.GetUserByID(Convert.ToInt32(pID));
        string pEmail = licenseeDT.Rows[0]["email"].ToString();
        //string pEmail = "*****@*****.**";
        //string mlbEmail = "*****@*****.**";
        string pFirstName = licenseeDT.Rows[0]["FirstName"].ToString();
        string pLastName  = licenseeDT.Rows[0]["LastName"].ToString();

        dsRequestorsTableAdapters.requestorsTableAdapter requestorsTA = new dsRequestorsTableAdapters.requestorsTableAdapter();
        dsRequestors.requestorsDataTable requestorsDT = new dsRequestors.requestorsDataTable();
        requestorsDT = requestorsTA.GetRequestorByID(Convert.ToInt32(licenseeDT.Rows[0]["RequestorID"].ToString()));
        string mlbEmail = requestorsDT.Rows[0]["Email"].ToString();


        licenseeDT = licenseeTA.GetUsersByCID(Convert.ToInt32(cID));

        StringBuilder sbMsg    = new StringBuilder();
        StringBuilder sbMsgPop = new StringBuilder();

        sbMsg.Append("Dear " + pFirstName + " " + pLastName + ",<br><br>");
        sbMsg.Append("As part of our ongoing security practices, this message provides a current active list of the MLBstyleguide.com user group that you oversee. Please review and confirm that all of the following users are in good standing. If the status has changed for any of the registered users, it is very important that you let your MLB representative know immediately so that they can be removed from the active user list.<br><br>");
        //sbMsg.Append("Please confirm the following users are up-to-dated and let us know if anyone needs to be removed.<br><br>");
        sbMsgPop.Append("The following users were emailed to '" + pFirstName + "' successfully!\n\n");
        foreach (dsUser.licenseeRow r in licenseeDT.Rows)
        {
            sbMsg.Append(r["FirstName"].ToString() + " " + r["LastName"].ToString() + "<br>");
            sbMsgPop.Append(r["FirstName"].ToString() + " " + r["LastName"].ToString() + "\n");
        }
        sbMsg.Append("<br>Thank you for your cooperation.<br><br>Major League Baseball Properties");

        string      _FromName  = "Major League Baseball";
        string      _FromEmail = "*****@*****.**";
        string      strSubject = "MLB Style Guide: The current user list";
        SmtpClient  smtpClient;
        MailMessage message;

        try
        {
            smtpClient      = new SmtpClient();
            smtpClient.Host = ConfigurationManager.AppSettings["SMTPServer"].ToString();
            smtpClient.Port = 25;
            message         = new MailMessage();

            MailAddress fromAddress = new MailAddress(_FromEmail, _FromName);
            message.From = fromAddress;

            MailAddress toAddress = new MailAddress(pEmail);
            message.To.Clear();
            message.To.Add(toAddress);

            MailAddress ccAddress = new MailAddress(mlbEmail);
            message.CC.Clear();
            message.CC.Add(ccAddress);

            message.Subject    = strSubject;
            message.IsBodyHtml = true;
            message.Body       = sbMsg.ToString();
            smtpClient.Send(message);
        }
        catch (Exception ex)
        {
            //throw ex;
            //iBadEmails++;
            //sbBadEmailList.Append("<a href=\"EditUser.aspx?id=" + strID + "\" target=\"_blank\">" + strRecepient + "</a><br/>");
        }
        return(sbMsgPop.ToString());
    }