You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
5.8 KiB
170 lines
5.8 KiB
using BroadcastListener.Classes;
|
|
using Database;
|
|
using OnDoc.Klassen;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Diagnostics;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using System.Xml;
|
|
|
|
namespace OnDoc.UIControls
|
|
{
|
|
public partial class UCAllgemeinDokumentParamExtern : UserControl
|
|
{
|
|
public bool personendokument { get; set; } = false;
|
|
public bool bpdokument { get; set; } = false;
|
|
public int dokumenttypnr { get; set; } = 0;
|
|
public string uri { get; set; } = "";
|
|
public int partnernr { get; set; } = 0;
|
|
public int bpperson_error_type { get; set; } = 0;
|
|
private bool bpperson_error { get; set; } = false;
|
|
|
|
public UCAllgemeinDokumentParamExtern()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void sfButton1_Click(object sender, EventArgs e)
|
|
{
|
|
set_personendokument();
|
|
show_partnerdialog();
|
|
}
|
|
|
|
public bool set_personendokument()
|
|
{
|
|
|
|
DB db1 = new DB(AppParams.connectionstring);
|
|
db1.Get_Tabledata("select * from Dokumenttyp_BP_Person_Erstellung where dokumenttypnr=" + this.dokumenttypnr.ToString(), false, true);
|
|
if (db1.dsdaten.Tables[0].Rows.Count == 0)
|
|
{
|
|
personendokument = false;
|
|
bpdokument = true;
|
|
}
|
|
else
|
|
{
|
|
if (db1.dsdaten.Tables[0].Rows[0][1].ToString() == "2") personendokument = true;
|
|
if (db1.dsdaten.Tables[0].Rows[0][1].ToString() == "1") personendokument = false;
|
|
if (personendokument) { bpdokument = false; }
|
|
}
|
|
return personendokument;
|
|
}
|
|
private void show_partnerdialog()
|
|
{
|
|
Partnersuche ps = new Partnersuche(personendokument, true, bpdokument, dokumenttypnr);
|
|
ps.ShowDialog();
|
|
if (ps.DialogResult == DialogResult.OK)
|
|
{
|
|
this.partnernr = ps.partnernr;
|
|
if (ps.bpperson_changed) { lblPartner.ForeColor = System.Drawing.Color.Blue; } else { lblPartner.ForeColor = System.Drawing.Color.Black; }
|
|
update_partner();
|
|
}
|
|
}
|
|
public void update_partner()
|
|
{
|
|
DB db = new DB(AppParams.connectionstring);
|
|
|
|
db.Get_Tabledata("Select * from partner where nrpar00=" + partnernr, false, true);
|
|
this.lblPartner.Text = db.dsdaten.Tables[0].Rows[0]["nrpar00"].ToString() + " " + db.dsdaten.Tables[0].Rows[0]["bkpar00"].ToString();
|
|
|
|
db.clear_parameter();
|
|
db.add_parameter("@nrpar00", this.partnernr.ToString());
|
|
db.Get_Tabledata("OnDoc_sp_partner_detail", true, false);
|
|
txtPartnerInhaber.Text = "";
|
|
txtPartnerZusteller.Text = "";
|
|
string s = "";
|
|
for (int i = 1; i < 8; i++)
|
|
{
|
|
txtPartnerInhaber.Text = txtPartnerInhaber.Text + db.dsdaten.Tables[0].Rows[0]["d" + i.ToString()].ToString() + "\r\n";
|
|
txtPartnerZusteller.Text = txtPartnerZusteller.Text + db.dsdaten.Tables[0].Rows[0]["h" + i.ToString()].ToString() + "\r\n";
|
|
s = s + db.dsdaten.Tables[0].Rows[0]["h" + i.ToString()].ToString();
|
|
}
|
|
if (s == "") { txtPartnerZusteller.Text = txtPartnerInhaber.Text; }
|
|
|
|
//db.clear_parameter();
|
|
//db.add_parameter("@partnernr", this.partnernr.ToString());
|
|
//db.Get_Tabledata("sp_dokumentbearbeitung_kube", true, false);
|
|
|
|
|
|
db = null;
|
|
|
|
}
|
|
|
|
public void Refresh_Details(string uri, string description)
|
|
{
|
|
this.uri = uri;
|
|
this.lbluridescription.Text = description;
|
|
if (dokumenttypnr != 0)
|
|
{
|
|
set_personendokument();
|
|
}
|
|
|
|
if (partnernr != 0)
|
|
{
|
|
update_partner();
|
|
}
|
|
}
|
|
|
|
public void gendoc()
|
|
{
|
|
try
|
|
{
|
|
string uri1 = "";
|
|
uri1 = uri.Replace("&partnernr&", this.partnernr.ToString());
|
|
Process.Start(uri1);
|
|
return;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string error = "Die Erstellung im externen System konnte nicht gestartet werden ('" + uri + "')" + Environment.NewLine + ex.Message;
|
|
MessageBox.Show(error,"Externe Dokumenterstellung",MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
|
|
public bool check_bp_person()
|
|
{
|
|
DB db1 = new DB(AppParams.connectionstring);
|
|
db1.Get_Tabledata("select * from Dokumenttyp_BP_Person_Erstellung where dokumenttypnr=" + this.dokumenttypnr.ToString(), false, true);
|
|
bpperson_error_type = 0;
|
|
if (db1.dsdaten.Tables[0].Rows.Count > 0)
|
|
{
|
|
if (db1.dsdaten.Tables[0].Rows[0][1].ToString() == "2" && this.partnernr.ToString().Length < 9)
|
|
{
|
|
bpperson_error = true;
|
|
bpperson_error_type = 1;
|
|
return false;
|
|
|
|
}
|
|
if (db1.dsdaten.Tables[0].Rows[0][1].ToString() == "1" && this.partnernr.ToString().Length > 8)
|
|
{
|
|
bpperson_error = true;
|
|
bpperson_error_type = 2;
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
|
|
}
|
|
|
|
public void Show_Neugenerieren()
|
|
{
|
|
btnErneutGenerierung.Visible = true;
|
|
}
|
|
|
|
private void btnErneutGenerierung_Click(object sender, EventArgs e)
|
|
{
|
|
gendoc();
|
|
}
|
|
|
|
private void UCAllgemeinDokumentParamExtern_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|