Esempio n. 1
0
        public long SaveFleetMakes(ClsFleetMakes objSave)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (this.objDataContext = new FleetMakesDataContext(Functions.StrConnection))
                    {
                        var result = this.objDataContext.InsertOrUpdateFleetMakes(objSave.lgId, objSave.strFleetMakesName, mySession.Current.UserId, PageMaster.FleetMakes).FirstOrDefault();
                        if (result != null)
                        {
                            objSave.lgId = result.InsertedId;
                        }
                    }

                    scope.Complete();
                }

                return(objSave.lgId);
            }
            catch (Exception ex)
            {
                Functions.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.FleetMakes, mySession.Current.UserId);
                return(0);
            }
        }
Esempio n. 2
0
        public ClsFleetMakes GetFleetMakesByFleetMakesId(long lgFleetMakesId)
        {
            ClsFleetMakes objClsFleetMakes = new ClsFleetMakes();

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

            return(objClsFleetMakes);
        }