// проверка даты private void tDateD_p_Validating(object sender, CancelEventArgs e) { string sD = ((TextBox)sender).Text.Trim(); if (sD.Length > 0) { try { sD = Srv.SimpleDateTime(sD); DateTime d = DateTime.ParseExact(sD, "dd.MM.yy", null); xDP.dDatDoc = d; ((TextBox)sender).Text = sD; } catch { e.Cancel = true; } } else { xDP.dDatDoc = DateTime.MinValue; } //if (e.Cancel != true) // e.Cancel = !ServClass.TryEditNextFiled((Control)sender, nCurEditCommand, aEdVvod); }
// дата выработки private void tDTV_Validating(object sender, CancelEventArgs e) { if (bInScanProceed) { return; } string sT = ((TextBox)sender).Text.Trim(); if (sT.Length > 0) { try { sT = Srv.SimpleDateTime(sT, Smena.DateDef); DateTime d = DateTime.ParseExact(sT, "dd.MM.yy", null); xMark.ScanFirst.dDataIzg = d; xMark.ScanFirst.sDataIzg = sT; ((TextBox)sender).Text = sT; } catch { e.Cancel = true; } } else { xMark.ScanFirst.dDataIzg = DateTime.MinValue; } //if (e.Cancel || (xMark.ScanFirst.dDataIzg == DateTime.MinValue)) //{ // bSetByHand = false; //} }
// проверка даты private void tDefDateDoc_Validating(object sender, CancelEventArgs e) { string sD = tDefDateDoc.Text.Trim(); if (sD.Length > 0) { try { sD = Srv.SimpleDateTime(sD); ((TextBox)sender).Text = sD; } catch { e.Cancel = true; } } }
// проверка даты private void tDateD_p_Validating(object sender, CancelEventArgs e) { string sD = ((TextBox)sender).Text.Trim(); if (sD.Length > 0) { try { sD = Srv.SimpleDateTime(sD, Smena.DateDef); DateTime d = DateTime.ParseExact(sD, "dd.MM.yy", null); xDP.dDatDoc = d; ((TextBox)sender).Text = sD; } catch { e.Cancel = true; } } else { xDP.dDatDoc = DateTime.MinValue; } }