Ejemplo n.º 1
0
 public UserController(UserManager <User, int> userManager, WTContext context, IEmailService emailService, IUserService userService)
     : base(context)
 {
     _userManager  = userManager;
     _emailService = emailService;
     _userService  = userService;
 }
Ejemplo n.º 2
0
        public JsonResult CopyReport(int id)
        {
            int    affectedRows      = 0;
            string shouldCopyReports = ConfigurationManager.AppSettings["CopyReports"].ToUpper();

            if (shouldCopyReports.ToLower() == "true")
            {
                try
                {
                    using (var context = new WTContext())
                    {
                        SqlParameter reportCopiedFrom = new SqlParameter("@ReportCopiedFrom", SqlDbType.Int);
                        reportCopiedFrom.Value = id;
                        SqlParameter userId = new SqlParameter("@User_Id", SqlDbType.Int);
                        userId.Value = User.Identity.GetUserId <int>();
                        affectedRows = context.Database.ExecuteSqlCommand("spCopyReportWithReportData @User_Id, @ReportCopiedFrom", userId, reportCopiedFrom);
                    }
                }
                catch (Exception ex)
                {
                    ViewBag.BannerMessage = ex.Message;
                    ViewBag.BannerClass   = "alert-danger";
                }
            }
            return(Json(affectedRows));
        }
Ejemplo n.º 3
0
 public DataEntryController(WTContext context, UserManager <User, int> userManager, IUserService userService, IReportService reportService, IFileStorage storage, IAWSS3 s3Storage)
     : base(context)
 {
     this.userManager = userManager;
     _storage         = storage;
     _userService     = userService;
     _reportService   = reportService;
     _s3Storage       = s3Storage;
 }
        public ReportService(WTContext context, IFileStorage storage, IAWSS3 s3Storage)
        {
            Context = context;
            string storageType = ConfigurationManager.AppSettings["StorageType"].ToUpper();

            if (storageType == Constants.StorageType_AWSS3)
            {
                _AWSS3Storage = s3Storage;
            }
            else
            {
                _storage = storage;
            }
        }
        public void Delete(Report report)
        {
            string storageType = ConfigurationManager.AppSettings["StorageType"].ToUpper();

            using (var context = new WTContext())
            {
                var attachmentGuids = report.Attachments.Where(att => att.Report.Id == report.Id).Select(a => a.StorageId);
                foreach (var a in attachmentGuids)
                {
                    if (storageType == Constants.StorageType_AWSS3)
                    {
                        _AWSS3Storage.Remove(a);
                    }
                    else
                    {
                        _storage.Remove(a);
                    }
                }

                SqlParameter reportToDelete = new SqlParameter("@ReportId", SqlDbType.Int);
                reportToDelete.Value = report.Id;
                context.Database.ExecuteSqlCommand("spDeleteWaterTreatmentReport @ReportId", reportToDelete);
            }
        }
Ejemplo n.º 6
0
 public SiteController(WTContext context, IUserService userService) : base(context)
 {
     _userService = userService;
 }
 public UserService(WTContext context)
 {
     Context = context;
 }
Ejemplo n.º 8
0
 public EmailService(WTContext context)
 {
     Context = context;
 }
 public AccountController(UserManager <User, int> userManager, WTContext context, IEmailService emailService)
     : base(context)
 {
     this.userManager = userManager;
     _emailService    = emailService;
 }
 public SystemController(WTContext context) : base(context)
 {
 }
Ejemplo n.º 11
0
 public HomeController(WTContext context) : base(context)
 {
 }