Example #1
0
        /// <summary>
        /// Adauga un departament
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdaugaDepartament_Click(object sender, System.EventArgs e)
        {
            try
            {
                Salaries.Business.IstoricDepartament istDept = new Salaries.Business.IstoricDepartament();
                istDept.AngajatId     = AngajatID;
                istDept.DepartamentId = Convert.ToInt32(lstDepartament.SelectedValue);
                istDept.DataStartNoua = Utilities.ConvertText2DateTime(txtDataStart.Text);

                if (istDept.CheckIfDepartamentCanBeAdded())
                {
                    istDept.InsertDepartament();
                    lstDepartament.SelectedIndex = 0;
                    txtDataStart.Text            = "";
                }
                else
                {
                    Response.Write("<script> alert('Pentru aceasta data exista deja un departament!'); </script>");
                }
            }
            catch (Exception ex)
            {
                litError.Text  = "The following error occurred: <br>";
                litError.Text += ex.Message;
            }

            LoadFormIstoricDepartamente();
        }
Example #2
0
        /// <summary>
        /// Sterge un departament
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnStergeDate_Click(object sender, System.EventArgs e)
        {
            try
            {
                Salaries.Business.IstoricDepartament istDept = new Salaries.Business.IstoricDepartament();
                istDept.AngajatId      = AngajatID;
                istDept.DepartamentId  = Convert.ToInt32(lstDepartament.SelectedValue);
                istDept.DataStartNoua  = Utilities.ConvertText2DateTime(txtDataStart.Text);
                istDept.DataStartVeche = Utilities.ConvertText2DateTime(Request.Form["old_DataStart"].ToString());

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

            LoadFormIstoricDepartamente();
        }
Example #3
0
        /// <summary>
        /// Listeaza departamentele angajatului
        /// </summary>
        private void LoadFormIstoricDepartamente()
        {
            try
            {
                listTable.Rows.Clear();
                lstDepartament.Items.Clear();

                settings = Salaries.Configuration.ModuleConfig.GetSettings();
                UtilitiesDb utilDb = new UtilitiesDb(settings.ConnectionString);
                utilDb.CreateDepartamenteSelectBox(0, 0, lstDepartament);

                listTable.Attributes.Add("width", "100%");
                listTable.Style.Add("border", "1px solid #20b2aa");
                listTable.Attributes.Add("cellpadding", "0");
                listTable.Attributes.Add("cellspacing", "1");

                Salaries.Business.IstoricDepartament istDept = new Salaries.Business.IstoricDepartament();
                istDept.AngajatId = AngajatID;

                string[]  arHeader     = { "Departament", "Data start" };
                string[]  arCols       = { "DenumireCompleta", "DataStart" };
                ListTable objListTable = new ListTable(listTable, istDept.LoadIstoricDepartament(), arHeader, arCols);
                objListTable.textForEmptyDataSet = "Nu exista nici un departament asociat acestui angajat!";

                string[] ar_OnClickParam     = { "DepartamentID", "DataStart", AngajatID.ToString() };
                string[] ar_OnClickParamType = { "dataset", "dataset", "const" };

                objListTable.OnclickParams     = ar_OnClickParam;
                objListTable.OnclickParamsType = ar_OnClickParamType;
                objListTable.OnclickJSMethod   = "SelectDepartament";

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