Exemplo n.º 1
0
        public static ProffixLAGDokumente GetProffixLAGDokumente(string artikelNrLAG, string calculationID, string connectionString)
        {
            ProffixLAGDokumente model = null;

            if (String.IsNullOrWhiteSpace(connectionString))
            {
                return(null);
            }

            DataColumn[] oSelect =
            {
                new DataColumn("LaufNr",       typeof(Int32)),
                new DataColumn("ArtikelNrLAG", typeof(string)),
                new DataColumn("Bemerkungen",  typeof(string)),
                new DataColumn("DateiName",    typeof(DateTime))
            };

            DataColumn[] oCondition = new DataColumn[2];
            DataColumn   col        = new DataColumn("ArtikelNrLAG", typeof(string));

            col.DefaultValue = artikelNrLAG;
            oCondition[0]    = col;

            col = new DataColumn("rtrim(ltrim([DateiName]))", typeof(string));
            col.DefaultValue = String.Concat("open", "%", artikelNrLAG,
                                             String.IsNullOrWhiteSpace(calculationID) ? "" : String.Concat(" ", calculationID));
            oCondition[1] = col;

            DataTable dt = LoadTable("LAG_Dokumente", oSelect, oCondition, null, connectionString: connectionString);

            if (dt != null && dt.Rows.Count > 0)
            {
                model = new ProffixLAGDokumente()
                {
                    LaufNr       = Convert.ToInt32(dt.Rows[0]["LaufNr"]),
                    ArtikelNrLAG = dt.Rows[0]["ArtikelNrLAG"].ToString(),
                    Bemerkungen  = dt.Rows[0]["Bemerkungen"].ToString(),
                    DateiName    = dt.Rows[0]["DateiName"].ToString()
                };
            }

            return(model);
        }
Exemplo n.º 2
0
        static void SaveLAG_Dokumente(CalculationModel model)
        {
            //save or update
            string sCalculationID = model.ProffixModel.IsNew ? null : model.ID.ToString();
            ProffixLAGDokumente oProffixLAGDokumente = GetProffixLAGDokumente(
                model.ProffixModel.LAGDokumenteArtikelNrLAG, sCalculationID, model.ProffixConnection);

            if (oProffixLAGDokumente != null)
            {
                //update value
                DataTable oDtLAGDokumente = new DataTable();
                oDtLAGDokumente.TableName = "LAG_Dokumente";
                oDtLAGDokumente.Columns.Add(new DataColumn("LaufNr", typeof(string)));
                oDtLAGDokumente.Columns.Add(new DataColumn("DateiName", typeof(string)));
                oDtLAGDokumente.Columns.Add(new DataColumn("Bezeichnung", typeof(string)));
                DataRow oDr = oDtLAGDokumente.NewRow();
                oDtLAGDokumente.Rows.Add(oDr);

                oDr["LaufNr"]    = oProffixLAGDokumente.LaufNr;
                oDr["DateiName"] = String.Concat(oProffixLAGDokumente.DateiName, " ", model.ID);

                //Kalk. VP 01.12.2017 Aktiv Oldenburg Kunststoff-Te
                string sBezeichnung = String.Concat(
                    "Kalk. ",
                    model.GeneralSetting.CostType == "S" ? "VP " : "EP ",
                    DateTime.Now.ToString("dd.MM.yyyy", new CultureInfo("en-US")),
                    model.GeneralSetting.Options.Contains("A") ? " Aktiv" : " ",
                    model.GeneralSetting.Supplier);
                oDr["Bezeichnung"] = sBezeichnung.Length > 100 ? sBezeichnung.Substring(0, 100) : sBezeichnung;

                //update proffix
                UpdateRow(
                    oDr,
                    oDtLAGDokumente.Columns["LaufNr"],
                    new List <DataColumn>()
                {
                    oDtLAGDokumente.Columns["DateiName"],
                    oDtLAGDokumente.Columns["Bezeichnung"]
                },
                    connectionString: model.ProffixConnection);
            }
        }
Exemplo n.º 3
0
        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;
            }
        }