コード例 #1
0
        public long SaveFleetMakes(ClsFleetMakes objSave)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (this.objDataContext = GetDataContext())
                    {
                        var result = this.objDataContext.InsertOrUpdateFleetMakes(objSave.lgId, objSave.strFleetMakesName, _mySession.UserId, PageMaster.FleetMakes).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.FleetMakes, _mySession.UserId);
                return(0);
            }
        }
コード例 #2
0
        public ClsFleetMakes GetFleetMakesByFleetMakesId(long lgFleetMakesId)
        {
            ClsFleetMakes objClsFleetMakes = new ClsFleetMakes();

            try
            {
                using (this.objDataContext = GetDataContext())
                {
                    GetFleetMakesByIdResult item = this.objDataContext.GetFleetMakesById(lgFleetMakesId).ToList().FirstOrDefault();
                    if (item != null)
                    {
                        objClsFleetMakes.lgId = item.Id;
                        objClsFleetMakes.strFleetMakesName = item.FleetMakesName;
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.FleetMakes, _mySession.UserId);
            }

            return(objClsFleetMakes);
        }