Example #1
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        PIKCV.BUS.UserCVs objUserProhibitedCompanies = new PIKCV.BUS.UserCVs();
        DataTable         dtUserProhibitedCompanies  = objUserProhibitedCompanies.GetUserProhibitedCompanies(this.smUserID);

        DataBindHelper.BindListbox(ref lbSelectedCompanies, dtUserProhibitedCompanies, "CompanyName", "CompanyID");


        DataTable dtAllCompanies = this.cmbCompanies;
        DataTable dtCompaniesNew = new DataTable();

        if (dtAllCompanies.Rows.Count > 0)
        {
            dtCompaniesNew.Columns.Add("CompanyID");
            dtCompaniesNew.Columns.Add("CompanyName");

            bool add = true;
            foreach (DataRow drCache in dtAllCompanies.Rows)
            {
                add = true;
                foreach (DataRow dr in dtUserProhibitedCompanies.Rows)
                {
                    if (dr["CompanyID"].ToString() == drCache["CompanyID"].ToString())
                    {
                        add = false;
                        break;
                    }
                }
                if (add)
                {
                    DataRow drNew = dtCompaniesNew.NewRow();
                    drNew["CompanyID"]   = drCache["CompanyID"].ToString();
                    drNew["CompanyName"] = drCache["CompanyName"].ToString();
                    dtCompaniesNew.Rows.Add(drNew);
                }
            }
        }
        else
        {
            dtCompaniesNew = dtAllCompanies.Copy();
        }

        DataBindHelper.BindListbox(ref lbCompanies, dtCompaniesNew, "CompanyName", "CompanyID", "");

        PIKCV.BUS.UserCVs objUserCV = new PIKCV.BUS.UserCVs();
        DataTable         dtUserCV  = objUserCV.GetUserCV(this.smUserID);

        ImgBtnSave.Visible     = (Convert.ToInt32(dtUserCV.Rows[0]["CvFocusCode"]) > (int)PIKCV.COM.EnumDB.CVFocusCode.References);
        ImgBtnContinue.Visible = !(ImgBtnSave.Visible);
    }