Beispiel #1
0
        private IBundle cookMainBundle(int langId, CMSDBContext db)
        {
            var role = AuthorizationHelper.GetUserRole(this.User, db);

            if (role == null) //public role
            {
                role = db.Roles.SingleOrDefault(_role => _role.Name.Equals("Public"));
            }

            //TODO: tidy !!!
            var mainMenuItems = db.MenuItem_Language
                                .Include(_menu_item => _menu_item.MenuItem)
                                .ThenInclude(_item => _item.ChildMenu)
                                .ThenInclude(menu => menu.MenuItems)
                                .Where(_item => _item.MenuItem.MenuId == 1 && _item.LanguageId == langId)         // just main-menu
                                .ToList();

            //remove menu items which are not public or the current user doesn't have access to
            mainMenuItems.RemoveAll(menuItemLang =>
            {
                var itemRole = db.Roles.SingleOrDefault(_role => _role.Id == menuItemLang.MenuItem.RoleId);
                if (!itemRole.Name.Equals(role.Name) && !itemRole.Name.Equals("Public"))
                {
                    return(true);
                }
                return(false);
            });

            return(new MainBundle()
            {
                MainMenuItems = mainMenuItems,
                UserRole = role
            });
        }
Beispiel #2
0
 public ActionResult ResetPassword(string EmailId, ResetPasswordModel reset)
 {
     try
     {
         using (CMSDBContext context = new CMSDBContext())
         {
             ODZUser user = new ODZUser();
             user.EmailId = EmailId;
             var exists = context.ODZUsers.Where(a => a.EmailId == user.EmailId).FirstOrDefault();
             if (exists != null)
             {
                 //user.EmailId = exists.EmailId;
                 user.FirstName         = exists.FirstName;
                 user.LastName          = exists.LastName;
                 user.PasswordUpdatedOn = DateTime.Now;
                 user.Password          = reset.NewPassword;
                 context.ODZUsers.AddOrUpdate(user);
                 context.SaveChanges();
                 return(RedirectToAction("Index"));
             }
             else
             {
                 return(View());
             }
         }
     }
     catch (CmsExceptions ex)
     {
         logger.Error(ex.ToString());
         throw ex;
     }
 }
Beispiel #3
0
 public ActionResult LDZCases()
 {
     using (CMSDBContext context = new CMSDBContext())
     {
         LDZCas lDZCas = new LDZCas();
         return(View(context.LDZCases.ToList()));
     }
 }
Beispiel #4
0
 public ActionResult Edit(int lDZCaseId)
 {
     using (CMSDBContext context = new CMSDBContext())
     {
         ViewBag.ProviderName = new SelectList(context.Providers.ToList(), "ProviderName", "ProviderName");
         //ViewBag.CaseStatus = new SelectList(context.Providers.ToList(), "CaseStatus", "CaseStatus");
         var user = context.LDZCases.Where(a => a.LDZCaseId == lDZCaseId).FirstOrDefault();
         return(View(user));
     }
     // return View(user);
 }
Beispiel #5
0
 public ActionResult Edit(LDZCas lDZCas)
 {
     using (CMSDBContext context = new CMSDBContext())
     {
         ViewBag.ProviderName = new SelectList(context.Providers.ToList(), "ProviderName", "ProviderName");
         //ViewBag.CaseStatus = new SelectList(context.Providers.ToList(), "CaseStatus", "CaseStatus");
         context.LDZCases.AddOrUpdate(lDZCas);
         context.SaveChanges();
     }
     return(RedirectToAction(nameof(LDZCases)));
 }
Beispiel #6
0
 public static IEnumerable <Case> GetCase()
 {
     try
     {
         using (CMSDBContext context = new CMSDBContext())
         {
             return(context.Cases.ToList());
         }
     }
     catch (CmsExceptions ex)
     {
         throw ex;
     }
 }
Beispiel #7
0
 public PartialViewResult Edit(int caseId)
 {
     try
     {
         using (CMSDBContext context = new CMSDBContext())
         {
             ViewBag.ServiceId = new SelectList(CmsDAL.GetService(), "ServiceId", "ServiceId");
             var user = context.Cases.Where(a => a.CaseId == caseId).FirstOrDefault();
             return(PartialView(user));
         }
     }
     catch (CmsExceptions ex)
     {
         logger.Error(ex.ToString());
         throw ex;
     }
 }
Beispiel #8
0
 public ActionResult ODZHome()
 {
     try
     {
         using (CMSDBContext context = new CMSDBContext())
         {
             ViewData["EmailId"] = User.Identity.Name;
             //  ViewBag.Message = "Sent Successed!!";
             var user = context.Cases.ToList();
             return(View(user));
         }
     }
     catch (CmsExceptions ex)
     {
         logger.Error(ex.ToString());
         throw ex;
     }
 }
Beispiel #9
0
 public ActionResult Edit(Case issue)
 {
     try
     {
         ViewBag.ServiceId = new SelectList(CmsDAL.GetService(), "ServiceId", "ServiceId");
         using (CMSDBContext context = new CMSDBContext())
         {
             SendEmail(issue);
             context.Cases.AddOrUpdate(issue);
             context.SaveChanges();
         }
         return(View(issue));
     }
     catch (CmsExceptions ex)
     {
         logger.Error(ex.ToString());
         throw ex;
     }
 }
Beispiel #10
0
 private static void InsertToLDZCase(Case cas)
 {
     using (CMSDBContext context = new CMSDBContext())
     {
         if (cas != null)
         {
             LDZCas cc = new LDZCas();
             cc.EmailId             = cas.EmailId;
             cc.IncidentType        = cas.IncidentType;
             cc.IncidentDescription = cas.IncidentDescription;
             cc.ServiceId           = cas.ServiceId;
             cc.Location            = cas.Location;
             cc.CustomerPhone       = cas.CustomerPhone;
             cc.ProviderName        = "";
             cc.CaseStatus          = "Pending";
             context.LDZCases.Add(cc);
             context.SaveChanges();
         }
     }
 }
Beispiel #11
0
 public ActionResult ODZCaseCreat(Case issue)
 {
     try
     {
         ViewBag.ServiceId = new SelectList(CmsDAL.GetService(), "ServiceId", "ServiceId");
         using (CMSDBContext context = new CMSDBContext())
         {
             SendEmail(issue);
             InsertToLDZCase(issue);
             context.Cases.AddOrUpdate(issue);
             context.SaveChanges();
         }
     }
     catch (CmsExceptions ex)
     {
         logger.Error(ex.ToString());
         throw ex;
     }
     return(RedirectToAction(nameof(ODZHome)));
 }
Beispiel #12
0
 public static void GetWillExpireOn()
 {
     try
     {
         using (CMSDBContext context = new CMSDBContext())
         {
             var user = context.ODZUsers.ToList();
             foreach (var item in user)
             {
                 DateTime upDatedOn          = (DateTime)context.ODZUsers.Select(u => u.PasswordUpdatedOn).FirstOrDefault();
                 TimeSpan diff               = DateTime.Now - upDatedOn;
                 int      passwordExpirydays = Convert.ToInt32(ConfigurationManager.AppSettings["PasswordExpirydays"]);
                 int      reminderDelta      = Convert.ToInt32(ConfigurationManager.AppSettings["ReminderDelta"]);
                 if (diff.Days >= reminderDelta && diff.Days < passwordExpirydays)
                 {
                     MailMessage mail = new MailMessage();
                     mail.To.Add(new MailAddress("*****@*****.**"));
                     mail.From    = new MailAddress(ConfigurationManager.AppSettings["SMTPuser"]);
                     mail.Subject = "Password Expiry";
                     int remaineDaysForExpire = passwordExpirydays - diff.Days;
                     mail.Body = "Your Password will Expire in " + remaineDaysForExpire + " Days, So Change the Password";
                     SmtpClient smtp = new SmtpClient();
                     smtp.Host = "smtp.gmail.com";
                     smtp.Port = 587;
                     smtp.UseDefaultCredentials = false;
                     smtp.Credentials           = new System.Net.NetworkCredential
                                                      (ConfigurationManager.AppSettings["SMTPuser"], ConfigurationManager.AppSettings["SMTPpassword"]);// Enter seders User name and password
                     smtp.EnableSsl = true;
                     smtp.Send(mail);
                 }
             }
         }
     }
     catch (CmsExceptions ex)
     {
         throw ex;
     }
 }
Beispiel #13
0
 public static bool LDZUser(LDZUser lDZUser)
 {
     try
     {
         using (CMSDBContext context = new CMSDBContext())
         {
             var login = context.LDZUsers.Where(u => u.EmailId == lDZUser.EmailId && u.Password == lDZUser.Password).FirstOrDefault();
             if (login == null)
             {
                 return(false);
             }
             else
             {
                 return(true);
             }
             //return login;
         }
     }
     catch (CmsExceptions ex)
     {
         throw ex;
     }
 }
Beispiel #14
0
 public static bool AddCase(Case issue)
 {
     try
     {
         using (CMSDBContext context = new CMSDBContext())
         {
             context.Cases.Add(issue);
             int records = context.SaveChanges();
             if (records > 0)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     catch (CmsExceptions ex)
     {
         throw ex;
     }
 }
 public SourceService(CMSDBContext context)
 {
     _context = context;
 }
Beispiel #16
0
 public ProductRepository(CMSDBContext db)
 {
     this.db = db;
 }
 public UserFrontendController(CMSDBContext context)
 {
     db = context;
 }
Beispiel #18
0
 public LeadService(CMSDBContext context)
 {
     _context = context;
 }
 public StaffService(CMSDBContext context)
 {
     _context = context;
 }
Beispiel #20
0
 public ArticleController(CMSDBContext context, IHostingEnvironment env)
 {
     _context = context;
     _env     = env;
 }
 public UserRepository(CMSDBContext context) : base(context)
 {
 }
Beispiel #22
0
 public CategoryRepository(CMSDBContext db)
 {
     this.db = db;
 }
 public RoleBackendController(CMSDBContext context)
 {
     db = context;
 }
Beispiel #24
0
 public EmployeeRepository(CMSDBContext db)
 {
     this.db = db;
 }
 public Repository()
 {
     Context = new CMSDBContext();
 }
Beispiel #26
0
 public RouterController(IOptions <Settings> settings, IHttpContextAccessor context, CMSDBContext dbContext)
 {
     Settings = settings.Value;
     Context  = context;
     db       = dbContext;
 }
Beispiel #27
0
 public AdminRepository(CMSDBContext db)
 {
     this.db = db;
 }
 public Repository(CMSDBContext context)
 {
     Context      = context;
     shareContext = true;
 }
Beispiel #29
0
 public ItemRepository(CMSDBContext db)
 {
     this.db = db;
 }
 public UserBackendController(CMSDBContext context)
 {
     db = context;
 }