Exemplo n.º 1
0
        public long SaveFleetModels(ClsFleetModels objSave)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (this.objDataContext = GetDataContext())
                    {
                        var result = this.objDataContext.InsertOrUpdateFleetModels(objSave.lgId, objSave.strFleetModelsName, _mySession.UserId, PageMaster.FleetModels).FirstOrDefault();
                        if (result != null)
                        {
                            objSave.lgId = result.InsertedId;
                        }
                    }

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

                return(objSave.lgId);
            }
            catch (Exception ex)
            {
                _logger.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.FleetModels, _mySession.UserId);
                return(0);
            }
        }
Exemplo n.º 2
0
        public ClsFleetModels GetFleetModelsByFleetModelsId(long lgFleetModelsId)
        {
            ClsFleetModels objClsFleetModels = new ClsFleetModels();

            try
            {
                using (this.objDataContext = GetDataContext())
                {
                    GetFleetModelsByIdResult item = this.objDataContext.GetFleetModelsById(lgFleetModelsId).ToList().FirstOrDefault();
                    if (item != null)
                    {
                        objClsFleetModels.lgId = item.Id;
                        objClsFleetModels.strFleetModelsName = item.FleetModelsName;
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.FleetModels, _mySession.UserId);
            }

            return(objClsFleetModels);
        }