/// <summary> /// Actualizeaza un interval de intrerupere /// </summary> /// <param name="DataStart"></param> /// <param name="DataEnd"></param> /// <param name="descriere"></param> /// <param name="tipActiune"></param> /// <param name="IntervalID"></param> /// <param name="iia"></param> private void UpdateIntervalIntreruperiPosibil(DateTime DataStart, DateTime DataEnd, string descriere, int tipActiune, int IntervalID, IntervaleIntreruperiAngajat iia) { //dovle DataSet ds = iia.GetIntervalIntreruperiAngajatByID(IntervalID); if (ds.Tables[0].Rows.Count > 0 && ds != null) { if ((DateTime)ds.Tables[0].Rows[0]["DataEnd"] > DataEnd) { new IntervaleAngajat(this.AngajatID).RestoreIntervaleAngajatPerioadaSterseTemporar(DataEnd.AddDays(1), (DateTime)ds.Tables[0].Rows[0]["DataEnd"]); } if ((DateTime)ds.Tables[0].Rows[0]["DataStart"] < DataStart) { new IntervaleAngajat(this.AngajatID).RestoreIntervaleAngajatPerioadaSterseTemporar((DateTime)ds.Tables[0].Rows[0]["DataStart"], DataStart.AddDays(-1)); } } iia.UpdateIntervalIntreruperiAngajat(IntervalID, DataStart, DataEnd, descriere); }
/// <summary> /// Sterge o intrerupere CIM /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnStergeDate_Click(object sender, System.EventArgs e) { ErrHandler.MyErrHandler.WriteError("IstoricSuspendariCIM.ascx - start - StergeSuspendare() - angID: " + AngajatID + " - " + txtDataStart.Text + " - " + txtDataEnd.Text); DateTime dataStart = SiemensTM.utils.Utilities.ConvertText2DateTime(DateStart.Value); DateTime dataEnd = SiemensTM.utils.Utilities.ConvertText2DateTime(DateEnd.Value); string observatii = txtObservatii.Text; int intrerupereId = Convert.ToInt32(txtIntrerupereID.Value); IntervaleIntreruperiAngajat iia = new IntervaleIntreruperiAngajat(this.AngajatID); DataSet ds = iia.GetIntervalIntreruperiAngajatByID(intrerupereId); if (ds.Tables[0].Rows.Count > 0 && ds != null) { if ((DateTime)ds.Tables[0].Rows[0]["DataStart"] < dataStartLunaActiva) { new IntervaleAngajat(this.AngajatID).RestoreIntervaleAngajatPerioadaSterseTemporar(dataStartLunaActiva, (DateTime)ds.Tables[0].Rows[0]["DataEnd"]); DateTime dataEndInt = dataStartLunaActiva.AddDays(-1); iia.UpdateIntervalIntreruperiAngajat(intrerupereId, (DateTime)ds.Tables[0].Rows[0]["DataStart"], dataEndInt, ds.Tables[0].Rows[0]["Descriere"].ToString()); } else { new IntervaleAngajat(this.AngajatID).RestoreIntervaleAngajatPerioadaSterseTemporar((DateTime)ds.Tables[0].Rows[0]["DataStart"], (DateTime)ds.Tables[0].Rows[0]["DataEnd"]); iia.DeleteIntervalIntreruperiAngajat(intrerupereId); } } else { iia.DeleteIntervalIntreruperiAngajat(intrerupereId); } string [][] tmp = GetOreLucrateIntervaleSpecialeLuna(); RedistribuireOreSuplimentareLunaAngajat(tmp); LoadIstoricSuspendariCIM(); this.txtDataStart.Text = ""; this.txtDataEnd.Text = ""; ErrHandler.MyErrHandler.WriteError("IstoricSuspendariCIM.ascx - end - StergeSuspendare() - angID: " + AngajatID); }