public TrainingDefinitionViewModel(MerkatoDbContext context, TrainingDefinition B) : this(context)
 {
     this.Id              = B.Id;
     this.JobId           = B.JobId;
     this.TrainingName    = B.TrainingName;
     this.TraningMaterial = B.TraningMaterial;
 }
Exemple #2
0
        public AgentGradeViewModel(MerkatoDbContext context)
        {
            ActiveList = new List <SelectListItem>();

            loadLists(context);
            Id = 0;
        }
        public TrainingDefinitionViewModel(MerkatoDbContext context)
        {
            JobList = new List <SelectListItem>();

            loadLists(context);
            Id = 0;
        }
 public MechanismViewModel(MerkatoDbContext context, Mechanism mechanism) : this(context)
 {
     this.Id       = mechanism.Id;
     this.ClientId = mechanism.ClientId;
     this.Name     = mechanism.Name;
     this.Price    = mechanism.Price;
 }
Exemple #5
0
 public void loadLists(MerkatoDbContext context)
 {
     AgentList = context.Agent.Select(p => new SelectListItem()
     {
         Text = p.FirstName + " " + p.SurName, Value = p.Id.ToString()
     }).ToList();
 }
 public DepartmentViewModel(MerkatoDbContext context, Department B) : this(context)
 {
     this.Id     = B.Id;
     this.Code   = B.Code;
     this.Name   = B.Name;
     this.Active = B.Active;
 }
        public QualificationViewModel(MerkatoDbContext context)
        {
            ActiveList = new List <SelectListItem>();

            loadLists(context);
            Id = 0;
        }
Exemple #8
0
 public CurrencyViewModel(MerkatoDbContext context, Currency B) : this(context)
 {
     this.Id     = B.Id;
     this.Code   = B.Code;
     this.Name   = B.Name;
     this.Active = B.Active;
 }
Exemple #9
0
 public LocationViewModel(MerkatoDbContext context, Location B) : this(context)
 {
     this.Id     = B.Id;
     this.Code   = B.Code;
     this.Name   = B.Name;
     this.Status = B.Status;
 }
Exemple #10
0
        public LanguageProficiencyViewModel(MerkatoDbContext context)
        {
            ActiveList = new List <SelectListItem>();

            loadLists(context);
            Id = 0;
        }
        public DepartmentViewModel(MerkatoDbContext context)
        {
            ActiveList = new List <SelectListItem>();

            loadLists(context);
            Id = 0;
        }
Exemple #12
0
 public AgentStatusViewModel(MerkatoDbContext context, AgentStatus B) : this(context)
 {
     this.Id          = B.Id;
     this.Code        = B.Code;
     this.Name        = B.Name;
     this.Description = B.Description;
 }
Exemple #13
0
 public BankViewModel(MerkatoDbContext context, Bank B) : this(context)
 {
     this.Id     = B.Id;
     this.Code   = B.Code;
     this.Name   = B.Name;
     this.Active = B.Active;
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="to"></param>
        /// <param name="subject"></param>
        /// <param name="message"></param>
        /// <param name="Context"></param>
        public void SendEmail(List <string> to, string subject, string message, MerkatoDbContext Context)
        {
            if (_smtpConfig == null)
            {
                _smtpConfig = Parameters.Get <SmtpConfig>(SmtpConfig.KEY_NAME, Context);
            }

            if (string.IsNullOrWhiteSpace(subject))
            {
                subject = "Merkato Notification";
            }
            if (string.IsNullOrWhiteSpace(message))
            {
                message = $"{subject} Login credentilas.";
            }
            using (var smtpCleint = new SmtpClient(_smtpConfig.ServerAdress, _smtpConfig.ServerPort))
            {
                smtpCleint.DeliveryMethod        = System.Net.Mail.SmtpDeliveryMethod.Network;
                smtpCleint.UseDefaultCredentials = true;
                smtpCleint.Credentials           =
                    (System.Net.ICredentialsByHost) new System.Net.NetworkCredential(_smtpConfig.Credential.Username, _smtpConfig.Credential.Password);
                smtpCleint.EnableSsl = _smtpConfig.EnableSsl;
                var mailmessage = new MailMessage();
                mailmessage.Body       = message;
                mailmessage.Subject    = subject;
                mailmessage.IsBodyHtml = false;
                mailmessage.From       = new MailAddress(_smtpConfig.Credential.Username);
                foreach (var item in to)
                {
                    mailmessage.To.Add(item);
                }
                smtpCleint.Send(mailmessage);
            }
        }
        public ProductMechanismViewModel(MerkatoDbContext context)
        {
            ProductList   = new List <SelectListItem>();
            MechanismList = new List <SelectListItem>();

            loadLists(context);
        }
Exemple #16
0
        public int GetCurrentAgentId(string userName)
        {
            CallResult <int> result = new CallResult <int>();

            var agentId = 0;

            try
            {
                MerkatoDbContext context = new MerkatoDbContext(null);

                Agent agent = context.Agent.Where(a => a.AgentAppUserName.Equals(userName)).SingleOrDefault();

                agentId         = agent.Id;
                result.HasError = 0;
            }
            catch (Exception ex)
            {
                result.HasError      = 1;
                result.Error         = "Agent Not Found";
                result.InternalError = ex.Message;
                //_logger.LogError("Agent {agent} retreiving Failed", ex.Message);
            }

            return(agentId);
        }
Exemple #17
0
        public CurrencyViewModel(MerkatoDbContext context)
        {
            ActiveList = new List <SelectListItem>();

            loadLists(context);
            Id = 0;
        }
Exemple #18
0
        public JobRatingViewModel(MerkatoDbContext context)
        {
            ActiveList = new List <SelectListItem>();

            loadLists(context);
            Id = 0;
        }
Exemple #19
0
 public BankBranchViewModel(MerkatoDbContext context)
 {
     ActiveList = new List <SelectListItem>();
     BankList   = new List <SelectListItem>();
     loadLists(context);
     Id = 0;
 }
Exemple #20
0
 public JobRatingViewModel(MerkatoDbContext context, JobRating B) : this(context)
 {
     this.Id     = B.Id;
     this.Code   = B.Code;
     this.Name   = B.Name;
     this.Active = B.Active;
 }
Exemple #21
0
 public ActivityAssignmentViewModel(MerkatoDbContext context, ActivityAssignment A) : this(context)
 {
     this.Id             = A.Id;
     this.ActivityId     = A.ActivityId;
     this.AgentId        = A.AgentId;
     this.AssignmentDate = A.AssignmentDate;
 }
Exemple #22
0
        public void loadLists(MerkatoDbContext context)
        {
            ActiveList = context.ActiveList.Select(p => new SelectListItem()
            {
                Text = p.Name, Value = p.Id.ToString()
            }).ToList();
            //Products = (from cp in context.ClientProduct
            //            join p in context.Product on cp.ProductId equals p.Id
            //            join u in context.Unit on p.UnitId.Value equals u.Id
            //            where cp.ClientId == this.Id
            //            select new ClientProductViewModel()
            //            {
            //                ClientId = cp.ClientId,
            //                ProductId = cp.ProductId,
            //                Price = cp.Price,
            //                ProductCode = p.Code,
            //                ProductName = p.Name,
            //                ProductUnit = u.Name,
            //                Quantity = cp.Quantity

            //            }).ToList();

            //it should work lets try to show it int alist
            //where ist the view?
        }
Exemple #23
0
 public void loadLists(MerkatoDbContext context)
 {
     ActiveList = context.ActiveList.Select(p => new SelectListItem()
     {
         Text = p.Name, Value = p.Id.ToString()
     }).ToList();
 }
Exemple #24
0
 public ServiceViewModel(MerkatoDbContext context, Service B) : this(context)
 {
     this.Id          = B.Id;
     this.Code        = B.Code;
     this.Name        = B.Name;
     this.Description = B.Description;
     this.Active      = B.Active;
 }
Exemple #25
0
 public ClientsController(MerkatoDbContext context, UserManager <ApplicationUser> userManager, RoleManager <ApplicationRole> roleManager)
 {
     _context     = context;
     _userManager = userManager;
     _roleManager = roleManager;
     repository   = new Repository();
     mailSender   = new EmailNotificationSender();
 }
Exemple #26
0
 public AgentAvailabilityDetailsViewModel(MerkatoDbContext context, AgentAvailabilityDetails availabilityDetails) : this(context)
 {
     this.Id   = availabilityDetails.Id;
     this.Date = availabilityDetails.Date;
     this.AgentAvailabillityId = availabilityDetails.AgentAvailabillityId;
     this.UserId           = availabilityDetails.UserId;
     this.LastDateModified = availabilityDetails.LastDateModified;
 }
Exemple #27
0
        public AgentReportViewModel(MerkatoDbContext _context)
        {
            DepartmentList = new List <SelectListItem>();
            GenderList     = new List <SelectListItem>();


            loadLists(_context);
        }
 public ProductMechanismViewModel(MerkatoDbContext context, ProductMechanism product) : this(context)
 {
     this.Id           = product.Id;
     this.MechanismId  = product.MechanismId;
     this.ProductId    = product.ProductId;
     this.ProductOrder = product.ProductOrder;
     this.Quantity     = product.Quantity;
 }
Exemple #29
0
 public LanguageProficiencyViewModel(MerkatoDbContext context, LanguageProficiency B) : this(context)
 {
     this.Id          = B.Id;
     this.Code        = B.Code;
     this.Name        = B.Name;
     this.Description = B.Description;
     this.Active      = B.Active;
 }
Exemple #30
0
 public BaseController(UserManager <ApplicationUser> userManager, RoleManager <ApplicationRole> roleManager, ApplicationDbContext context, MerkatoDbContext dbContext, ILogger <BaseController> logger)
 {
     this.userManager = userManager;
     this.roleManager = roleManager;
     this.context     = context;
     this.dbContext   = dbContext;
     this._logger     = logger;
 }