/// <summary> /// Listeaza NIF-urile unui angajat /// </summary> private void LoadIstoricNIFuri() { try { listTable.Rows.Clear(); listTable.Attributes.Add("width", "100%"); listTable.Style.Add("border","1px solid #20b2aa"); listTable.Attributes.Add("cellpadding", "0"); listTable.Attributes.Add("cellspacing", "1"); Salaries.Business.IstoricNIF istNIF = new Salaries.Business.IstoricNIF(); istNIF.AngajatId = AngajatID; string[] arHeader = { "Numar", "Activ"}; string[] arCols = { "NIF", "Activ"}; ListTable objListTable = new ListTable(listTable, istNIF.LoadIstoricNIFuri(), arHeader, arCols); objListTable.textForEmptyDataSet= "Nu exista nici un NIF asociat acestui angajat!"; string[] ar_OnClickParam = { AngajatID.ToString(), "NIFID", "NIF", "Activ" }; string[] ar_OnClickParamType = { "const", "dataset", "dataset", "dataset" }; objListTable.OnclickParams = ar_OnClickParam; objListTable.OnclickParamsType = ar_OnClickParamType; objListTable.OnclickJSMethod = "SelectNIF"; objListTable.DrawListTableWithoutDigits(); } catch(Exception ex) { litError.Text = "The following error occurred: <br>"; litError.Text += ex.Message; } }
/// <summary> /// Sterge un NIF /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStergeDate_Click(object sender, System.EventArgs e) { try { Salaries.Business.IstoricNIF istNIF = new Salaries.Business.IstoricNIF(); istNIF.NifId = Convert.ToInt32(txtNIFIDHidden.Value); istNIF.DeleteNIF(); } catch(Exception ex) { litError.Text = "The following error occurred: <br>"; litError.Text += ex.Message; } LoadIstoricNIFuri(); }
/// <summary> /// Modifica un NIF /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnModificaDate_Click(object sender, System.EventArgs e) { try { Salaries.Business.IstoricNIF istNIF = new Salaries.Business.IstoricNIF(); istNIF.NifId = Convert.ToInt32(txtNIFIDHidden.Value); istNIF.AngajatId = AngajatID; istNIF.NIF = txtNrNIF.Text; istNIF.Activ = chkActiv.Checked; if( !istNIF.UpdateNIF() ) { Response.Write( "<script>alert( 'Modificarea nu a fost facuta, deoarece numarul introdus este asociat altui NIF!' )</script>" ); } } catch(Exception ex) { litError.Text = "The following error occurred: <br>"; litError.Text += ex.Message; } LoadIstoricNIFuri(); }
/// <summary> /// Adauga un NIF /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdaugaNIF_Click(object sender, System.EventArgs e) { try { Salaries.Business.IstoricNIF istNIF = new Salaries.Business.IstoricNIF(); istNIF.NifId = 0; istNIF.AngajatId = AngajatID; istNIF.NIF = txtNrNIF.Text; istNIF.Activ = chkActiv.Checked; if( !istNIF.InsertNIF() ) { Response.Write( "<script>alert( 'Adaugarea nu a fost facuta, deoarece acest NIF exista deja!' )</script>" ); } } catch(Exception ex) { litError.Text = "The following error occurred: <br>"; litError.Text += ex.Message; } LoadIstoricNIFuri(); }