Exemple #1
0
        public override void Execute()
        {
            //using (var t = new TransactionScope())
            {
                //Get working invoice Id

                if (In.RecordId > 0)
                {
                    Update();
                }
                else
                {
                    Insert();
                }

                //Insert WInvLines
                In.GetCompinedLines().ForEach(line =>
                {
                    var winLineInsertString = string.Format(
                        "insert into DBA.WInvLines(LockFlag,ParentRecordID,LineOrder,TransCode,Qty,ItemID,Description,PriceLevel,Price,TaxCode,Cost,OnHand,FinalPrice,SerialNum,IsItemGrpDisc,Points,SerialNumComment)" +
                        "VALUES({0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16}) ",
                        0, line.ParentRecordId, line.LineOrder, line.TransCode.GetSqlCompatible(true),
                        line.Qty, line.ItemId.GetSqlCompatible(true), line.Description.GetSqlCompatible(true), line.PriceLevel.GetSqlCompatible(true), line.Price.ToString("F2"), line.TaxCode.ToString().GetSqlCompatible(true), line.Cost,
                        line.OnHand,
                        line.FinalPrice.ToString("F2"), line.SerialNumber.GetSqlCompatible(true), "''", line.Points, "''");
                    SharedDb.PosimDb.Execute(winLineInsertString);
                });

                Out = true;
            }
        }