/// <summary> /// Sterge o carte de identitate /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStergeDate_Click(object sender, System.EventArgs e) { try { int carteIdentiateId = Convert.ToInt32(txtCarteIdentitateIDHidden.Value); Salaries.Business.IstoricCartiIdentitate istCI = new Salaries.Business.IstoricCartiIdentitate(); istCI.CarteIdentitateId = carteIdentiateId; if (!chkActiv.Checked) { istCI.DeleteCarteIdentitate(); } else { Response.Write("<script>alert( 'Nu se poate sterge o carte de identitate activa!' )</script>"); } } catch (Exception ex) { litError.Text = "The following error occurred: <br>"; litError.Text += ex.Message; } LoadIstoricCartiIdentitate(); }
/// <summary> /// Listeaza cartile de identitate /// </summary> private void LoadIstoricCartiIdentitate() { 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.IstoricCartiIdentitate istCI = new Salaries.Business.IstoricCartiIdentitate(); istCI.AngajatId = AngajatID; string[] arHeader = { "CNP", "CNP anterior", "Serie", "Numar", "Eliberat de", "Data eliberare", "Valabil pana la", "Activ" }; string[] arCols = { "CNP", "CNPAnterior", "Serie", "Numar", "EliberatDe", "DataEliberarii", "ValabilPanaLa", "Activ" }; ListTable objListTable = new ListTable(listTable, istCI.LoadIstoricCartiIdentitate(), arHeader, arCols); objListTable.textForEmptyDataSet = "Nu exista nici o carte de identitate asociata acestui angajat!"; string[] ar_OnClickParam = { AngajatID.ToString(), "CarteIdentitateID", "CNP", "CNPAnterior", "Serie", "Numar", "EliberatDe", "DataEliberarii", "ValabilPanaLa", "Activ" }; string[] ar_OnClickParamType = { "const", "dataset", "dataset", "dataset", "dataset", "dataset", "dataset", "dataset", "dataset", "dataset" }; objListTable.OnclickParams = ar_OnClickParam; objListTable.OnclickParamsType = ar_OnClickParamType; objListTable.OnclickJSMethod = "SelectCarteIdentitate"; objListTable.DrawListTableWithoutDigits(); } catch (Exception ex) { litError.Text = "The following error occurred: <br>"; litError.Text += ex.Message; } }
/// <summary> /// Modifica o carte de identitate /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnModificaDate_Click(object sender, System.EventArgs e) { try { int CarteIdentitateID = Convert.ToInt32(txtCarteIdentitateIDHidden.Value); long CNP = 0; try { CNP = long.Parse(txtCNP.Text); } catch {} long CNPAnterior = 0; try { CNPAnterior = long.Parse(txtCNPAnterior.Text); } catch {} string serie = txtCISerie.Text; string numar = txtCINumar.Text; // long numar = 0; // try // { // numar = Convert.ToInt64( txtCINumar.Text ); // } // catch{} string eliberatDe = txtCIEliberatDe.Text; DateTime dataEliberarii = Utilities.ConvertText2DateTime(txtCIDataEliberarii.Text); DateTime valabilPanaLa = Utilities.ConvertText2DateTime(txtCIValabilPanaLa.Text); bool activ = chkActiv.Checked; Salaries.Business.IstoricCartiIdentitate istCI = new Salaries.Business.IstoricCartiIdentitate(); istCI.CarteIdentitateId = CarteIdentitateID; istCI.AngajatId = AngajatID; istCI.CNP = CNP; istCI.CNPAnterior = CNPAnterior; istCI.Serie = serie; istCI.Numar = numar; istCI.EliberatDe = eliberatDe; istCI.DataEliberarii = dataEliberarii; istCI.ValabilPanaLa = valabilPanaLa; istCI.Activ = activ; if (!istCI.UpdateCarteIdentitate()) { Response.Write("<script>alert( 'Modificarea nu a fost facuta, deoarece mai exista o carte de identitate cu aceleasi date!' )</script>"); } else { LoadIstoricCartiIdentitate(); } } catch (Exception ex) { litError.Text = "The following error occurred: <br>"; litError.Text += ex.Message; } }