Exemplo n.º 1
0
 //////////////////////////////
 #region id-uri pentru tip absenta
 private void GetIdTipAbsente()
 {
     //tip absenta - cod absenta
     Salaries.Business.NomenclatorTipAbsente tipAbs = new Salaries.Business.NomenclatorTipAbsente();
     Salaries.Data.TipAbsente[] sirTipuri           = tipAbs.GetDetaliiTipuriAbsente();
     foreach (Salaries.Data.TipAbsente item in sirTipuri)
     {
         if (item.CodAbsenta.Equals("CM"))
         {
             idCM = item.TipAbsentaID;
         }
         if (item.CodAbsenta.Equals("CCM"))
         {
             idCCM = item.TipAbsentaID;
         }
         if (item.CodAbsenta.Equals("CO"))
         {
             idCO = item.TipAbsentaID;
         }
         if (item.CodAbsenta.Equals("COA"))
         {
             idCOA = item.TipAbsentaID;
         }
     }
 }
        /// <summary>
        ///		Metoda care se apeleaza cand se doreste adaugarea unei noi boli sau
        ///		editarea uneia existente.
        /// </summary>
        private void btnEdit_Click(object sender, System.EventArgs e)
        {
            this.EditMode  = true;
            this.VarExists = new Salaries.Business.NomenclatorTipAbsente().GetTipuriAbsente(int.Parse(this.txtTipAbsentaID.Text)).Tables[0].Rows.Count > 0;

            try
            {
                if (this.VarExists)
                {
                    EnableSomeControls(false);
                    int tipAbsentaID = Convert.ToInt32(this.txtTipAbsentaID.Text);
                    Salaries.Data.TipAbsente tipAbs = new Salaries.Business.NomenclatorTipAbsente().GetDetaliiTipuriAbsente(int.Parse(this.txtTipAbsentaID.Text));

                    this.txtDenumireTipAbsenta.Text       = tipAbs.Denumire;
                    this.labelDenumireTipAbsenta.Text     = tipAbs.Denumire;
                    this.txtCodTipAbsenta.Text            = tipAbs.CodAbsenta;
                    this.labelCodTipAbsenta.Text          = tipAbs.CodAbsenta;
                    this.txtProcentTipAbsenta.Text        = tipAbs.Procent.ToString();
                    this.txtDescriereTipAbsenta.Text      = tipAbs.Descriere;
                    this.cbMedicalTipAbsenta.Checked      = tipAbs.Medical;
                    this.cbModificabilaTipAbsenta.Checked = tipAbs.Modificare;
                    this.cbFolosireTipAbsenta.Checked     = tipAbs.Folosire;
                    this.cbAbsentaLucratoare.Checked      = tipAbs.Lucratoare;
                    this.btnSterge.Visible = true;
                }
                else
                {
                    EnableSomeControls(true);

                    this.txtDenumireTipAbsenta.Text       = "";
                    this.txtCodTipAbsenta.Text            = "";
                    this.txtProcentTipAbsenta.Text        = "0";
                    this.txtDescriereTipAbsenta.Text      = "";
                    this.cbMedicalTipAbsenta.Checked      = false;
                    this.cbModificabilaTipAbsenta.Checked = false;
                    this.cbFolosireTipAbsenta.Checked     = true;
                    this.cbAbsentaLucratoare.Checked      = false;
                }
                list_form.Style.Add("display", "none");
                add_form.Style.Add("display", "");
                btnSalveaza.Visible = true;
                btnSterge.Visible   = false;
                btnInapoi.Visible   = true;

                this.btnSalveaza.Enabled = true;

                Utilities.CreateTableHeader(add_header, "Nomenclator tipuri de absente", "../", "small");
            }
            catch (Exception ex)
            {
                litError.Text  = "The following error occurred: <br>";
                litError.Text += ex.Message;
            }
        }
        /// <summary>
        /// Returneaza datele necesare pentru popularea ComboBoxului aferent tipurilor
        /// de absente.
        /// </summary>
        /// <param name="listObj"> ComboBox-ul ce trebuie populat.</param>
        /// <remarks>
        /// Modificari:
        /// Autor: Cristina Raluca Muntean
        /// Data: 29.06.2006
        /// Descriere: Se apeleaza metoda GetTipuriAbsenteLuna din clasa NomenclatorTipAbsente.
        /// </remarks>
        public void CreateTipAbsenteSelectBox(DropDownList listObj)
        {
            Salaries.Business.NomenclatorTipAbsente tipAbsente = new Salaries.Business.NomenclatorTipAbsente();
            // DataSet-ul ce contine tipurile de absente aferente lunii curente.
            // Exista absente, cum ar fi concediul de odihna de pe anul precedent, care
            // trebuie sa apara doar in luna ianuarie.
            DataSet   dsTipAbsente = tipAbsente.GetTipuriAbsenteLunaCurenta();
            DataTable dataTable    = new DataTable();

            dataTable = dsTipAbsente.Tables[0];
            listObj.Items.Clear();

            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                DataRow  myRow    = dataTable.Rows[i];
                ListItem listItem = new ListItem(myRow["Denumire"].ToString(), myRow["TipAbsentaID"].ToString());
                listObj.Items.Add(listItem);
            }
        }
        /// <summary>
        /// Procedura seteaza vizibilitatea campurilor in functie de tipul actiunii executate
        /// </summary>
        /// <param name="adaugare">True daca este adaugare si false altfel</param>
        private void EnableSomeControls(bool adaugare)
        {
            if (!adaugare)
            {
                Salaries.Data.TipAbsente tipAbs = new Salaries.Business.NomenclatorTipAbsente().GetDetaliiTipuriAbsente(int.Parse(this.txtTipAbsentaID.Text));
                if (tipAbs.Modificare)
                {
                    this.labelDenumireTipAbsenta.Visible = false;
                    this.txtDenumireTipAbsenta.Visible   = true;

                    this.labelCodTipAbsenta.Visible = false;
                    this.txtCodTipAbsenta.Visible   = true;

                    this.cbModificabilaTipAbsenta.Enabled = true;
                }
                else
                {
                    this.labelDenumireTipAbsenta.Visible = true;
                    this.txtDenumireTipAbsenta.Visible   = false;

                    this.labelCodTipAbsenta.Visible = true;
                    this.txtCodTipAbsenta.Visible   = false;

                    this.cbModificabilaTipAbsenta.Enabled = false;
                }
            }
            else
            {
                labelDenumireTipAbsenta.Visible    = false;
                this.txtDenumireTipAbsenta.Visible = true;

                this.labelCodTipAbsenta.Visible = false;
                this.txtCodTipAbsenta.Visible   = true;

                this.cbModificabilaTipAbsenta.Enabled = true;
            }
        }
Exemplo n.º 5
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            CreateJavascriptVar();
            lunaID = this.GetCurrentMonth();
            Salaries.Business.Luni l = new Salaries.Business.Luni(this.GetAngajator(), lunaID);
            this.dataStartLunaActiva = l.Data;
            this.dataEndLunaActiva   = dataStartLunaActiva.AddMonths(1).AddDays(-1);
            angajatorID = this.GetAngajator();
            Salaries.Business.Luni salLuni = new Salaries.Business.Luni(angajatorID);
            lunaActiva = salLuni.GetLunaActiva().LunaId;

            /*if (ButtonImport.Value.Equals("Import pontaj"))
             *      tdTemplate.InnerHtml = "<a target=_blank href='Templates\\TemplatePontaj.xls'>template pontaj</a>";
             * else
             *      tdTemplate.InnerHtml = "<a target=_blank href='Templates\\TemplateSituatieLunara.xls'>template situatie lunara</a>";*/
            actionImportDelegatiiLuna = ((System.Web.UI.HtmlControls.HtmlInputHidden)Page.FindControl("ActionImportDelegatiiLunaValue")).Value;

            Salaries.Business.NomenclatorTipAbsente tipAbs = new Salaries.Business.NomenclatorTipAbsente();
            sirTipuri = tipAbs.GetDetaliiTipuriAbsente();

            //user-ul loginat
            user = new WindowsPrincipal(WindowsIdentity.GetCurrent());

            if (!IsPostBack)
            {
                lblMesajImport.Text = "";
            }
            else
            {
            }
            System.IO.StreamWriter swRez = new System.IO.StreamWriter(Server.MapPath("Templates\\RezultateImport.txt"), false);
            swRez.WriteLine();
            swRez.Close();

            GetIdTipAbsente();
            HandleActions();
        }