Esempio n. 1
0
        public void SaveAtlanticLength(int AtLenID, Accessor.AtlanticCanvasLenght m)
        {
            using (LinqtoNewAgeDataContext dc = new LinqtoNewAgeDataContext())
            {
                var matched = (from l in dc.tblAtlanticCanvasLengths
                               where l.AtlanticCanvasLenID == AtLenID
                               select l).SingleOrDefault();
                try
                {
                    matched.FrameLenght        = m.FrameLenght;
                    matched.FrameWidth         = m.FrameWidth;
                    matched.NoOfFrames         = m.NoOfFrames;
                    matched.TotalUsedFrameCost = m.TotalUsedFrameCost;
                    matched.FrameArea          = m.TotalArea;
                    matched.CanvasOverlap      = m.CanvasOverlap;
                    matched.TotalCanvasArea    = m.TotalCanvasArea;
                    matched.TotalFrameLength   = m.TotalFrameLength;

                    dc.SubmitChanges();
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="BusID"></param>
        /// <param name="m"></param>
        public void SaveBussinessCost(int BusID, Accessor.BussinessCost m)
        {
            using (LinqtoNewAgeDataContext dc = new LinqtoNewAgeDataContext())
            {
                var matched = (from l in dc.tblBussinessCosts
                               where l.BussinessCostID == BusID
                               select l).SingleOrDefault();
                try
                {
                    matched.RatePerHour = m.RatePerHour;

                    dc.SubmitChanges();
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// select the volume entry by id and update the record
        /// </summary>
        /// <param name="VolID"></param>
        /// <param name="m"></param>
        public void SaveVolume(int VolID, Accessor.VolumeAccess m)
        {
            using (LinqtoNewAgeDataContext dc = new LinqtoNewAgeDataContext())
            {
                var matched = (from l in dc.tblVolumeCosts
                               where l.VolumeCostID == VolID
                               select l).SingleOrDefault();
                try
                {
                    matched.TotalVolume   = m.TotalVolume;
                    matched.TotalCost     = m.TotalCost;
                    matched.PricePerLiter = m.PricePerLitre;

                    dc.SubmitChanges();
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// select the Area entry by id and update the record
        /// </summary>
        /// <param name="AreaID"></param>
        /// <param name="m"></param>
        public void SaveArea(int AreaID, Accessor.AreaAccess m)
        {
            using (LinqtoNewAgeDataContext dc = new LinqtoNewAgeDataContext())
            {
                var matched = (from l in dc.tblAreaCosts
                               where l.AreatCostID == AreaID
                               select l).SingleOrDefault();
                try
                {
                    matched.TotalLenght     = m.TotalLenght;
                    matched.TotalWidth      = m.TotalWidth;
                    matched.TotalCost       = m.TotalCost;
                    matched.PricePerMeterSQ = m.PricePSqrMeter;
                    matched.TotalArea       = m.TotalArea;

                    dc.SubmitChanges();
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// select the length entry by id and update the record
        /// </summary>
        /// <param name="LenID"></param>
        /// <param name="m"></param>
        public void SaveLength(int LenID, Accessor.LengthAccess m)
        {
            using (LinqtoNewAgeDataContext dc = new LinqtoNewAgeDataContext())
            {
                var matched = (from l in dc.tblLengthCosts
                               where l.LenghtCostID == LenID
                               select l).SingleOrDefault();
                try
                {
                    matched.NoPieces        = m.NumPieces;
                    matched.TotalLength     = m.TotalLength;
                    matched.LengthPerPiece  = m.LengthPerPiece;
                    matched.TotalCostPieces = m.TotalCost;
                    matched.PricePerMeter   = m.PricePerMeter;

                    dc.SubmitChanges();
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Save the Material and also a blank entry for the corresponding cost centre
        /// </summary>
        /// <param name="m"></param>
        /// <param name="type"></param>
        public void SaveMaterial(Accessor.MaterialProperties m, int type)
        {
            using (LinqtoNewAgeDataContext dc = new LinqtoNewAgeDataContext())
            {
                tblMaterial mat = new tblMaterial
                {
                    MaterialID  = m.MaterialID,
                    Name        = m.MaterialName,
                    Description = m.Destcription,
                    TypeID      = m.TypeID
                };

                dc.tblMaterials.InsertOnSubmit(mat);
                try
                {
                    dc.SubmitChanges();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                switch (type)
                {
                    #region Length
                case 1:
                    tblLengthCost l = new tblLengthCost
                    {
                        TypeID          = 1,
                        MaterialID      = m.MaterialID,
                        NoPieces        = 0,
                        TotalLength     = 0,
                        LengthPerPiece  = 0,
                        TotalCostPieces = 0,
                        PricePerMeter   = 0
                    };
                    dc.tblLengthCosts.InsertOnSubmit(l);
                    try
                    {
                        dc.SubmitChanges();
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                    break;
                    #endregion Length

                    #region Area
                case 2:
                    tblAreaCost a = new tblAreaCost
                    {
                        TypeID          = 2,
                        MaterialID      = m.MaterialID,
                        TotalLenght     = 0,
                        TotalWidth      = 0,
                        TotalCost       = 0,
                        PricePerMeterSQ = 0,
                        TotalArea       = 0
                    };
                    dc.tblAreaCosts.InsertOnSubmit(a);
                    try
                    {
                        dc.SubmitChanges();
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                    break;
                    #endregion Area

                    #region Volume
                case 3:
                    tblVolumeCost v = new tblVolumeCost
                    {
                        TypeID        = 3,
                        MaterialID    = m.MaterialID,
                        TotalVolume   = 0,
                        TotalCost     = 0,
                        PricePerLiter = 0
                    };
                    dc.tblVolumeCosts.InsertOnSubmit(v);
                    try
                    {
                        dc.SubmitChanges();
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                    break;
                    #endregion Volume

                    #region BussinessCost
                case 4:
                    tblBussinessCost b = new tblBussinessCost
                    {
                        TypeID      = 4,
                        MaterialID  = m.MaterialID,
                        CostName    = m.MaterialName,
                        RatePerHour = 0,
                    };
                    dc.tblBussinessCosts.InsertOnSubmit(b);
                    try
                    {
                        dc.SubmitChanges();
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }

                    break;
                    #endregion BussinessCost

                //TODO FINISH INSERT
                default:
                    break;
                }
            }
        }