Ejemplo n.º 1
0
        private void btn_ksss_Click(object sender, EventArgs e)
        {
            int focusRow = 1;

            if (operation_ksss == "UPD")
            {
                if ((tb_contr_type.Text == "" && tb_contr_name.Text == "") ||
                    (tb_ksss.Text == "" && tb_contr_code.Text == ""))
                {
                    lb_status.Text = "Ошибка: Не обязательным для ввода является тольео поле \"Код контрагента/кредитора\"";
                }

                else
                {
                    DataSaver ds = new DataSaver(login_, password_);
                    lb_status.Text = ds.UpdateKSSStoContragent(tb_contr_type.Text, tb_contr_name.Text
                                                , tb_ksss.Text.Replace(" ",""), tb_contr_code.Text.Replace(" ",""), tb_ksss_id.Text);
                }
                focusRow = KSSSView.FocusedRowHandle;

            }

            else if (operation_ksss == "INS")
            {
                if ((tb_contr_type.Text == "" && tb_contr_name.Text == "") ||
                    (tb_ksss.Text == "" && tb_contr_code.Text == ""))
                {
                    lb_status.Text = "Ошибка: Не обязательным для ввода является тольео поле \"Код контрагента/кредитора\"";
                }

                else
                { 
                DataSaver ds = new DataSaver(login_, password_);
                lb_status.Text = ds.InsertKsssContragent(tb_contr_type.Text, tb_contr_name.Text, tb_ksss.Text.Replace(" ",""), tb_contr_code.Text.Replace(" ",""));
                }
                focusRow = KSSSView.RowCount;
                
                tb_contr_code.Text = "";
                tb_contr_name.Text = "";
                tb_contr_type.Text = "";
                tb_ksss.Text = "";
            }

            else if (operation_ksss == "DEL")
            {
                DataSaver ds = new DataSaver(login_, password_);
                lb_status.Text = ds.DelKSSSContragent(tb_ksss_id.Text);
                focusRow = KSSSView.RowCount - 1;
            }
            try
            {
                KSSStoContragentFill();
                KSSSView.FocusedRowHandle = focusRow;
            }
            catch { }

        }