public AgentDetailsModel(AgentDetails agentDetails)
        {
            // TODO: Complete member initialization
            if (agentDetails.AgentList != null)
                this.AgentList = (from b in agentDetails.AgentList
                                  select new AgentDetailsModel
                                  {
                                    Id = b.Id == null ? b.Id : encryptdecrypt.Encrypt(b.Id),
                                    First_Name = b.First_Name,
                                    Last_Name = b.Last_Name,
                                    Country = b.Country,
                                    Email = b.Email,
                                    Phone = b.Phone,
                                    Username = b.Username,
                                    SignUpDate=b.SignUpDate,
                                    Status=b.Status

                                  }).ToList();
            this.Id = agentDetails.Id == null ? agentDetails.Id : encryptdecrypt.Encrypt(agentDetails.Id);

            this.First_Name = agentDetails.First_Name;
            this.Last_Name = agentDetails.Last_Name;
            this.Country = agentDetails.Country;
            this.Email = agentDetails.Email;
            this.Phone = agentDetails.Phone;
            this.Username = agentDetails.Username;
            this.Password = encryptdecrypt.Decrypt(agentDetails.Password);
            this.SignUpDate = agentDetails.SignUpDate;
            this.Status = agentDetails.Status;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get agent details
        /// </summary>
        /// <param name="action">acrion for showing single or multiple agent details </param>
        /// <param name="id">agent id</param>
        /// <returns></returns>
        public AgentDetails GetAgent(string action, string id)
        {
            var result = new AgentDetails();
            string[,] str = new string[2, 2];
            str[0, 0] = "@action";
            str[0, 1] = action;
            str[1, 0] = "@id";
            str[1, 1] = id == null ? id : encryptdecrypt.Decrypt(id);
            string xmlResult = db.StoreprocedureExecuteQueryReturned("usp_Agent_GetAgent", str);
            var serializer = new XmlSerializer(typeof(AgentDetails));
            if (!string.IsNullOrEmpty(xmlResult))
            {
                using (var reader = new StringReader(xmlResult))
                {
                    result = (AgentDetails)serializer.Deserialize(reader);
                }
            }

            return result;
        }