Ejemplo n.º 1
0
        public long SaveTripReason(ClsTripReason objSave)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (this.objDataContext = new TripReasonDataContext(Functions.StrConnection))
                    {
                        var result = this.objDataContext.InsertOrUpdateTripReason(objSave.lgId, objSave.strTripReasonName, mySession.Current.UserId, PageMaster.TripReason).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.TripReason, mySession.Current.UserId);
                return(0);
            }
        }
Ejemplo n.º 2
0
        public ClsTripReason GetTripReasonByTripReasonId(long lgTripReasonId)
        {
            ClsTripReason objClsTripReason = new ClsTripReason();

            try
            {
                using (this.objDataContext = new TripReasonDataContext(Functions.StrConnection))
                {
                    GetTripReasonByIdResult item = this.objDataContext.GetTripReasonById(lgTripReasonId).ToList().FirstOrDefault();
                    if (item != null)
                    {
                        objClsTripReason.lgId = item.Id;
                        objClsTripReason.strTripReasonName = item.TripReasonName;
                    }
                }
            }
            catch (Exception ex)
            {
                Functions.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.TripReason, mySession.Current.UserId);
            }

            return(objClsTripReason);
        }