private void Page_Load(object sender, System.EventArgs e)
        {
            /*if(!IsPostBack)
             * {
             *      //se obtine tipul de autentificare la aplicatie
             *      string authentication = Salaries.Configuration.CryptographyClass.getSettingsWithoutDecode("authentication");
             *
             *      //virtual path
             *      string path = Page.Request.FilePath;
             *      char separator = '/';
             *      string [] pathArr = path.Split(separator);
             *      int nr = pathArr.Length;
             *
             *      //autentificare de tip windows
             *      if (authentication == "1")
             *      {
             *              //user-ul loginat
             *              user = new WindowsPrincipal(WindowsIdentity.GetCurrent());
             *
             *              //user-ul loginat nu are dreptul sa acceseze aceasta pagina este redirectat catre o pagina care sa il instiinteze de acest lucru
             *              if(!Salaries.Business.Authentication.HasUserRightsOnPage(pathArr[nr-1],user))
             *              {
             *                      Response.Redirect("../Unauthorized.aspx");
             *              }
             *      }
             *      //autentificare cu user si parola
             *      else
             *      {
             *              string nume = Session["Nume"].ToString();
             *              string parola = Session["Parola"].ToString();
             *              int angajatorId = int.Parse(Session["AngajatorId"].ToString());
             *
             *              //user-ul loginat nu are dreptul sa acceseze aceasta pagina este redirectat catre o pagina care sa il instiinteze de acest lucru
             *              if(!Salaries.Business.Authentication.HasUserRightsOnPage(pathArr[nr-1], nume, parola, angajatorId))
             *              {
             *                      Response.Redirect("../Unauthorized.aspx");
             *              }
             *      }
             * }*/

            Salaries.Business.AdminSalariiLuni salarii = new Salaries.Business.AdminSalariiLuni();
            DataSet ds = salarii.LoadInfoLuniSalariiUnion();

            ds.Tables[0].Rows.RemoveAt(0);
            lstLuna.DataSource     = ds;
            lstLuna.DataTextField  = "Denumire";
            lstLuna.DataValueField = "LunaTextID";
            lstLuna.DataBind();

            int an = DateTime.Now.Year;

            for (int i = an - 5; i <= an + 5; i++)
            {
                lstAn.Items.Add(new ListItem(i + "", i + ""));
            }

            // Lista bancilor.
            Salaries.Business.AdminBanci banci = new Salaries.Business.AdminBanci();

            string[] textTabs = { "Date angajator", "Conturi angajator", "Adresa angajator", "Domenii de activitate", "Punct de lucru", "Reprezentanti legali" };
            Utilities.CreateHeaderWithTabsForAdminAngajator(tableTabs, textTabs, "../", true);

            settings = Salaries.Configuration.ModuleConfig.GetSettings();

            UtilitiesDb utilDb = new UtilitiesDb(settings.ConnectionString);

            // Sunt facute invizibile textbox-urile
            txtHiddenDomDeActPpID.Style.Add("display", "none");
            txtHiddenDomDeActListID.Style.Add("display", "none");
            txtHiddenPunctLucru.Style.Add("display", "none");

            //tara
            Salaries.Business.AdminTari tari = new Salaries.Business.AdminTari();
            lstDTara.DataSource     = tari.LoadInfoTariCuJudete();
            lstDTara.DataTextField  = "NumeTara";
            lstDTara.DataValueField = "TaraID";
            lstDTara.DataBind();
            if (txtTaraHidden.Value != "")
            {
                lstDTara.SelectedValue = txtTaraHidden.Value;
            }

            //judetul
            Salaries.Business.AdminJudete judete = new Salaries.Business.AdminJudete();
            judete.TaraId            = int.Parse(lstDTara.SelectedValue);
            lstDJudet.DataSource     = judete.GetAllJudeteTara();
            lstDJudet.DataTextField  = "NumeCompus";
            lstDJudet.DataValueField = "JudetID";
            lstDJudet.DataBind();
            if (txtJudetSectorHidden.Value != "")
            {
                lstDJudet.SelectedValue = txtJudetSectorHidden.Value;
            }

            // Listare banci.
            drpBanci.DataSource     = banci.GetBanci();
            drpBanci.DataTextField  = "NumeBanca";
            drpBanci.DataValueField = "BancaID";
            drpBanci.DataBind();

            // Listare domenii de activitate ale angajatorului
            ListareDomeniiDeActivitate();

            txtTaraHidden.Value        = txtTaraHidden.Value == "" ? lstDTara.SelectedValue : txtTaraHidden.Value;
            txtJudetSectorHidden.Value = txtJudetSectorHidden.Value == "" ? lstDJudet.SelectedValue : txtJudetSectorHidden.Value;
            txtHiddenLuna.Value        = txtHiddenLuna.Value == "" ? lstLuna.SelectedValue : txtHiddenLuna.Value;
            txtHiddenAn.Value          = txtHiddenAn.Value == "" ? lstAn.SelectedValue : txtHiddenAn.Value;

            //Lungu Andreea 28.05.2008
            //este populat dropdownlist-ul ce contine casele de asigurari
            DataSet dsCaseDeAsig = new DataSet();

            Salaries.Business.CasaDeAsigurari casaAsig = new Salaries.Business.CasaDeAsigurari();
            // Lista caselor de asigurari ale unui angajator.
            dsCaseDeAsig = casaAsig.GetAllCasaDeAsigurari();
            drpCaseDeAsigurari.DataSource     = dsCaseDeAsig;
            drpCaseDeAsigurari.DataTextField  = "Denumire";
            drpCaseDeAsigurari.DataValueField = "CasaDeAsigurariID";
            drpCaseDeAsigurari.DataBind();

            //Lungu Andreea 19.08.2008
            //este populat dropdownlist-ul ce contine functiile reprzentantilor legali
            DataSet dsFunctiiReprez = new DataSet();

            //Lista functiilor reprezentantilor legali ale unui angajator.
            Salaries.Business.AdminAngajator angajator = new Salaries.Business.AdminAngajator();
            dsFunctiiReprez                 = angajator.GetAllFunctiiReprez();
            drpFunctiiReprez.DataSource     = dsFunctiiReprez;
            drpFunctiiReprez.DataTextField  = "NumeFunctie";
            drpFunctiiReprez.DataValueField = "FunctieReprezID";
            drpFunctiiReprez.DataBind();
            txtHiddenNrFunctii.Value = drpFunctiiReprez.Items.Count.ToString();
        }
Пример #2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Tipurile de completare ale carnetelor de munca.
            Salaries.Business.AdminTipuriCompletareCarnete tipCompletareCarnete = new Salaries.Business.AdminTipuriCompletareCarnete();
            tipCompletareCarnete.AngajatorId = GetAngajator();

            // Lista bancilor.
            Salaries.Business.AdminBanci banci = new Salaries.Business.AdminBanci();

            string[] textTabs = { "Date angajator", "Conturi bancare", "Adresa angajator", "Domenii de activitate", "Punct de lucru" };
            Utilities.CreateHeaderWithTabsForAdminAngajator(tableTabs, textTabs, "../", true);

            settings = Salaries.Configuration.ModuleConfig.GetSettings();

            UtilitiesDb utilDb = new UtilitiesDb(settings.ConnectionString);

            // Sunt facute invizibile textbox-urile
            txtHiddenDomDeActPpID.Style.Add("display", "none");
            txtHiddenDomDeActListID.Style.Add("display", "none");
            txtHiddenPunctLucru.Style.Add("display", "none");

            //Lungu Andreea 28.05.2008
            //este populat dropdownlist-ul ce contine casele de asigurari
            DataSet dsCaseDeAsig = new DataSet();

            Salaries.Business.CasaDeAsigurari casaAsig = new Salaries.Business.CasaDeAsigurari();
            // Lista caselor de asigurari ale unui angajator.
            dsCaseDeAsig = casaAsig.GetAllCasaDeAsigurari();
            drpCaseDeAsigurari.DataSource     = dsCaseDeAsig;
            drpCaseDeAsigurari.DataTextField  = "Denumire";
            drpCaseDeAsigurari.DataValueField = "CasaDeAsigurariID";
            drpCaseDeAsigurari.DataBind();

            //tara
            Salaries.Business.AdminTari tari = new Salaries.Business.AdminTari();
            lstDTara.DataSource     = tari.LoadInfoTariCuJudete();
            lstDTara.DataTextField  = "NumeTara";
            lstDTara.DataValueField = "TaraID";
            lstDTara.DataBind();
            if (txtTaraHidden.Value != "")
            {
                lstDTara.SelectedValue = txtTaraHidden.Value;
            }

            //judetul
            Salaries.Business.AdminJudete judete = new Salaries.Business.AdminJudete();
            judete.TaraId            = int.Parse(lstDTara.SelectedValue);
            lstDJudet.DataSource     = judete.GetAllJudeteTara();
            lstDJudet.DataTextField  = "NumeCompus";
            lstDJudet.DataValueField = "JudetID";
            lstDJudet.DataBind();
            if (txtJudetSectorHidden.Value != "")
            {
                lstDJudet.SelectedValue = txtJudetSectorHidden.Value;
            }

            // Listarea tipurilor de completare a carnetelor de munca.
            lstTipCompletare.DataSource     = tipCompletareCarnete.GetTipuriCompletareCarnete();
            lstTipCompletare.DataTextField  = "ModCompletare";
            lstTipCompletare.DataValueField = "CompletareCarneteValoriID";
            lstTipCompletare.DataBind();

            if (txtTipCompletareHidden.Value != "")
            {
                lstTipCompletare.SelectedValue = txtTipCompletareHidden.Value;
            }

            // Listare banci.
            drpBanci.DataSource     = banci.GetBanci();
            drpBanci.DataTextField  = "NumeBanca";
            drpBanci.DataValueField = "BancaID";
            drpBanci.DataBind();

            // Listare domenii de activitate ale angajatorului
            ListareDomeniiDeActivitate();

            txtTaraHidden.Value          = txtTaraHidden.Value == "" ? lstDTara.SelectedValue : txtTaraHidden.Value;
            txtJudetSectorHidden.Value   = txtJudetSectorHidden.Value == "" ? lstDJudet.SelectedValue : txtJudetSectorHidden.Value;
            txtTipCompletareHidden.Value = txtTipCompletareHidden.Value == "" ? lstTipCompletare.SelectedValue : txtTipCompletareHidden.Value;

            ListareAngajatori();
        }
        /// <summary>
        /// Procedura incarca datele unui angajat
        /// </summary>
        private void LoadAngajatDates()
        {
            // Titlurile ce le pot avea angajatii.
            Salaries.Business.AdminTitluriAngajati titluri = new Salaries.Business.AdminTitluriAngajati();

            // Studiile pe care le pot avea angajatii.
            Salaries.Business.AdminStudii studii = new Salaries.Business.AdminStudii();

            // Tarile din sistem.
            Salaries.Business.AdminTari tari = new Salaries.Business.AdminTari();

            try
            {
                // Se completeaza formularul de editare cu datele din baza de date
                lstTitlu.DataSource     = titluri.LoadInfoTitluriAngajati();
                lstTitlu.DataValueField = "TitluID";
                lstTitlu.DataTextField  = "Denumire";
                lstTitlu.DataBind();

                lstStudiu.DataSource     = studii.LoadInfoStudii();
                lstStudiu.DataValueField = "StudiuID";
                lstStudiu.DataTextField  = "Nume";
                lstStudiu.DataBind();

                lstTaraNastere.DataSource     = tari.LoadInfoTariCuJudete();
                lstTaraNastere.DataTextField  = "NumeTara";
                lstTaraNastere.DataValueField = "TaraID";
                lstTaraNastere.DataBind();

                lstDTara.DataSource     = tari.LoadInfoTariCuJudete();
                lstDTara.DataTextField  = "NumeTara";
                lstDTara.DataValueField = "TaraID";
                lstDTara.DataBind();

                lstRTara.DataSource     = tari.LoadInfoTariCuJudete();
                lstRTara.DataTextField  = "NumeTara";
                lstRTara.DataValueField = "TaraID";
                lstRTara.DataBind();

                BindLstDJudetDDL();
                BindLstRJudetDDL();
                BindLstJudetNastereDDL();
                BindLstNationalitateDDL();

                if (!IsPostBack)
                {
                    BindInvaliditateDDL();
                }

                this.chkLstInvalid.SelectedValue = objAngajat.Invaliditate.ToString();

                txtNume.Text                   = objAngajat.Nume;
                txtPrenume.Text                = objAngajat.Prenume;
                txtNumeAnterior.Text           = objAngajat.NumeAnterior.ToString();
                txtDataSchimbariiNumelui.Text  = Utilities.ConvertDateTime2Text(objAngajat.DataSchimbariiNumelui);
                lstStareCivila.SelectedValue   = objAngajat.StareCivila.ToString();
                txtNrCopii.Text                = objAngajat.NrCopii.ToString();
                lstSex.SelectedValue           = objAngajat.Sex.ToString();
                lstNationalitate.SelectedValue = objAngajat.Nationalitate.ToString();
                lstTitlu.SelectedValue         = objAngajat.TitluId.ToString();
                lstStudiu.SelectedValue        = objAngajat.StudiuId.ToString();
                txtAnAbsolvire.Text            = objAngajat.AnAbsolvire.ToString();
                txtNrDiploma.Text              = objAngajat.NrDiploma;
                txtTelefon.Text                = objAngajat.Telefon;
                txtDescriere.Text              = objAngajat.Descriere;
                txtCNP.Text          = objAngajat.CNP.ToString();
                txtCNPAnterior.Text  = objAngajat.CNPAnterior.ToString();
                txtDataNasterii.Text = Utilities.ConvertDateTime2Text(objAngajat.DataNasterii);
                if (objAngajat.TaraNastereId != 0)
                {
                    lstTaraNastere.SelectedValue = TaraNastereHidden.Value == "" ? objAngajat.TaraNastereId.ToString() : TaraNastereHidden.Value;
                }
                if (objAngajat.JudetNastereId != 0)
                {
                    BindLstJudetNastereDDL();
                    lstJudetNastere.SelectedValue = JudetNastereHidden.Value == "" ? objAngajat.JudetNastereId.ToString() : JudetNastereHidden.Value;
                }
                txtLocalitateNastere.Text = objAngajat.LocalitateNastere;
                txtPrenumeMama.Text       = objAngajat.PrenumeMama;
                txtPrenumeTata.Text       = objAngajat.PrenumeTata;

                if (objAngajat.DTara != 0)
                {
                    lstDTara.SelectedValue = DTaraHidden.Value == "" ? objAngajat.DTara.ToString() : DTaraHidden.Value;
                }
                if (objAngajat.DJudetSectorId != 0)
                {
                    BindLstDJudetDDL();
                    lstDJudetSector.SelectedValue = DJudetSectorHidden.Value == "" ? objAngajat.DJudetSectorId.ToString() : DJudetSectorHidden.Value;
                }
                txtDLocalitate.Text = objAngajat.DLocalitate;
                txtDStrada.Text     = objAngajat.DStrada;
                txtDNumar.Text      = objAngajat.DNumar;
                txtDCodPostal.Text  = objAngajat.DCodPostal.ToString();
                txtDBloc.Text       = objAngajat.DBloc;
                txtDScara.Text      = objAngajat.DScara;
                txtDEtaj.Text       = objAngajat.DEtaj;
                txtDApartament.Text = objAngajat.DApartament;

                if (objAngajat.RTara != 0)
                {
                    lstRTara.SelectedValue = RTaraHidden.Value == "" ? objAngajat.RTara.ToString() : RTaraHidden.Value;
                }
                if (objAngajat.RJudetSectorId != 0)
                {
                    BindLstRJudetDDL();
                    lstRJudetSector.SelectedValue = RJudetSectorHidden.Value == "" ? objAngajat.RJudetSectorId.ToString() : RJudetSectorHidden.Value;
                }
                txtRLocalitate.Text = objAngajat.RLocalitate;
                txtRStrada.Text     = objAngajat.RStrada;
                txtRNumar.Text      = objAngajat.RNumar;
                txtRCodPostal.Text  = objAngajat.RCodPostal.ToString();
                txtRBloc.Text       = objAngajat.RBloc;
                txtRScara.Text      = objAngajat.RScara;
                txtREtaj.Text       = objAngajat.REtaj;
                txtRApartament.Text = objAngajat.RApartament;

                DTaraHidden.Value        = DTaraHidden.Value == "" ? lstDTara.SelectedValue : DTaraHidden.Value;
                RTaraHidden.Value        = RTaraHidden.Value == "" ? lstRTara.SelectedValue : RTaraHidden.Value;
                TaraNastereHidden.Value  = TaraNastereHidden.Value == "" ? lstTaraNastere.SelectedValue : TaraNastereHidden.Value;
                DJudetSectorHidden.Value = DJudetSectorHidden.Value == "" ? lstDJudetSector.SelectedValue : DJudetSectorHidden.Value;
                RJudetSectorHidden.Value = RJudetSectorHidden.Value == "" ? lstRJudetSector.SelectedValue : RJudetSectorHidden.Value;
                JudetNastereHidden.Value = JudetNastereHidden.Value == "" ? lstJudetNastere.SelectedValue : JudetNastereHidden.Value;

                CreateVarJavaScript();
            }
            catch (Exception ex)
            {
                litError.Text  = "The following error occurred: <br>";
                litError.Text += ex.Message;
            }
        }