예제 #1
0
    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;
    }
예제 #2
0
    protected void ddlRequestor_DataBound(object sender, EventArgs e)
    {
        if (Session["licenseeDT"] != null)
        {
            licenseeDT = (dsUser.licenseeDataTable)(Session["licenseeDT"]);

            if (licenseeDT.Rows[0]["cid"].ToString() != ddlCompany.SelectedValue)//A different company was selected. Get requestor from the company data
            {
                dsCompanyTableAdapters.legacyusersTableAdapter legacyusersTA = new dsCompanyTableAdapters.legacyusersTableAdapter();
                dsCompany.legacyusersDataTable legacyusersDT = new dsCompany.legacyusersDataTable();
                legacyusersDT = legacyusersTA.GetCompanyByID(int.Parse(ddlCompany.SelectedValue));
                if (!(legacyusersDT.Rows[0]["RequestorID"] is DBNull))
                {
                    ddlRequestor.Items.FindByValue(legacyusersDT[0].RequestorID.ToString()).Selected = true;
                }
            }
            else
            {
                //Populate the requstor with the session
                if (!(licenseeDT.Rows[0]["RequestorID"] is DBNull))
                {
                    ddlRequestor.Items.FindByValue(licenseeDT[0].RequestorID.ToString()).Selected = true;
                }
            }
        }
        ddlRequestor.Items.FindByValue("0").Text = "Select One";
    }
예제 #3
0
    protected void btnBack2_Click(object sender, EventArgs e)
    {
        lblStep.Text           = "Step 1 of 5:";
        lblDescription.Text    = "Enter The Company Information";
        tableProfile.Visible   = true;
        cvMessage.Enabled      = true;
        tableUserLevel.Visible = false;

        ltrBack.Text = "<input type=\"button\" name=\"btnBack\" value=\"<<< Go Back\" onclick=\"window.location.replace('./CompanyMgr.aspx')\"/>";



        if (Session["legacyusersDT"] == null)//At first arrival, create the session as needed.
        {
            legacyusersTA            = new dsCompanyTableAdapters.legacyusersTableAdapter();
            legacyusersDT            = new dsCompany.legacyusersDataTable();
            legacyusersDT            = legacyusersTA.GetCompanyByID(Convert.ToInt32(Request.QueryString["id"].ToString()));
            Session["legacyusersDT"] = legacyusersDT;
        }
        else
        {
            legacyusersDT = (dsCompany.legacyusersDataTable)(Session["legacyusersDT"]);
        }

        //Populate the existing data
        if (!(legacyusersDT.Rows[0]["Company"] is DBNull))
        {
            tbCompany.Text = legacyusersDT[0].Company;
        }
        if (!(legacyusersDT.Rows[0]["Address1"] is DBNull))
        {
            tbAddress1.Text = legacyusersDT[0].Address1;
        }
        if (!(legacyusersDT.Rows[0]["Address2"] is DBNull))
        {
            tbAddress2.Text = legacyusersDT[0].Address2;
        }
        if (!(legacyusersDT.Rows[0]["City"] is DBNull))
        {
            tbCity.Text = legacyusersDT[0].City;
        }
        if (!(legacyusersDT.Rows[0]["State"] is DBNull))
        {
            bool bProvince = true;
            foreach (ListItem l in ddlState.Items)
            {
                if (legacyusersDT[0].State == l.Value)
                {
                    l.Selected = true;
                    bProvince  = false;
                }
            }
            if (bProvince)
            {
                tbProvince.Text = legacyusersDT[0].State;
            }
        }
        if (!(legacyusersDT.Rows[0]["Zip"] is DBNull))
        {
            tbZip.Text = legacyusersDT[0].Zip;
        }
        if (!(legacyusersDT.Rows[0]["Phone"] is DBNull))
        {
            tbPhone.Text = legacyusersDT[0].Phone;
        }
        if (!(legacyusersDT.Rows[0]["Contract"] is DBNull))
        {
            tbContract.Text = legacyusersDT[0].Contract;
        }
        if (!(legacyusersDT.Rows[0]["UserName"] is DBNull))
        {
            tbUserName.Text = legacyusersDT[0].UserName;
        }
        if (!(legacyusersDT.Rows[0]["Password"] is DBNull))
        {
            tbPassword.Text = legacyusersDT[0].Password;
        }
    }
예제 #4
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)
            {
                legacyusersTA            = new dsCompanyTableAdapters.legacyusersTableAdapter();
                legacyusersDT            = new dsCompany.legacyusersDataTable();
                legacyusersDT            = legacyusersTA.GetCompanyByID(Convert.ToInt32(Request.QueryString["id"].ToString()));
                Session["legacyusersDT"] = legacyusersDT;


                //Populate the existing data
                if (!(legacyusersDT.Rows[0]["Company"] is DBNull))
                {
                    tbCompany.Text = legacyusersDT[0].Company;
                }
                if (!(legacyusersDT.Rows[0]["Address1"] is DBNull))
                {
                    tbAddress1.Text = legacyusersDT[0].Address1;
                }
                if (!(legacyusersDT.Rows[0]["Address2"] is DBNull))
                {
                    tbAddress2.Text = legacyusersDT[0].Address2;
                }
                if (!(legacyusersDT.Rows[0]["City"] is DBNull))
                {
                    tbCity.Text = legacyusersDT[0].City;
                }
                if (!(legacyusersDT.Rows[0]["State"] is DBNull))
                {
                    bool bProvince = true;
                    foreach (ListItem l in ddlState.Items)
                    {
                        if (legacyusersDT[0].State == l.Value)
                        {
                            l.Selected = true;
                            bProvince  = false;
                        }
                    }
                    if (bProvince)
                    {
                        tbProvince.Text = legacyusersDT[0].State;
                    }
                }
                if (!(legacyusersDT.Rows[0]["Zip"] is DBNull))
                {
                    tbZip.Text = legacyusersDT[0].Zip;
                }
                if (!(legacyusersDT.Rows[0]["Phone"] is DBNull))
                {
                    tbPhone.Text = legacyusersDT[0].Phone;
                }
                if (!(legacyusersDT.Rows[0]["Contract"] is DBNull))
                {
                    tbContract.Text = legacyusersDT[0].Contract;
                }
                if (!(legacyusersDT.Rows[0]["UserName"] is DBNull))
                {
                    tbUserName.Text = legacyusersDT[0].UserName;
                }
                if (!(legacyusersDT.Rows[0]["Password"] is DBNull))
                {
                    tbPassword.Text = legacyusersDT[0].Password;
                }
            }
        }
        else//Take care of the deviants
        {
            Response.Redirect("./");
        }
    }
예제 #5
0
    protected void btnContinue2_Click(object sender, EventArgs e)
    {
        if (Session["licenseeDT"] != null)
        {
            if (Page.IsValid)
            {
                licenseeDT = (dsUser.licenseeDataTable)(Session["licenseeDT"]);

                licenseeDT[0].UserLevel = rblUserLevel.SelectedValue;
                if (rblUserLevel.SelectedValue == "D")
                {
                    licenseeDT[0].FromDate = Convert.ToDateTime(calendarPopupFrom.SelectedDate.ToString());
                    licenseeDT[0].ToDate   = Convert.ToDateTime(calendarPopupTo.SelectedDate.ToString());
                }
                else if (rblUserLevel.SelectedValue == "C")
                {
                    licenseeDT[0].AllowedYear      = Convert.ToDateTime("12/31/" + DateTime.Now.Year);
                    licenseeDT.Rows[0]["FromDate"] = DBNull.Value;
                    licenseeDT.Rows[0]["ToDate"]   = DBNull.Value;
                }
                else
                {
                    licenseeDT.Rows[0]["FromDate"]    = DBNull.Value;
                    licenseeDT.Rows[0]["ToDate"]      = DBNull.Value;
                    licenseeDT.Rows[0]["AllowedYear"] = DBNull.Value;
                }

                if (licenseeDT.Rows[0]["cid"].ToString() != ddlCompany.SelectedValue)//A different company was selected. Get requestor from the company data
                {
                    dsCompanyTableAdapters.legacyusersTableAdapter legacyusersTA = new dsCompanyTableAdapters.legacyusersTableAdapter();
                    dsCompany.legacyusersDataTable legacyusersDT = new dsCompany.legacyusersDataTable();
                    legacyusersDT = legacyusersTA.GetCompanyByID(int.Parse(ddlCompany.SelectedValue));
                    if (!(legacyusersDT.Rows[0]["UserCategory"] is DBNull))
                    {
                        rblUserCategory.ClearSelection();
                        rblUserCategory.Items.FindByValue(legacyusersDT[0].UserCategory).Selected = true;
                        bodyID.Attributes.Add("onload", "");
                        rblUserCategory.Attributes.Add("onclick", "");
                        lblStep.Text = "Step 3 of 5:";
                    }
                    else
                    {
                        lblStep.Text = "Step 3 of 5:";
                    }
                }
                else
                {
                    //Populate the user category with the session
                    if (!(licenseeDT.Rows[0]["UserCategory"] is DBNull))
                    {
                        rblUserCategory.ClearSelection();
                        rblUserCategory.Items.FindByValue(licenseeDT[0].UserCategory).Selected = true;
                        //Allow sitelet selection to level "A" 091408
                        //Remove UserLevel Requestor logic 050508
                        //if (licenseeDT[0].UserLevel == "A")
                        //{
                        //    lblStep.Text = "Step 3 of 4:";
                        //    bodyID.Attributes.Add("onload", "ChangeStep()");
                        //    rblUserCategory.Attributes.Add("onclick", "ChangeStep()");
                        //}
                        //else
                        //{
                        bodyID.Attributes.Add("onload", "");
                        rblUserCategory.Attributes.Add("onclick", "");
                        lblStep.Text = "Step 3 of 5:";
                        //}
                    }
                    else
                    {
                        lblStep.Text = "Step 3 of 5:";
                    }
                }


                Session["licenseeDT"] = licenseeDT;


                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("./");
        }
    }
예제 #6
0
    protected void btnContinue1_Click(object sender, EventArgs e)
    {
        if (Session["licenseeDT"] != null)//At first arrival, create the session as needed.
        {
            if (Page.IsValid)
            {
                licenseeDT = (dsUser.licenseeDataTable)(Session["licenseeDT"]);

                licenseeDT[0].FirstName = tbFirstName.Text;
                licenseeDT[0].MI        = tbMI.Text;
                licenseeDT[0].LastName  = tbLastName.Text;
                licenseeDT[0].Email     = tbEmail.Text;
                licenseeDT[0].Contract  = tbContract.Text;
                licenseeDT[0].Address1  = tbAddress1.Text;
                licenseeDT[0].Address2  = tbAddress2.Text;
                licenseeDT[0].City      = tbCity.Text;

                if (ddlState.SelectedIndex > 0)
                {
                    licenseeDT[0].State = ddlState.SelectedValue;
                }
                else
                {
                    licenseeDT[0].State = tbProvince.Text;
                }

                licenseeDT[0].Zip      = tbZip.Text;
                licenseeDT[0].Country  = ddlCountry.SelectedValue;
                licenseeDT[0].Phone    = tbPhone.Text;
                licenseeDT[0].Fax      = tbFax.Text;
                licenseeDT[0].Password = tbPassword.Text;

                //Populate the user level using the session
                if (!(licenseeDT.Rows[0]["UserLevel"] is DBNull))
                {
                    var userLevel = "";
                    dsCompanyTableAdapters.legacyusersTableAdapter legacyusersTA = new dsCompanyTableAdapters.legacyusersTableAdapter();
                    dsCompany.legacyusersDataTable legacyusersDT = new dsCompany.legacyusersDataTable();
                    try
                    {
                        if (licenseeDT.Rows[0]["cid"].ToString() != ddlCompany.SelectedValue)//A different company was selected. Get requestor from the company data
                        {
                            legacyusersDT = legacyusersTA.GetCompanyByID(int.Parse(ddlCompany.SelectedValue));
                            if (!(legacyusersDT.Rows[0]["UserLevel"] is DBNull))
                            {
                                userLevel = legacyusersDT[0].UserLevel;
                            }
                        }
                        else
                        {
                            userLevel = licenseeDT[0].UserLevel;
                        }
                    }
                    catch (Exception ex) {}
                    rblUserLevel.ClearSelection();//Without this can't change it for company dropdown feature coming back from step 2
                    rblUserLevel.Items.FindByValue(userLevel).Selected = true;

                    if (userLevel == "D")//When Level D enforce the required field validator to the date range
                    {
                        bodyID.Attributes.Add("onload", "document.getElementById(\"dateLayer\").style.visibility=\"visible\";");
                        if (licenseeDT.Rows[0]["cid"].ToString() != ddlCompany.SelectedValue)//A different company was selected. Get requestor from the company data
                        {
                            if (!(legacyusersDT.Rows[0]["FromDate"] is DBNull) && !(legacyusersDT.Rows[0]["ToDate"] is DBNull))
                            {
                                calendarPopupFrom.SelectedDate = legacyusersDT[0].FromDate;
                                calendarPopupTo.SelectedDate   = legacyusersDT[0].ToDate;
                            }
                        }
                        else
                        {
                            if (!(licenseeDT.Rows[0]["FromDate"] is DBNull) && !(licenseeDT.Rows[0]["ToDate"] is DBNull))
                            {
                                calendarPopupFrom.SelectedDate = licenseeDT[0].FromDate;
                                calendarPopupTo.SelectedDate   = licenseeDT[0].ToDate;
                            }
                        }

                        rfvFrom.Enabled             = true;
                        rfvTo.Enabled               = true;
                        cvFrom.Enabled              = true;
                        cvTo.Enabled                = true;
                        cpvDateRange.Enabled        = true;
                        Session["DateWasDisplayed"] = "yes";
                    }
                    else
                    {
                        bodyID.Attributes.Add("onload", "document.getElementById(\"dateLayer\").style.visibility=\"hidden\";");
                        Session["DateWasDisplayed"] = null;
                    }
                }


                Session["licenseeDT"] = licenseeDT;

                lblStep.Text           = "Step 2 of 5:";
                lblDescription.Text    = "Choose a user level";
                tableProfile.Visible   = false;
                cvMessage.Enabled      = false;
                tableUserLevel.Visible = true;
            }
        }
        else
        {
            Response.Redirect("./");
        }
    }
예제 #7
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("./");
        }
    }
예제 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["id"] != null)//Protection required ALL edits!
        {
            if (!Page.IsPostBack)
            {
                try{
                    legacyusersTA            = new dsCompanyTableAdapters.legacyusersTableAdapter();
                    legacyusersDT            = new dsCompany.legacyusersDataTable();
                    legacyusersDT            = legacyusersTA.GetCompanyByID(Convert.ToInt32(Request.QueryString["id"].ToString()));
                    Session["legacyusersDT"] = legacyusersDT;


                    //Populate the existing data
                    if (!(legacyusersDT.Rows[0]["Company"] is DBNull))
                    {
                        lblCompany.Text = legacyusersDT[0].Company;
                    }
                    if (!(legacyusersDT.Rows[0]["Address1"] is DBNull))
                    {
                        lblAddress1.Text = legacyusersDT[0].Address1;
                    }
                    if (!(legacyusersDT.Rows[0]["Address2"] is DBNull))
                    {
                        lblAddress2.Text = legacyusersDT[0].Address2;
                    }
                    if (!(legacyusersDT.Rows[0]["City"] is DBNull))
                    {
                        lblCity.Text = legacyusersDT[0].City;
                    }
                    if (!(legacyusersDT.Rows[0]["State"] is DBNull))
                    {
                        lblState.Text = legacyusersDT[0].State;
                    }
                    if (!(legacyusersDT.Rows[0]["Zip"] is DBNull))
                    {
                        lblZip.Text = legacyusersDT[0].Zip;
                    }
                    if (!(legacyusersDT.Rows[0]["Country"] is DBNull))
                    {
                        lblCountry.Text = legacyusersDT[0].Country;
                    }
                    if (!(legacyusersDT.Rows[0]["Phone"] is DBNull))
                    {
                        lblPhone.Text = legacyusersDT[0].Phone;
                    }
                    if (!(legacyusersDT.Rows[0]["Email"] is DBNull))
                    {
                        lblEmail.Text = legacyusersDT[0].Email;
                    }
                    if (!(legacyusersDT.Rows[0]["Contract"] is DBNull))
                    {
                        lblContract.Text = legacyusersDT[0].Contract;
                    }
                    if (!(legacyusersDT.Rows[0]["UserName"] is DBNull))
                    {
                        lblUserName.Text = legacyusersDT[0].UserName;
                    }
                    if (!(legacyusersDT.Rows[0]["Password"] is DBNull))
                    {
                        lblPassword.Text = legacyusersDT[0].Password;
                    }
                    if (!(legacyusersDT.Rows[0]["UserLevel"] is DBNull))
                    {
                        lblUserLevel.Text = legacyusersDT[0].UserLevel;
                        if (legacyusersDT[0].UserLevel == "D" && (!(legacyusersDT.Rows[0]["FromDate"] is DBNull)) && (!(legacyusersDT.Rows[0]["ToDate"] is DBNull)))//When Level D enforce the required field validator to the date range
                        {
                            lblDateRange.Text = "(" + legacyusersDT[0].FromDate.ToShortDateString() + " ~ " + legacyusersDT[0].ToDate.ToShortDateString() + ")";
                        }
                    }
                    if (!(legacyusersDT.Rows[0]["UserCategory"] is DBNull))
                    {
                        lblUserCategory.Text = legacyusersDT[0].UserCategory;
                    }
                    if (!(legacyusersDT.Rows[0]["RequestorID"] is DBNull))
                    {
                        dsCompanyTableAdapters.requestorsTableAdapter requestorsTA = new dsCompanyTableAdapters.requestorsTableAdapter();
                        dsCompany.requestorsDataTable requestorsDT = new dsCompany.requestorsDataTable();
                        requestorsDT = requestorsTA.GetRequestorByID(legacyusersDT[0].RequestorID);
                        if (requestorsDT.Rows.Count > 0)
                        {
                            lblRequestor.Text = requestorsDT[0].name;
                        }
                    }

                    dsCompanyTableAdapters.legacyusers2siteletsTableAdapter legacyusers2siteletsTA = new dsCompanyTableAdapters.legacyusers2siteletsTableAdapter();
                    dsCompany.legacyusers2siteletsDataTable legacyusers2siteletsDT = new dsCompany.legacyusers2siteletsDataTable();
                    legacyusers2siteletsDT = legacyusers2siteletsTA.Getc2sByCID(legacyusersDT[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 < legacyusers2siteletsDT.Rows.Count; i++)
                    {
                        for (int j = 0; j < siteletsDT.Rows.Count; j++)
                        {
                            if (siteletsDT[j].id == legacyusers2siteletsDT[i].sid)
                            {
                                strSitelets += siteletsDT[j].description + "<br>";
                            }
                        }
                    }

                    lblSitelets.Text = strSitelets;
                }
                catch (Exception ex)
                {
                    HttpBrowserCapabilities br = Request.Browser;

                    string strHandledMessage = "ex.StackTrace: " + ex.StackTrace.ToString() +
                                               Environment.NewLine + Environment.NewLine +
                                               "The client ip: " + Request.ServerVariables["REMOTE_ADDR"] +
                                               Environment.NewLine + Environment.NewLine +
                                               "GetLastError.Message: " + ex.Message.ToString() +
                                               Environment.NewLine + Environment.NewLine +
                                               "Page: " + Request.ServerVariables["SCRIPT_NAME"] +
                                               Environment.NewLine + Environment.NewLine +
                                               "Server: " + Request.ServerVariables["SERVER_NAME"] +
                                               Environment.NewLine + Environment.NewLine +
                                               "Local Address: " + Request.ServerVariables["LOCAL_ADDR"] +
                                               Environment.NewLine + Environment.NewLine +
                                               "Browser: " + br.Browser.ToString() + " : " + br.Version.ToString();

                    if (Request.UrlReferrer != null)
                    {
                        strHandledMessage += Environment.NewLine + Environment.NewLine +
                                             "Referrer: " + Request.UrlReferrer.ToString();
                    }

                    if (Request.QueryString != null)
                    {
                        strHandledMessage += Environment.NewLine + Environment.NewLine +
                                             "Query String: " + Request.QueryString.ToString();
                    }


                    strHandledMessage += Environment.NewLine + Environment.NewLine;
                    System.Net.Mail.SmtpClient  smtpClient = new System.Net.Mail.SmtpClient();
                    System.Net.Mail.MailMessage message    = new System.Net.Mail.MailMessage();
                    try
                    {
                        System.Net.Mail.MailAddress fromAddress = new System.Net.Mail.MailAddress("*****@*****.**", "Debugger");
                        smtpClient.Host = System.Configuration.ConfigurationManager.AppSettings["SMTPServer"].ToString();
                        smtpClient.Port = 25;
                        message.From    = fromAddress;
                        message.To.Add("*****@*****.**");
                        message.Subject = "MLBStyleGuide : Error on " + Request.ServerVariables["SCRIPT_NAME"] + ".. but handled";
                        //message.Body = Server.GetLastError().InnerException.Message.ToString();
                        message.Body = strHandledMessage;
                        smtpClient.Send(message);
                    }
                    catch (Exception e2)
                    {
                        //lblStatus.Text = "Send Email Failed." + ex.Message;
                    }
                }
            }
        }
        else//Take care of the deviants
        {
            Response.Redirect("./");
        }
    }
예제 #9
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);
    }