コード例 #1
0
ファイル: EditUser.aspx.cs プロジェクト: hudsonchoi/balladmin
    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;
        }
    }
コード例 #2
0
ファイル: EditUser.aspx.cs プロジェクト: hudsonchoi/balladmin
    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("./");
        }
    }
コード例 #3
0
    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("./");
        }
    }
コード例 #4
0
    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("./");
        }
    }