private void cbReceiverKO_Validating(object sender, CancelEventArgs e) { //Если БИК и КО оба заполнены, то они должны соответствовать друг другу if (!string.IsNullOrEmpty(cbReceiverBIK.Text) && !string.IsNullOrEmpty(cbReceiverKO.Text) && LookupList.LookupNewNum(cbReceiverBIK.Text, "KSNP") != cbReceiverKO.Text) { e.Cancel = true; errReceiverKO.SetError(cbReceiverKO, "КО получателя не соответсвтвует БИК получателя"); } else { errReceiverKO.SetError(cbReceiverKO, ""); } }
private void cbReceiverBIK_Validating(object sender, CancelEventArgs e) { if (string.IsNullOrEmpty(cbReceiverBIK.Text)) { e.Cancel = true; errReceiverBIK.SetError(cbReceiverBIK, "Данное поле должно быть заполненным"); } else if (string.IsNullOrEmpty(LookupList.LookupNewNum(cbReceiverBIK.Text, "NEWNUM"))) { e.Cancel = true; errReceiverBIK.SetError(cbReceiverBIK, "Введен несуществующий БИК"); } else { errReceiverBIK.SetError(cbReceiverBIK, ""); } }
private void cbSenderBIK_SelectedIndexChanged(object sender, EventArgs e) { cbSenderKO.Text = LookupList.LookupNewNum(cbSenderBIK.Text, "KSNP"); txtSenderKOName.Text = LookupList.LookupNewNum(cbSenderBIK.Text, "NAMEP"); }
//Настройка биндингов private void InitBindList() { cbSenderBIK.DataBindings.Add("Text", bs_main, "SENDER_BIK"); cbSenderKO.DataBindings.Add("Text", bs_main, "SENDER_KO"); txtSenderBill.DataBindings.Add("Text", bs_main, "SENDER_BILL"); cbReceiverBIK.DataBindings.Add("Text", bs_main, "RECEIVER_BIK"); cbReceiverKO.DataBindings.Add("Text", bs_main, "RECEIVER_KO"); txtReceiverBill.DataBindings.Add("Text", bs_main, "RECEIVER_BILL"); cbReceiverKO.DataSource = LookupList.GetNewLookupBS("KSNP is not null"); cbReceiverKO.ValueMember = "KSNP"; cbReceiverKO.DisplayMember = "KSNP"; cbReceiverBIK.DataSource = LookupList.GetNewLookupBS(); cbReceiverBIK.ValueMember = "NEWNUM"; cbReceiverBIK.DisplayMember = "NEWNUM"; cbSenderBIK.DataSource = LookupList.GetNewLookupBS(); cbSenderBIK.ValueMember = "NEWNUM"; cbSenderBIK.DisplayMember = "NEWNUM"; cbSenderKO.DataSource = LookupList.GetNewLookupBS("KSNP is not null"); cbSenderKO.ValueMember = "KSNP"; cbSenderKO.DisplayMember = "KSNP"; txtNum.DataBindings.Add("Text", bs_main, "NUM", false); Binding b_CreateDate = new Binding("Value", bs_main, "CREATE_DATE", true); dtpCreatedDate.DataBindings.Add(b_CreateDate); b_CreateDate.Format += new ConvertEventHandler(CommonUtils.dtpPicker_Format); b_CreateDate.Parse += new ConvertEventHandler(CommonUtils.dtpPicker_Parse); cbItemType.DataBindings.Add("Text", bs_main, "PAYMENT_TYPE"); cbOperationType.DataBindings.Add("Text", bs_main, "OPERATION_TYPE"); txtRDNum.DataBindings.Add("Text", bs_main, "RD_NUM"); Binding b_RDDate = new Binding("Value", bs_main, "RD_DATE", true); b_RDDate.Format += new ConvertEventHandler(CommonUtils.dtpPicker_Format); b_RDDate.Parse += new ConvertEventHandler(CommonUtils.dtpPicker_Parse); dtpRDDate.DataBindings.Add(b_RDDate); Binding b_RDSum = new Binding("Text", bs_main, "RD_SUM", true); b_RDSum.Format += new ConvertEventHandler(CommonUtils.rdSum_Format); b_RDSum.Parse += new ConvertEventHandler(CommonUtils.rdSum_Parse); txtRDSum.DataBindings.Add(b_RDSum); txtKPD.DataBindings.Add("Text", bs_main, "KPD"); Binding b_KPDDate = new Binding("Value", bs_main, "KPD_DATE", true); dtpKPDDate.DataBindings.Add(b_KPDDate); b_KPDDate.Format += new ConvertEventHandler(CommonUtils.dtpPicker_Format); b_KPDDate.Parse += new ConvertEventHandler(CommonUtils.dtpPicker_Parse); Binding b_offDate = new Binding("Value", bs_main, "OFF_DATE", true); dtpOffDate.DataBindings.Add(b_offDate); b_offDate.Format += new ConvertEventHandler(CommonUtils.dtpPicker_Format); b_offDate.Parse += new ConvertEventHandler(CommonUtils.dtpPicker_Parse); txtSenderINN.DataBindings.Add("Text", bs_main, "SENDER_INN"); txtSenderKPP.DataBindings.Add("Text", bs_main, "SENDER_KPP"); txtSenderName.DataBindings.Add("Text", bs_main, "SENDER_NAME"); txtSenderKOName.DataBindings.Add("Text", bs_main, "SENDER_KO_NAME"); txtReceiverINN.DataBindings.Add("Text", bs_main, "RECEIVER_INN"); txtReceiverKPP.DataBindings.Add("Text", bs_main, "RECEIVER_KPP"); txtReceiverName.DataBindings.Add("Text", bs_main, "RECEIVER_NAME"); txtReceiverKOName.DataBindings.Add("Text", bs_main, "RECEIVER_KO_NAME"); txtPaymentGoal.DataBindings.Add("Text", bs_main, "PAYMENT_GOAL"); txt101.DataBindings.Add("Text", bs_main, "N101"); txt104.DataBindings.Add("Text", bs_main, "N104"); txt105.DataBindings.Add("Text", bs_main, "N105"); txt106.DataBindings.Add("Text", bs_main, "N106"); txt107.DataBindings.Add("Text", bs_main, "N107"); txt108.DataBindings.Add("Text", bs_main, "N108"); txt109.DataBindings.Add("Text", bs_main, "N109"); txt110.DataBindings.Add("Text", bs_main, "N110"); }
public override bool PrintCurrent(BindingSource bs, string result_file) { DataRowView row = (DataRowView)bs.Current; List <Tuple <string, string> > lst = new List <Tuple <string, string> >(); //Формируем поле LONG_ADDRESS string rks = LookupList.LookupNewNum(Convert.ToString(row["SENDER_BIK"]), "RKC"); string ind = LookupList.LookupNewNum(rks, "IND"); string nnp = LookupList.LookupNewNum(rks, "NNP"); string namen = LookupList.LookupNewNum(rks, "NAMEN"); string tnp = LookupList.LookupNewNum(rks, "TNP"); tnp = LookupList.DecodeTNP(tnp); string long_addr = ind + ", " + tnp + " " + nnp + ", " + namen; lst.Add(new Tuple <string, string>("LONG_ADDRESS", long_addr)); lst.Add(new Tuple <string, string>("BIK_B", rks)); string receiver_ko = Convert.ToString(row["RECEIVER_KO"]); if (receiver_ko == string.Format("{0:D20}", 0)) { receiver_ko = ""; } /*else if (string.IsNullOrEmpty(receiver_ko)) * receiver_ko = string.Format("{0:D20}", 0);*/ lst.Add(new Tuple <string, string>("RECEIVER_KO", receiver_ko)); lst.Add(new Tuple <string, string>("RECEIVER_BIK", Convert.ToString(row["RECEIVER_BIK"]))); string receiver_bill = Convert.ToString(row["RECEIVER_BILL"]); if (receiver_bill == string.Format("{0:D20}", 0)) { receiver_bill = ""; } lst.Add(new Tuple <string, string>("RECEIVER_BILL", receiver_bill)); string summ; string summ_kop; CommonUtils.PrepareSum(row["RD_SUM"], out summ, out summ_kop); lst.Add(new Tuple <string, string>("SUMM", summ)); lst.Add(new Tuple <string, string>("SUMM_KOP", summ_kop)); lst.Add(new Tuple <string, string>("RD_NUM", Convert.ToString(row["RD_NUM"]))); DateTime rd_date = Convert.ToDateTime(row["RD_DATE"]); lst.Add(new Tuple <string, string>("RD_DATE", CommonUtils.FormatDate(rd_date))); DateTime aviso_date = Convert.ToDateTime(row["CREATE_DATE"]); lst.Add(new Tuple <string, string>("AVISO_DATE", CommonUtils.FormatDate(aviso_date))); DateTime kpd_date = Convert.ToDateTime(row["KPD_DATE"]); lst.Add(new Tuple <string, string>("KPD_DATE", CommonUtils.FormatDate(kpd_date))); string sender_ko = Convert.ToString(row["sender_KO"]); if (sender_ko == string.Format("{0:D20}", 0)) { sender_ko = ""; } /*else if (string.IsNullOrEmpty(sender_ko)) * sender_ko = string.Format("{0:D20}", 0);*/ lst.Add(new Tuple <string, string>("SENDER_KO", sender_ko)); lst.Add(new Tuple <string, string>("SENDER_BIK", Convert.ToString(row["SENDER_BIK"]))); string sender_bill = Convert.ToString(row["SENDER_BILL"]); if (sender_bill == string.Format("{0:D20}", 0)) { sender_bill = ""; } lst.Add(new Tuple <string, string>("SENDER_BILL", sender_bill)); lst.Add(new Tuple <string, string>("NUM", Convert.ToString(row["NUM"]))); lst.Add(new Tuple <string, string>("KPD", Convert.ToString(row["KPD"]))); //Определяемся, какой из шаблонов нужен string template_name = ""; string sender_bik = Convert.ToString(row["SENDER_BIK"]); if (sender_bik.Substring(0, 4) == "0475") { template_name = CommonUtils.GetCurrentDir() + @"\Templates\credit_post_aviso.docx"; } else { string receiver_bik = Convert.ToString(row["RECEIVER_BIK"]); if (receiver_bik.Substring(0, 4) == "0475") { template_name = CommonUtils.GetCurrentDir() + @"\Templates\debit_post_aviso.docx"; } } if (!string.IsNullOrEmpty(template_name)) { return(ReportOutput.CreateReport(template_name, result_file, lst)); } else { return(false); } }
public override bool PrintCurrent(BindingSource bs, string result_file) { DataRowView row = (DataRowView)bs.Current; List <Tuple <string, string> > lst = new List <Tuple <string, string> >(); for (int idx = 0; idx < row.Row.Table.Columns.Count - 1; ++idx) { string val; DataColumn col = row.Row.Table.Columns[idx]; if (col.DataType == typeof(System.DateTime)) { DateTime dt = Convert.ToDateTime(row[idx]); val = CommonUtils.FormatDate(dt); } else { val = Convert.ToString(row[idx]); } if (val == string.Format("{0:D20}", 0)) { val = ""; } lst.Add(new Tuple <string, string>(row.Row.Table.Columns[idx].ColumnName, val)); } lst.Add(new Tuple <string, string>("RECEIVER_KO_NAME", Convert.ToString(row["RECEIVER_KO_NAME"]))); //Формируем поле LONG_ADDRESS string rks = LookupList.LookupNewNum(Convert.ToString(row["SENDER_BIK"]), "RKC"); string ind = LookupList.LookupNewNum(rks, "IND"); string nnp = LookupList.LookupNewNum(rks, "NNP"); string namen = LookupList.LookupNewNum(rks, "NAMEN"); string tnp = LookupList.LookupNewNum(rks, "TNP"); tnp = LookupList.DecodeTNP(tnp); string long_addr = ind + ", " + tnp + " " + nnp + ", " + namen; lst.Add(new Tuple <string, string>("LONG_ADDRESS", long_addr)); lst.Add(new Tuple <string, string>("BIK_B", rks)); /*string receiver_ko = Convert.ToString(row["RECEIVER_KO"]); * if (string.IsNullOrEmpty(receiver_ko)) * receiver_ko = string.Format("{0:D20}", 0); * * lst.Add(new Tuple<string, string>("RECEIVER_KO", receiver_ko)); * lst.Add(new Tuple<string, string>("RECEIVER_BIK", Convert.ToString(row["RECEIVER_BIK"]))); * lst.Add(new Tuple<string, string>("RECEIVER_BILL", Convert.ToString(row["RECEIVER_BILL"])));*/ string summ; string summ_kop; CommonUtils.PrepareSum(row["RD_SUM"], out summ, out summ_kop); lst.Add(new Tuple <string, string>("SUMM", summ)); lst.Add(new Tuple <string, string>("SUMM_KOP", summ_kop)); lst.Add(new Tuple <string, string>("RD_NUM", Convert.ToString(row["RD_NUM"]))); string is_inn_receiver = ""; if (!string.IsNullOrEmpty(Convert.ToString(row["RECEIVER_INN"]))) { is_inn_receiver = "ИНН"; } lst.Add(new Tuple <string, string>("IS_INN_RECEIVER", is_inn_receiver)); string is_kpp_receiver = ""; if (!string.IsNullOrEmpty(Convert.ToString(row["RECEIVER_KPP"]))) { is_kpp_receiver = "КПП"; } lst.Add(new Tuple <string, string>("IS_KPP_RECEIVER", is_kpp_receiver)); string is_inn_sender = ""; if (!string.IsNullOrEmpty(Convert.ToString(row["SENDER_INN"]))) { is_inn_sender = "ИНН"; } lst.Add(new Tuple <string, string>("IS_INN_SENDER", is_inn_sender)); string is_kpp_sender = ""; if (!string.IsNullOrEmpty(Convert.ToString(row["SENDER_KPP"]))) { is_kpp_sender = "КПП"; } lst.Add(new Tuple <string, string>("IS_KPP_SENDER", is_kpp_sender)); //Определяемся, какой из шаблонов нужен string template_name = ""; string sender_bik = Convert.ToString(row["SENDER_BIK"]); if (sender_bik.Substring(0, 4) == "0475") { template_name = CommonUtils.GetCurrentDir() + @"\Templates\credit_telegraph_aviso.docx"; } else { string receiver_bik = Convert.ToString(row["RECEIVER_BIK"]); if (receiver_bik.Substring(0, 4) == "0475") { template_name = CommonUtils.GetCurrentDir() + @"\Templates\debit_telegraph_aviso.docx"; } } if (!string.IsNullOrEmpty(template_name)) { return(ReportOutput.CreateReport(template_name, result_file, lst)); } else { return(false); } }
//Автоподстановка КО при выборе БИК банка private void cbReceiverBIK_SelectedIndexChanged(object sender, EventArgs e) { cbReceiverKO.Text = LookupList.LookupNewNum(cbReceiverBIK.Text, "KSNP"); }