コード例 #1
0
        public bool InsertProduction(int productionID, DateTime?productiondate, int?shift, int?item, float?quantity, int?machine, DateTime?startTime, DateTime?stopTime, float?packers)
        {
            SPG.ProductionDataTable production       = new SPG.ProductionDataTable();
            SPG.ProductionRow       productionRecord = production.NewProductionRow();

            productionRecord.ProdMainID          = productionID;
            productionRecord.ProdMainDate        = Convert.ToDateTime(productiondate);
            productionRecord.ProdMainShift       = shift.Value;
            productionRecord.ProdMainItemID      = item.Value;
            productionRecord.ProdMainQuantity    = quantity.Value;
            productionRecord.ProdMainMachineLine = machine.Value;
            productionRecord.ProdMainTimeStart   = startTime.Value;
            productionRecord.ProdMainTimeStop    = stopTime.Value;
            if (!packers.HasValue)
            {
                productionRecord.ProdMainPackers = 0;
            }
            else
            {
                productionRecord.ProdMainPackers = packers.Value;
            }
            productionRecord.strEnteredBy = Properties.Settings.Default.UserName;
            productionRecord.dtmEnteredOn = DateTime.Now;

            production.AddProductionRow(productionRecord);
            int rowsAffected = Adapter.Update(production);

            return(rowsAffected == 1);
        }
コード例 #2
0
        public bool UpdateProduction(int productionID, DateTime?productionDate, int?shift, int?item, float?quantity, int?machine, DateTime?startTime, DateTime?stopTime, float?packers)
        {
            SPG.ProductionDataTable production = Adapter.GetProductionByID(productionID);

            if (production.Count() == 0)
            {
                //It is a new Production Record
                return(InsertProduction(productionID, productionDate, shift, item, quantity, machine, startTime, stopTime, packers));
            }

            SPG.ProductionRow productionRecord = production[0];

            object[] originalRecord = productionRecord.ItemArray;

            productionRecord.ProdMainDate        = Convert.ToDateTime(productionDate);
            productionRecord.ProdMainShift       = shift.Value;
            productionRecord.ProdMainItemID      = item.Value;
            productionRecord.ProdMainQuantity    = quantity.Value;
            productionRecord.ProdMainMachineLine = machine.Value;
            productionRecord.ProdMainTimeStart   = startTime.Value;
            productionRecord.ProdMainTimeStop    = stopTime.Value;
            if (!packers.HasValue)
            {
                productionRecord.ProdMainPackers = 0;
            }
            else
            {
                productionRecord.ProdMainPackers = packers.Value;
            }

            if (!(originalRecord == null))
            {
                UpdateAuditTrail(productionRecord, originalRecord);
            }

            int rowsAffected = Adapter.Update(productionRecord);

            return(rowsAffected == 1);
        }