public ClsCarFleet GetCarFleetByCarFleetId(long lgCarFleetId)
        {
            ClsCarFleet objClsCarFleet = new ClsCarFleet();

            try
            {
                using (this.objDataContext = GetDataContext())
                {
                    GetCarFleetByIdResult item = this.objDataContext.GetCarFleetById(lgCarFleetId).ToList().FirstOrDefault();
                    if (item != null)
                    {
                        objClsCarFleet.inId             = item.ID;
                        objClsCarFleet.inOwner_Id       = item.Owner_Id;
                        objClsCarFleet.strLast_Trip     = item.Last_Trip.Replace(' ', '/');
                        objClsCarFleet.strCode          = item.Code;
                        objClsCarFleet.strReg           = item.Reg;
                        objClsCarFleet.strDesc          = item.Description;
                        objClsCarFleet.inColor_Id       = item.Color_Id;
                        objClsCarFleet.strFuel_Type     = item.Fuel_Type;
                        objClsCarFleet.inLast_Km        = item.Last_Km;
                        objClsCarFleet.strLast_Location = item.Last_Location;
                        objClsCarFleet.strMake          = item.Make;
                        objClsCarFleet.inFleetModels_Id = System.Convert.ToInt32(item.FleetModels_Id);
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.CarFleet, _mySession.UserId);
            }

            return(objClsCarFleet);
        }
        public int SaveCarFleet(ClsCarFleet objSave)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (this.objDataContext = GetDataContext())
                    {
                        var result = this.objDataContext.InsertOrUpdateCarFleet(objSave.inId, objSave.inOwner_Id, objSave.strCode, objSave.strReg, objSave.strDesc, objSave.inColor_Id,
                                                                                objSave.strFuel_Type, objSave.strLast_Trip, objSave.inLast_Km, objSave.strLast_Location, objSave.inFleetModels_Id, objSave.inFleetMakes_Id, _mySession.UserId, PageMaster.CarFleet.ToString().IntSafe(), null, null).FirstOrDefault();

                        if (result != null)
                        {
                            objSave.inId = result.InsertedId;
                        }
                    }

                    objDataContext.SubmitChanges();
                    scope.Complete();
                }

                return(objSave.inId);
            }
            catch (Exception ex)
            {
                _logger.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.CarFleet, _mySession.UserId);
                return(0);
            }
        }