// проверка получателя private void tKPol_p_Validating(object sender, CancelEventArgs e) { NSI.RezSrch zS; string sT = ((TextBox)sender).Text.Trim(), sN = ""; if (sT.Length > 0) { try { int nK = int.Parse(sT); if (xDP.nTypD == AppC.TYPD_OPR) { sN = DocPars.OPRName(ref nK); xDP.TypOper = nK; } else if (xDP.TypOper != AppC.TYPOP_KMPL) { zS = xNSI.GetNameSPR((xDP.nTypD == AppC.TYPD_VPER) ? NSI.NS_SKLAD : NSI.NS_PP, new object[] { nK }, "NAME"); sN = zS.sName; } else { } tNPol_p.Text = sN; tKPol_p.Text = sT; xDP.nPol = nK; xDP.sPol = sN; } catch { e.Cancel = true; } } else { xDP.nPol = AppC.EMPTY_INT; xDP.sPol = ""; } //if (e.Cancel != true) // e.Cancel = !ServClass.TryEditNextFiled((Control)sender, nCurEditCommand, aEdVvod); }
// сброс/установка полей ввода/вывода private void SetParFields(DocPars xDP) { int n = xDP.nTypD; string sIS; DocPars.tKTyp.Text = (n == AppC.EMPTY_INT) ? "" : xDP.nTypD.ToString(); sIS = DocPars.TypDName(n); DocPars.tNTyp.Text = (sIS.Length > 0) ? sIS : "<Неизвестный>"; xDP.sTypD = DocPars.tNTyp.Text; tSm_p.Text = xDP.sSmena; tDateD_p.Text = DateTime.Now.ToString("dd.MM.yy"); if (xDP.dDatDoc != DateTime.MinValue) { tDateD_p.Text = xDP.dDatDoc.ToString("dd.MM.yy"); } tKSkl_p.Text = ""; tNSkl_p.Text = ""; if (xDP.nSklad != AppC.EMPTY_INT) { tKSkl_p.Text = xDP.nSklad.ToString(); NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_SKLAD, new object[] { xDP.nSklad }, "NAME"); if (zS.bFind == true) { tNSkl_p.Text = zS.sName; xDP.sSklad = zS.sName; } } tKUch_p.Text = ""; if ((xDP.nUch != AppC.EMPTY_INT) && (xDP.nUch != 0)) { tKUch_p.Text = xDP.nUch.ToString(); } tNom_p.Text = xDP.sNomDoc; tKEks_p.Text = ""; tNEks_p.Text = ""; if (xDP.nEks != AppC.EMPTY_INT) { tKEks_p.Text = xDP.nEks.ToString(); if (xDP.TypOper != AppC.TYPOP_KMPL) { NSI.RezSrch zS = xNSI.GetNameSPR(NSI.NS_EKS, new object[] { xDP.nEks }, "FIO"); if (zS.bFind == true) { tNEks_p.Text = zS.sName; xDP.sEks = zS.sName; } } else { tNEks_p.Text = xDP.sEks; } } else { xDP.sEks = ""; } tKPol_p.Text = ""; tNPol_p.Text = ""; if (xDP.nPol != AppC.EMPTY_INT) { tKPol_p.Text = xDP.nPol.ToString(); if (xDP.nTypD == AppC.TYPD_OPR) { sIS = DocPars.OPRName(ref xDP.nPol); } else if (xDP.TypOper != AppC.TYPOP_KMPL) { NSI.RezSrch zS = xNSI.GetNameSPR((xDP.nTypD == AppC.TYPD_VPER) ? NSI.NS_SKLAD : NSI.NS_PP, new object[] { xDP.nPol }, "NAME"); sIS = zS.sName; } else { sIS = xDP.sPol; } tNPol_p.Text = sIS; xDP.sPol = sIS; } else { xDP.sPol = ""; } SetTime2Load(); }