public static ProffixLAGArtikelModel GetProffixLAGArtikelModel(string artikelNrLAG, string connectionString) { ProffixLAGArtikelModel model = null; if (String.IsNullOrWhiteSpace(connectionString)) { return(null); } DataColumn[] oSelect = { new DataColumn("LaufNr", typeof(Int32)), new DataColumn("ArtikelNrLAG", typeof(string)), new DataColumn("Bezeichnung1", typeof(string)), new DataColumn("Bezeichnung2", typeof(string)), new DataColumn("Bezeichnung3", typeof(string)), new DataColumn("Bezeichnung4", typeof(string)), new DataColumn("Bezeichnung5", typeof(string)), }; DataColumn[] oCondition = new DataColumn[1]; DataColumn col = new DataColumn("ArtikelNrLAG", typeof(string)); col.DefaultValue = artikelNrLAG; oCondition[0] = col; DataTable dt = LoadTable("LAG_Artikel", oSelect, oCondition, null, connectionString: connectionString); if (dt != null && dt.Rows.Count > 0) { model = new ProffixLAGArtikelModel() { LaufNr = Convert.ToInt32(dt.Rows[0]["LaufNr"]), ArtikelNrLAG = dt.Rows[0]["ArtikelNrLAG"].ToString(), Bezeichnung1 = dt.Rows[0]["Bezeichnung1"].ToString(), Bezeichnung2 = dt.Rows[0]["Bezeichnung2"].ToString(), Bezeichnung3 = dt.Rows[0]["Bezeichnung3"].ToString(), Bezeichnung4 = dt.Rows[0]["Bezeichnung4"].ToString(), Bezeichnung5 = dt.Rows[0]["Bezeichnung5"].ToString(), }; } return(model); }
public void SetProffixParam(ProffixModel model, string connectionString) { //if proffix model needed _ProffixModel = model; //load proffix product ProffixLAGArtikelModel oLAGArtikel = StorageOperator.GetProffixLAGArtikelModel(model.LAGDokumenteArtikelNrLAG, connectionString); if (oLAGArtikel != null) { string[] oLines = new string[6]; oLines[0] = !String.IsNullOrWhiteSpace(oLAGArtikel.ArtikelNrLAG) ? oLAGArtikel.ArtikelNrLAG : "-"; oLines[1] = !String.IsNullOrWhiteSpace(oLAGArtikel.Bezeichnung1) ? oLAGArtikel.Bezeichnung1 : "-"; oLines[2] = !String.IsNullOrWhiteSpace(oLAGArtikel.Bezeichnung2) ? oLAGArtikel.Bezeichnung2 : "-"; oLines[3] = !String.IsNullOrWhiteSpace(oLAGArtikel.Bezeichnung3) ? oLAGArtikel.Bezeichnung3 : "-"; oLines[4] = !String.IsNullOrWhiteSpace(oLAGArtikel.Bezeichnung4) ? oLAGArtikel.Bezeichnung4 : "-"; oLines[5] = !String.IsNullOrWhiteSpace(oLAGArtikel.Bezeichnung5) ? oLAGArtikel.Bezeichnung5 : "-"; txtProductDesc.Lines = oLines; } //load proffix supplier List <ProffixLAGLieferantenModel> oLAGLieferantenList = StorageOperator.GetProffixLAGLieferantenModelList(model.LAGDokumenteArtikelNrLAG, connectionString); if (oLAGLieferantenList != null) { ddSupplier.Properties.Items.Clear(); //ddSupplier.Properties.Items.Add(new ComboboxItemModel() { Caption = "-", Value = 0 }); foreach (ProffixLAGLieferantenModel item in oLAGLieferantenList) { ddSupplier.Properties.Items.Add(new ComboboxItemModel() { Caption = item.Name, Value = item.LaufNr }); } } //load proffix document ProffixLAGDokumente oProffixLAGDokumente = StorageOperator.GetProffixLAGDokumente(model.LAGDokumenteArtikelNrLAG, model.CalculationID, connectionString); if (oProffixLAGDokumente != null) { txtRemark.Text = oProffixLAGDokumente.Bemerkungen; } if (model.IsNew) { //new from proffix dtCreate.EditValue = DateTime.Now; btnNew.Enabled = true; btnReset.Enabled = false; } else { //load from proffix btnNew.Enabled = false; btnReset.Enabled = true; } }