Esempio n. 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public bool Crear(Dto.Usuario obj)
        {
            string strClave = obj.usuario.Substring(0, 4)
                + arrNumeros[new Random().Next(10)]
                + arrNumeros[new Random().Next(10)]
                + arrCaracteres[new Random().Next(26)]
                + arrSimbolos[new Random().Next(21)];

            obj.clave = strClave;

            bool blnResul = new Data.DUsuario().Insertar(obj);
            if (blnResul)
            {
                try
                {
                    if (string.IsNullOrEmpty(obj.correoelectronico))
                        obj.correoelectronico = System.Configuration.ConfigurationManager.AppSettings["GenericEmailTo"].ToString();

                    Utilidades.EnviarCorreo(obj.correoelectronico, Recursos.MsgMailUsuarioCreacion, Utilidades.PlantillasCorreo.CreaciónUsuario, obj.nombrecompleto, obj.usuario, obj.clave);
                }
                catch (Exception)
                {
                    //Procesar error
                    throw;
                }
            }

            return blnResul;
        }
        public void Test()
        {
            var e = new Entity
            {
                Color = Colors.Blue,
                Color2 = Colors.Green,
                Mood = Moods.VeryHappy,
                Mood2 = Moods.Great,
            };

            var dto = new Dto();
            dto.InjectFrom<EnumToInt>(e);

            Assert.AreEqual(2, dto.Color);
            Assert.AreEqual(1, dto.Color2);
            Assert.AreEqual(2, dto.Mood);
            Assert.AreEqual(3, dto.Mood2);


            var e2 = new Entity();
            e2.InjectFrom<IntToEnum>(dto);
            Assert.AreEqual(dto.Color, 2);
            Assert.AreEqual(dto.Color2, 1);
            Assert.AreEqual(dto.Mood, 2);
            Assert.AreEqual(dto.Mood2, 3);
        }
Esempio n. 3
0
 /// <summary>
 /// Gets the search tour model.
 /// </summary>
 /// <param name="search">The search.</param>
 /// <param name="pageIndex">Index of the page.</param>
 /// <param name="take">The take.</param>
 /// <param name="total">The total.</param>
 /// <returns></returns>
 public IQueryable<Dto.SearchTourDto> GetSearchTourModel(Dto.SearchInfoDto search, int pageIndex, int take, ref int total)
 {
     IQueryable<Dto.SearchTourDto> data = null;
     var temp = tourPlanRepository.GetList(e => e.Days <= search.Days && e.Days > ((search.Days - 2) > 0 ? (search.Days - 2) : 0))
         .Where(e => e.IsDelete == 0)
         .Where(e => e.PlanTitle.Contains(search.Bide) ||
             e.Destination.Contains(search.Bide) ||
             e.Remark.Contains(search.Bide)
         )
         .OrderByDescending(e => e.Days);
     total = temp.Count();
     data = temp.Select(e => new Dto.SearchTourDto
         {
             ViCount = e.VisitCount,
             Id = e.PlanID,
             PlanTitle = e.PlanTitle,
             Days = e.Days,
             TopReason = e.Destination,
             PlanTotalMoney = tourPlanDetailRepository.GetList(c => c.PlanID == e.PlanID).Sum(d => d.CurrentPrice),
             UserName = e.UserName,
             ClassId = e.PlanClass,
             AddTime = e.AddTime
         }).OrderByDescending(e => e.ViCount)
         .Skip(((pageIndex - 1) < 0 ? 0 : (pageIndex - 1)) * take)
         .Take(take).AsQueryable();
     return data;
 }
Esempio n. 4
0
        private void CreateCaracteristiqueTechniquePMZ()
        {
            var longeurCadre = 3;

            var values = new[] { "AR/", "PMZ ", "PT" };
            _lineCreator.Create(new byte[3] { 255, 255, 255 }, 4, 2, 1 + longeurCadre, values, false, BorderStyle.Thin);
        }
        public void Save(Dto.Action action)
        {
            if (action.Id < 0) {
                this.Add (action);
                return;
            }
            try {
                int tid = entity.BeginTransaction ();

                List<ColumnValue> columns = new List<ColumnValue> ();
                columns.Add (new ColumnValue () { Item1 = "gameId", Item2 = action.Game.Id.ToString() });
                columns.Add (new ColumnValue () { Item1 = "time", Item2 = action.Time.ToString("yyyy-MM-dd HH:mm:ss") });
                columns.Add (new ColumnValue () { Item1 = "description", Item2 = action.Description });
                if (action.Player != null) {
                    columns.Add (new ColumnValue () { Item1 = "playerId", Item2 = action.Player.Id.ToString() });
                } else {
                    columns.Add (new ColumnValue () { Item1 = "playerId", Item2 = null });
                }

                StatementValue where = new StatementValue ();
                where.Item1 = "id = @StatementValue0";
                where.Item2 = new List<string> ();
                where.Item2.Add (action.Id.ToString ());

                this.Update (columns, where);
                entity.Commit (tid);
            } catch (MySqlException ex) {
                entity.Rollback ();
                Debug.LogError ("Table " + this.Name + ": Failed to Save: " + ex.Message);
            }
        }
Esempio n. 6
0
        private void CreateCadreTitleArmoire(string geofibrePMZ)
        {
            var longeurCadre = 3;

            var values = new[] { "69264/VFC/PMZ/" + geofibrePMZ, string.Empty, string.Empty };
            _lineCreator.Create(new byte[3] { 153, 255, 153 }, 2, 2, 1 + longeurCadre, values, true, BorderStyle.Thin);
        }
Esempio n. 7
0
        /// <summary>
        /// 配信者を新規登録
        /// </summary>
        /// <param name="detail">チャンネル詳細</param>
        public static void Insert(Dto.ChannelDetail detail)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("INSERT ");
            sb.AppendLine("INTO `PecaTsuBBS`.`Channel` ( ");
            sb.AppendLine("  `ChannelName`");
            sb.AppendLine("  , `ChannelType`");
            sb.AppendLine(") ");
            sb.AppendLine("VALUES ( ");
            sb.AppendLine("  @ChannelName");
            sb.AppendLine("  , @ChannelType");
            sb.AppendLine(") ");

            Dictionary<string, string> paramDic = new Dictionary<string, string>();
            paramDic["ChannelName"] = detail.ChannelName;
            if (detail.IsYPInfo)
            {
                // YP
                paramDic["ChannelType"] = "1";
            }
            else
            {
                // 配信者
                paramDic["ChannelType"] = "0";
            }

            DBUtil.Update(sb.ToString(), paramDic);
        }
Esempio n. 8
0
        private void CreateIdentifiantPMZ(string identifiantPMZ)
        {
            var longeurCadre = 3;

            var values = new[] { identifiantPMZ, string.Empty, string.Empty };
            _lineCreator.Create(new byte[3] { 255, 255, 255 }, 9, 2, 1 + longeurCadre, values, true, BorderStyle.Thin);
        }
Esempio n. 9
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public IEnumerable<Dto.ItemLista> RecuperarFiltrado(Dto.ItemLista obj)
        {
            IEnumerable<Dto.ItemLista> lst = new Data.DItemsLista().RecuperarFiltrados(obj).ToList();
            this.RecuperarItemsHijo_ItemLista(lst);

            return lst;
        }
Esempio n. 10
0
        /// <summary>
        /// Searches the stations that satisfy the input condidions.
        /// </summary>
        /// <param name="input">Search conditions.</param>
        /// <returns>
        /// A task that represents the asynchronous operation.
        /// <para>
        /// The task result contains a <see cref="Dto.SearchStationsStartingWithOutput" />.
        /// </para>
        /// </returns>
        public async Task<Dto.SearchStationsStartingWithOutput> SearchStationsStartingWithAsync(Dto.SearchStationsStartingWithInput input)
        {
            await this._logger.LogInfoAsync("entered SearchStationsStartingWithAsync").ConfigureAwait(false);

            Dto.SearchStationsStartingWithOutput output = null;

            // logger cannot be awaited in catch / finally blocks, so using ExceptionDispatchInfo as a workarround
            // The support for this feature is coming in the Roslyn
            ExceptionDispatchInfo capturedException = null;

            try
            {
                await this._logger.LogInfoAsync("fetching stations").ConfigureAwait(false);

                // fetch stations
                var dataRep = await this._stationRepository.GetStationsStartingWithAsync(input.StartingWith).ConfigureAwait(false);

                await this._logger.LogInfoAsync("selecting possible characters").ConfigureAwait(false);

                // select possible next characters
                var nextPossibleCharacters = dataRep
                    .Where(p => p.Name.Length > input.StartingWith.Length)
                    .Select(p => p.Name[input.StartingWith.Length]);

                await this._logger.LogInfoAsync("mapping results").ConfigureAwait(false);

                // map to DTOs
                var mappedResult = dataRep.Select(p => new Dto.StationDto()
                {
                    Name = p.Name
                });

                // prepare output
                output = new Dto.SearchStationsStartingWithOutput()
                {
                    Stations = mappedResult,
                    NextPossbileCharacters = nextPossibleCharacters
                };
            }
            catch (Exception ex)
            {
                //capture the exception
                capturedException = ExceptionDispatchInfo.Capture(ex);
            }

            // if there's any captured exception, log it.
            if (capturedException != null)
            {
                await this._logger.LogExceptionAsync(capturedException.SourceException).ConfigureAwait(false);

                //rethrow the captured exception preserving the stack details
                capturedException.Throw();
            }

            await this._logger.LogInfoAsync("returning").ConfigureAwait(false);

            // return
            return output;
        }
Esempio n. 11
0
 public void Email_Test_GetInboxEmails()
 {
     string       email        = GetTestRecepientEmail().MD5();
     EmailService service      = new EmailService();
     Dto <Email>  emails       = service.GetInboxEmails(email, 0, 10, 0);
     int          count        = emails.TotalRows;
     int          serviceCount = service.CountInboxEmails(email, 0, 10, 0);
 }
            protected override object Update(Models.Dto.Order request)
            {
                var resp      = new Dto <Models.Dto.Order>();
                var newRecord = Handler.Save(request.FromDto(), true);

                resp.Result = newRecord.ToDto();
                return(resp);
            }
            public object Get(Models.Dto.Orders request)
            {
                var resp = new Dto <List <Models.Dto.Order> >();

                resp.Result = Handler.List(request.Skip, request.Take)
                              .ConvertAll(x => x.ToDto());
                return(resp);
            }
Esempio n. 14
0
            public object Get(Locations request)
            {
                var resp = new Dto <List <Models.Dto.Location> >();

                resp.Result = Handler.List(request.Skip, request.Take)
                              .ConvertAll(x => x.ConvertTo <Models.Dto.Location>());
                return(resp);
            }
Esempio n. 15
0
        public void CanGetDtoForDictionary()
        {
            Type dtoType = Dto.TypeFor("TestType", GetTestDictionary());

            Expect.IsNotNull(dtoType);
            Expect.AreEqual(3, dtoType.GetProperties().Length);
            Pass("dtoTypeFor");
        }
Esempio n. 16
0
        // --------------------------------------------------
        // CLONING
        // --------------------------------------------------

        #region Cloning

        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns>Returns a cloned instance.</returns>
        public override object Clone(params string[] areas)
        {
            DataReference dataReference = base.Clone(areas) as DataReference;

            dataReference.SetDto(Dto.Clone() as DataReferenceDto);

            return(dataReference);
        }
        protected virtual object Create(TDto request)
        {
            var resp      = new Dto <TDto>();
            var newRecord = Handler.Save(request.ConvertTo <TModel>());

            resp.Result = newRecord.ConvertTo <TDto>();
            return(resp);
        }
        private object Update(TDto request)
        {
            var resp      = new Dto <TDto>();
            var newRecord = Handler.Save(request.ConvertTo <TModel>());

            resp.Result = newRecord.ConvertTo <TDto>();
            return(resp);
        }
        public object Any(ListingsByUser request)
        {
            var dto     = new Dto <int>();
            var handler = new ReportHandler(Db, CurrentSession);

            dto.Result = handler.GetListingsByUser(CurrentSession.UserAuthId, request.StartDate, request.EndDate);
            return(dto);
        }
        public object Get(User request)
        {
            var response = new Dto <User>();

            response.Result = Handler.GetUser(request.Id).ToDto();

            return(response);
        }
        public ResultSingleSerialData HandleInsertEntity <T>(Dto dto)
            where T : class
        {
            var entityTypeName         = typeof(T).Name;
            var resultSingleSerialData = this.apiProviderDto.HandleInsertEntity(entityTypeName, dto);

            return(resultSingleSerialData);
        }
        protected override object Create(ProductImport request)
        {
            var resp       = new Dto <List <Product> >();
            var newRecords = Handler.SaveMany(request.Products.ConvertAll(x => x.ConvertTo <Models.Product>()));

            resp.Result = newRecords.ConvertAll(x => x.ConvertTo <Product>());
            return(resp);
        }
Esempio n. 23
0
        public object Get(ImageCount request)
        {
            var resp = new Dto <long>();

            resp.Result = Handler.Count(request.IncludeDeleted);

            return(resp);
        }
        public object Any(RevenueByUser request)
        {
            var dto     = new Dto <decimal>();
            var handler = new ReportHandler(Db, CurrentSession);

            dto.Result = handler.GetRevenueByUser(CurrentSession.UserAuthId, request.StartDate, request.EndDate);
            return(dto);
        }
        public object Get(InventoryTransactions request)
        {
            var resp = new Dto <List <Models.Dto.InventoryTransaction> >();

            resp.Result = Handler.List(request.Skip, request.Take).ConvertAll(x => x.ToDto());

            return(resp);
        }
Esempio n. 26
0
            public object Get(Vendors request)
            {
                var resp = new Dto <List <Models.Dto.Vendor> >();

                resp.Result = Handler.List(request.Skip, request.Take).Map(Models.Dto.Vendor.From);

                return(resp);
            }
        public object Any(InventoryTransactionCount request)
        {
            var resp = new Dto <long>();

            resp.Result = Handler.Count();

            return(resp);
        }
Esempio n. 28
0
 public void Delete(Dto.Action action)
 {
     StatementValue where = new StatementValue ();
     where.Item1 = "id = @StatementValue0";
     where.Item2 = new List<string> ();
     where.Item2.Add (action.Id.ToString ());
     this.Delete (where);
 }
Esempio n. 29
0
            public object Any(VendorCount request)
            {
                var resp = new Dto <long>();

                resp.Result = Handler.Count();

                return(resp);
            }
 private EntityConnection conn; // initialize from outside
 
 //...
 public int AddTreatment(Dto dto)
 {
     using (Context bdd = new Context(conn))
     {
         //Make some changes in database
         bdd.SaveChanges();
     }
 }
        public async Task <HttpResponseMessage> LeaveParkingPlace(Dto value)
        {
            string token = GetHeader("token");

            if (token == null || (token != null && !TokenManager.ValidateToken(token)))
            {
                return(Request.CreateResponse(HttpStatusCode.Unauthorized));
            }

            User loggedUser = usersService.GetLoggedUser(token);

            bool paidParkingPlaceFoundedAndRemoved = paidParkingPlacesService.RemovePaidParkingPlace(loggedUser, value.ParkingPlaceId);

            if (paidParkingPlaceFoundedAndRemoved)
            {
                Zone zone = null;
                try
                {
                    zone = zonesService.GetZone(value.ZoneId);
                }
                catch (Exception e)
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, e.Message));
                }

                ParkingPlace parkingPlace = null;
                try
                {
                    parkingPlace = zone.ParkingPlaces
                                   .Where(pp => pp.Id == value.ParkingPlaceId)
                                   .Single();
                }
                catch (Exception e)
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, e.Message));
                }

                lock (parkingPlace)
                {
                    if (parkingPlace.Status != ParkingPlaceStatus.TAKEN)
                    {
                        return(Request.CreateResponse(HttpStatusCode.BadRequest, "parkingPlace.Status == ParkingPlaceStatus.TAKEN"));
                    }

                    parkingPlace.Status = ParkingPlaceStatus.EMPTY;

                    lock (parkingPlace.Zone)
                    {
                        parkingPlace.Zone.Version++;
                        parkingPlace.Zone.AddParkingPlaceChange(parkingPlace.Id, parkingPlace.Status);
                    }
                }

                return(Request.CreateResponse(HttpStatusCode.OK));
            }

            return(Request.CreateResponse(HttpStatusCode.BadRequest));
        }
Esempio n. 32
0
        public override string ToString()
        {
            if (Dto != null)
            {
                return(Dto.ToString());
            }

            return(base.ToString());
        }
Esempio n. 33
0
        public async Task <CoreTypes.Family?> EditFamily(CoreTypes.Family family)
        {
            var familyDoc = Dto.serializeFamily(family);
            var result    = await _cosmos.UpsertFamily(familyDoc);

            var resultFamily = Dto.deserializeFamily(result);

            return(resultFamily.IsOk ? resultFamily.ResultValue : null);
        }
            public object Get(Categories request)
            {
                var resp = new Dto <List <Models.Dto.Category> >();

                resp.Result =
                    Handler.List(request.Skip, request.Take, request.IncludeDeleted).Map(Models.Dto.Category.From);

                return(resp);
            }
Esempio n. 35
0
 private async Task SendMessage(Message message, List <FileModel> attachments, Guid stamp)
 {
     var dto = Dto.CreateMessage(message, attachments);
     var ack = Dto.CreateMessageAck(message, stamp);
     await Task.WhenAll(
         Clients.OthersInGroup($"R{message.RoomId}").SendAsync("NewMessage", dto),
         Clients.Caller.SendAsync("MessageAck", ack)
         );
 }
		public void When_serializing_and_the_type_is_not_bytes()
		{
			var input = new Dto { Name = "Dave" };

			var serialized = _rawSerializer.Serialize(input);

			var expected = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(input));
			serialized.ShouldBe(expected);
		}
Esempio n. 37
0
        public void CheckDataMemberWithName()
        {
            var dto = new Dto();

            Validator.CheckDataMember(dto, x => x.Description).NotNull();
            var error = Validator.ErrorForKey("description");

            XAssert.IsNotNull(error);
        }
Esempio n. 38
0
        public void CheckDataMemberWithoutName()
        {
            var dto = new Dto();

            Validator.CheckDataMember(dto, x => x.Title).NotNull();
            var error = Validator.ErrorForKey("Title");

            XAssert.IsNotNull(error);
        }
Esempio n. 39
0
 public PhoneNumber(Dto obj)
 {
     if (obj is CRM.Data.Dto.PhoneNumber)
     {
         CRM.Data.Dto.PhoneNumber phoneNumber = (CRM.Data.Dto.PhoneNumber)obj;
         Number = phoneNumber.Number;
     }
     throw new ArgumentException();
 }
Esempio n. 40
0
        public void CheckNonDataMember()
        {
            var dto = new Dto();

            Validator.CheckDataMember(dto, x => x.NonMember).NotNull();
            var error = Validator.ErrorForKey("NonMember");

            XAssert.IsNotNull(error);
        }
Esempio n. 41
0
        public async Task <IHttpActionResult> RegisterUser(Poco.User credentials)
        {
            if (string.IsNullOrWhiteSpace(credentials.Email))
            {
                return(BadRequest("The email is not valid!"));
            }

            if (string.IsNullOrWhiteSpace(credentials.Password))
            {
                return(BadRequest("The password is not valid!"));
            }

            try
            {
                using (var ctx = new ChattyDbContext())
                {
                    User user = ctx.Users.SingleOrDefault(x => x.Email == credentials.Email);
                    if (user != null)
                    {
                        return(InternalServerError(new InvalidOperationException("This email has already taken!")));
                    }

                    user = new User {
                        Email = credentials.Email, Password = credentials.Password
                    };
                    user.Ticket = Guid.NewGuid().ToString();
                    ctx.Users.Add(user);
                    ctx.SaveChanges();

                    string            apiKey = System.Environment.GetEnvironmentVariable("SENDGRID_APIKEY");
                    SendGridAPIClient mc     = new SendGridAPIClient(apiKey);

                    Email   to      = new Email(user.Email);
                    Email   from    = new Email("*****@*****.**");
                    string  subject = "Welocme to Chatty!";
                    Content content = new Content("text/plain",
                                                  String.Format("Hi {0},\n\nYou registration on Chatty is almost complete. Please click on this link to confirm your registration!\n\n{1}",
                                                                user.Email.Split('@')[0],
                                                                String.Format("https://chatty-api.azurewebsites.net/users/confirm?ticket={0}", user.Ticket)));
                    Mail mail = new Mail(from, subject, to, content);

                    dynamic response = await mc.client.mail.send.post(requestBody : mail.Get());

                    return(Ok(Dto.Wrap(new Poco.User
                    {
                        UserId = user.UserId,
                        Email = user.Email,
                        AuthAccessToken = null,
                        AuthExpirationDate = null
                    })));
                }
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Esempio n. 42
0
        public void Bloom_Nothing_PropertyDoesntExist_Success()
        {
            var filter = new BloomFilter();
            var item   = new Dto {
                Name = "I'm not in the filter"
            };

            Assert.False(filter.PossiblyExists(item));
        }
Esempio n. 43
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public IEnumerable<Dto.Maquina> RecuperarFiltrado(Dto.Maquina obj)
 {
     IEnumerable<Dto.Maquina> lstResult = new Data.DMaquina().RecuperarFiltrados(obj).ToList();
     foreach (var item in lstResult)
     {
         item.VariacionesProduccion = this.RecuperarVPFiltrado(new Dto.MaquinaVariacionProduccion() { maquina_idmaquina = item.idmaquina }).ToList();
         item.DatosPeriodicos = this.RecuperarDPFiltrado(new Dto.MaquinaDatoPeriodico() { maquina_idmaquina = item.idmaquina }).ToList();
     }
     return lstResult;
 }
Esempio n. 44
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public IEnumerable<Dto.Rol> RecuperarFiltrado(Dto.Rol obj)
        {
            IEnumerable<Dto.Rol> lst = new Data.DRol().RecuperarFiltrados(obj).ToList();
            foreach (Dto.Rol item in lst)
            {
                item.permisos = new BPermiso().RecuperarFiltrado(new Dto.Permiso() { rol_idrol = item.idrol });
            }

            return lst;
        }
Esempio n. 45
0
        public IEnumerable<Dto.Funcionalidad> RecuperarFiltrado(Dto.Funcionalidad obj)
        {
            IEnumerable<Dto.Funcionalidad> lstResultado = new Data.DFuncionalidad().RecuperarFiltrados(obj).ToList();

            foreach (var item in lstResultado)
            {
                item.acciones = this.RecuperarAccionesFuncionalidad(item);
            }

            return lstResultado;
        }
Esempio n. 46
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 Dto.Rol ICMCotizar.Rol_Eliminar(Dto.Rol obj)
 {
     if (new Business.BRol().Eliminar(obj))
     {
         return obj;
     }
     else
     {
         throw new FaultException(new FaultReason("El rol no pudo ser actualizado."), new FaultCode("002"));
     }
 }
Esempio n. 47
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 Dto.Rol ICMCotizar.Rol_Insertar(Dto.Rol obj)
 {
     if (new Business.BRol().Crear(obj))
     {
         return obj;
     }
     else
     {
         throw new FaultException(new FaultReason("El rol no pudo ser creado."), new FaultCode("001"));
     }
 }
Esempio n. 48
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="idasesor"></param>
        /// <returns></returns>
        public bool Asesor_Insertar(Dto.Asesor obj, out byte? idasesor)
        {
            bool blnRespuesta = new Business.BAsesor().Crear(obj);

            if (blnRespuesta)
                idasesor = obj.idasesor;
            else
                idasesor = null;

            return blnRespuesta;
        }
Esempio n. 49
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public bool ValidaNombre(Dto.ItemLista obj)
 {
     Dto.ItemLista objExiste = new Data.DItemsLista().RecuperarFiltrados(obj).FirstOrDefault();
     if (objExiste != null)
     {
         return false;
     }
     else
     {
         return true;
     }
 }
Esempio n. 50
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public bool ValidaCodigo(Dto.Asesor obj)
 {
     Dto.Asesor objExiste = new Data.DAsesor().RecuperarFiltrados(obj).FirstOrDefault();
     if (objExiste != null)
     {
         return false;
     }
     else
     {
         return true;
     }
 }
Esempio n. 51
0
 public static Metadata Create(Dto.Metadata item)
 {
     return new Metadata
     {
         Guid = item.Guid.ToUUID(),
         EditingUserGuid = item.EditingUserGuid.ToUUID(),
         LanguageCode = item.LanguageCode,
         MetadataSchemaGuid = item.MetadataSchemaGuid.ToUUID(),
         MetadataXml = item.MetadataXml,
         DateCreated = item.DateCreated
     };
 }
 public static ObjectAccessPoint Create(Dto.ObjectAccessPoint item)
 {
     return new ObjectAccessPoint
         {
             AccessPointGuid = item.AccessPointGuid.ToUUID(),
             ObjectGuid = item.ObjectGuid.ToUUID(),
             StartDate = item.StartDate,
             EndDate = item.EndDate,
             DateCreated = item.DateCreated,
             DateModified = item.DateModified
         };
 }
Esempio n. 53
0
        private void RecuperarFuncionalidadesHijas(Dto.Funcionalidad obj, IEnumerable<Dto.Funcionalidad> Funcionalidades)
        {
            IEnumerable<Dto.Funcionalidad> lstFuncionalidadesHijas = Funcionalidades.Where(ee => ee.idpadre == obj.idfuncionalidad).ToList();
            if (lstFuncionalidadesHijas.Count() > 0)
            {
                foreach (Dto.Funcionalidad item in lstFuncionalidadesHijas)
                {
                    this.RecuperarFuncionalidadesHijas(item, Funcionalidades);
                }
            }

            obj.funcionalidades = lstFuncionalidadesHijas;
        }
Esempio n. 54
0
        public static void UpdateAddress(Dto.Address address)
        {
            using (var db = new Data.DrinkzAppBDDataContext())
            {
                var dbAddress = db.Addresses.Where(c=> c.FK_PROFILE == address.FK_PROFILE).FirstOrDefault();

                dbAddress.STATE = address.STATE;
                dbAddress.ZIP_CODE = address.ZIP_CODE;
                dbAddress.STREET = address.STREET;

                db.SubmitChanges();
            }
        }
Esempio n. 55
0
 public static Object Create(Dto.Object obj)
 {
     return new Object
     {
         Guid = obj.Guid.ToUUID(),
         ObjectTypeId = obj.ObjectTypeID,
         DateCreated = obj.DateCreated,
         Metadatas = obj.Metadatas.Select(item => Metadata.Create(item)).ToList(),
         ObjectRelations = obj.ObjectRelationInfos.Select(item => ObjectRelation.Create(item)).ToList(),
         Files = obj.Files.Select(item => FileInfo.Create(item)).ToList(),
         AccessPoints = obj.AccessPoints.Select(item => ObjectAccessPoint.Create(item)).ToList()
     };
 }
Esempio n. 56
0
 public bool DeleteAzienda(Dto.AziendaDto azienda)
 {
     try
     {
         var wcf = new EntitiesModelService();
         wcf.DeleteAzienda(azienda);
         return true;
     }
     catch (Exception ex)
     {
         UtilityError.Write(ex);
     }
     return false;
 }
 public FaturaBuilder InserirLancamento(Dto.Lancamento lancamento)
 {
     if (sfnFatura.Lancamentos == null)
         sfnFatura.Lancamentos = new List<SfnFaturaLanc>();
     sfnFatura.Lancamentos.Add(new SfnFaturaLanc()
     {
         HandleFatura = sfnFatura.Handle,
         Data = DateTime.Today,
         TipoLancamentoFinanceiro = lancamento.TipoLancamentoFinanciero,
         Valor = lancamento.Valor
     });
     repLancamento.Incluir(sfnFatura.Lancamentos.Last());
     return this;
 }
Esempio n. 58
0
        private List<Country> GetCountries(Dto.countriesReponse response)
        {
            var countries = new List<Country>();

            foreach(var country in response.countries)
            {
                countries.Add(new Country
                {
                    Name = country.value,
                    HRef = country.href
                });
            }

            return countries;
        }
Esempio n. 59
0
 protected override void Because_of()
 {
     _source = new Model
     {
         Id = Guid.NewGuid(),
         FooId = Guid.NewGuid(),
         ShortDescription = "Yoyodyne Foo",
         FullDescription = "Deluxe Foo Manufactured by Yoyodyne, Inc.",
         Date = DateTime.Now,
         IntValue = 13,
     };
     var plan = Configuration.BuildExecutionPlan(typeof(Model), typeof(Dto));
     var context = ((IRuntimeMapper)Mapper).DefaultContext;
     _destination = ((Func<Model, Dto, ResolutionContext, Dto>)plan.Compile())(_source, null, context);
 }
Esempio n. 60
0
 public Dto.AziendaDto CreateAzienda(Dto.AziendaDto azienda)
 {
     try
     {
         var wcf = new EntitiesModelService();
         var dtoKey = wcf.CreateAzienda(azienda);
         var newAzienda = wcf.ReadAzienda(dtoKey);
         return newAzienda;
     }
     catch (Exception ex)
     {
         UtilityError.Write(ex);
     }
     return null;
 }