Exemple #1
0
        public MasterReportBound GetReceiveReportByBudgetYear(ReceiptsViewModel receiptsViewModel)
        {
            List <DRMFSS.BLL.ViewModels.Report.Data.ReceiveReportMain> reports = new List <ReceiveReportMain>();

            DRMFSS.BLL.ViewModels.Report.Data.ReceiveReportMain receivereport = new BLL.ViewModels.Report.Data.ReceiveReportMain();
            BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name);

            receivereport.receiveReports = _transactionService.GetReceiveReport(user.DefaultHub.HubID, receiptsViewModel);//new List<BLL.ViewModels.Report.Data.ReceiveReport>();
            receivereport.PreparedBy     = user.GetFullName();
            receivereport.HubName        = user.DefaultHub.HubNameWithOwner;
            receivereport.ReportDate     = System.DateTime.Now;
            receivereport.ReportCode     = DateTime.Now.ToString();
            receivereport.ReportName     = "ReceiveReport";
            receivereport.ReportTitle    = "Receive Report";
            reports.Add(receivereport);


            DRMFSS.Web.Reports.ReceiveReportByBudgetYear rpt = new Web.Reports.ReceiveReportByBudgetYear()
            {
                DataSource = receivereport.receiveReports
            };
            MasterReportBound report = new MasterReportBound()
            {
                Name = "Receive Report - " + DateTime.Now.ToShortDateString(), DataSource = reports
            };

            report.rptSubReport.ReportSource = rpt;
            return(report);
        }
Exemple #2
0
        public MasterReportBound GetOffloading(DispatchesViewModel dispatchesViewModel)
        {
            BLL.UserProfile         user    = _userProfileService.GetUser(User.Identity.Name);
            OffloadingReportMain    main    = new OffloadingReportMain();
            List <OffloadingReport> reports = _transactionService.GetOffloadingReport(user.DefaultHub.HubID, dispatchesViewModel);

            main.reports     = reports;
            main.PreparedBy  = user.GetFullName();
            main.HubName     = user.DefaultHub.HubNameWithOwner;
            main.ReportDate  = DateTime.Now;
            main.ReportName  = "OffloadingReport";
            main.ReportTitle = "Offloading";
            List <OffloadingReportMain> coll = new List <OffloadingReportMain>();

            coll.Add(main);
            OffLoadingReport rpt = new OffLoadingReport()
            {
                DataSource = reports
            };
            // XtraReport1 rpt = new XtraReport1() { DataSource = freestockreport.Programs[2].Details };
            MasterReportBound report = new MasterReportBound()
            {
                Name = "Offloading Report " + DateTime.Now.ToShortDateString(), DataSource = coll
            };

            report.rptSubReport.ReportSource = rpt;
            return(report);
        }
Exemple #3
0
        public MasterReportBound GetFreeStock(FreeStockFilterViewModel freeStockFilterViewModel)
        {
            List <DRMFSS.BLL.ViewModels.Report.Data.FreeStockReport> reports = new List <BLL.ViewModels.Report.Data.FreeStockReport>();

            DRMFSS.BLL.ViewModels.Report.Data.FreeStockReport freestockreport = new BLL.ViewModels.Report.Data.FreeStockReport();
            BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name);

            freestockreport.Programs    = _hubService.GetFreeStockGroupedByProgram(user.DefaultHub.HubID, freeStockFilterViewModel);
            freestockreport.PreparedBy  = user.GetFullName();
            freestockreport.HubName     = user.DefaultHub.HubNameWithOwner;
            freestockreport.ReportDate  = System.DateTime.Now;
            freestockreport.ReportName  = "FreeStockStatusReport";
            freestockreport.ReportTitle = "Free Stock Status";
            reports.Add(freestockreport);

            DRMFSS.Web.Reports.FreeStockReport rpt = new Web.Reports.FreeStockReport()
            {
                DataSource = freestockreport.Programs
            };
            // XtraReport1 rpt = new XtraReport1() { DataSource = freestockreport.Programs[2].Details };
            MasterReportBound report = new MasterReportBound()
            {
                DataSource = reports
            };

            report.rptSubReport.ReportSource = rpt;
            return(report);
        }
Exemple #4
0
        public MasterReportBound GetDonationReport()
        {
            var reports  = new List <BLL.ViewModels.Report.Data.DeliveryReport>();
            var donation = new BLL.ViewModels.Report.Data.DeliveryReport();

            BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name);

            donation.PreparedBy  = user.GetFullName();
            donation.ReportCode  = DateTime.Now.ToString();
            donation.ReportDate  = DateTime.Now;
            donation.ReportName  = "DistributionReport";
            donation.ReportTitle = "Distribution Report";
            Random ran = new Random(1);

            donation.Rows = new List <DeliveryRows>();
            for (int i = 1; i < 200; i++)
            {
                DeliveryRows r = new DeliveryRows();
                r.SINumber                = "00001283";
                r.Hub                     = donation.HubName;
                r.DeliveryOrderNumber     = i.ToString().PadLeft(8, '0');
                r.HubOwner                = "DRMFSS";
                r.PortName                = "Djibuti";
                r.ShippedBy               = "WFP";
                r.Vessel                  = "Liberty Sun";
                r.Project                 = "DRMFSS 4765";
                r.Commodity               = "Cereal";
                r.SubCommodity            = "Wheat";
                r.WareHouseNumber         = i / 50 + 1;
                r.Unit                    = "mt";
                r.DeliveryBag             = 99 * i * decimal.Parse("12");
                r.DeliveryQuantity        = 67 * i * decimal.Parse("34.89");
                r.DeliveryNet             = 23 * i * decimal.Parse("81");
                r.Donor                   = "US Aid";
                r.DeliveryType            = "Donation";
                r.DeliveryReferenceNumber = i.ToString().PadLeft(8, '0');
                r.Date                    = DateTime.Now.ToShortDateString();
                r.TransportedBy           = ((i % 3 == 0) ? " DRMFSS " : "Another Trasporter");
                r.VehiclePlateNumber      = "03-A0012" + (i / 24).ToString();
                donation.Rows.Add(r);
            }

            reports.Add(donation);

            DRMFSS.Web.Reports.DonationReportByProgram rpt = new Web.Reports.DonationReportByProgram()
            {
                DataSource = reports[0].Rows
            };
            MasterReportBound report = new MasterReportBound()
            {
                Name = "Donation Report - " + DateTime.Now.ToShortDateString(), DataSource = reports
            };

            report.rptSubReport.ReportSource = rpt;
            return(report);
        }
Exemple #5
0
        public MasterReportBound GetDistributionReportPivot(DistributionViewModel distributionViewModel)
        {
            List <DRMFSS.BLL.ViewModels.Report.Data.DistributionReport> reports = new List <BLL.ViewModels.Report.Data.DistributionReport>();

            DRMFSS.BLL.ViewModels.Report.Data.DistributionReport distribution = new BLL.ViewModels.Report.Data.DistributionReport();
            BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name);

            distribution.PreparedBy  = user.GetFullName();
            distribution.HubName     = user.DefaultHub.HubNameWithOwner;
            distribution.ReportCode  = DateTime.Now.ToString();
            distribution.ReportDate  = DateTime.Now;
            distribution.ReportName  = "DistributionReport";
            distribution.ReportTitle = "Distribution Report";
            distribution.Rows        = new List <DistributionRows>();

            distribution.Rows = _transactionService.GetDistributionReport(user.DefaultHub.HubID, distributionViewModel);
            //   new List<DistributionRows>();
            //for (int i = 1; i < 5; i++)
            //{
            //    DistributionRows r = new DistributionRows();
            //    r.BudgetYear = DateTime.Now.Year;
            //    r.Region = (i % 2 == 0) ? "Amhara" : "Benshangul";
            //    r.Program = "Program " + i.ToString();
            //    r.DistributedAmount = i * decimal.Parse("2340.43674") * 45;
            //    int month = i;
            //    if (month == 0)
            //        month++;
            //    r.Month = month.ToString();
            //    r.Quarter = (i % 3 > 0) ? (i / 3) + 1 : i / 3;
            //    distribution.Rows.Add(r);
            //}

            reports.Add(distribution);

            DRMFSS.Web.Reports.DistributionReportPivot rpt = new Web.Reports.DistributionReportPivot();
            rpt.xrPivotGrid1.DataSource = reports[0].Rows;
            MasterReportBound report = new MasterReportBound()
            {
                Name = "Distribution Report - " + DateTime.Now.ToShortDateString(), DataSource = reports
            };

            report.rptSubReport.ReportSource = rpt;
            return(report);
        }
Exemple #6
0
        public MasterReportBound GetDistributionReport()
        {
            var reports      = new List <BLL.ViewModels.Report.Data.DistributionReport>();
            var distribution = new BLL.ViewModels.Report.Data.DistributionReport();

            BLL.UserProfile user = _userProfileService.GetUser(User.Identity.Name);

            distribution.PreparedBy  = user.GetFullName();
            distribution.ReportCode  = DateTime.Now.ToString();
            distribution.ReportDate  = DateTime.Now;
            distribution.ReportName  = "DistributionReport";
            distribution.ReportTitle = "Distribution Report";
            Random ran = new Random(1);

            distribution.Rows = new List <DistributionRows>();
            for (int i = 1; i < 2; i++)
            {
                DistributionRows r = new DistributionRows();
                r.BudgetYear        = DateTime.Now.Year;
                r.Region            = (i % 2 == 0) ? "Amhara" : "Benshangul";
                r.Program           = "Program " + i.ToString();
                r.DistributedAmount = i * decimal.Parse("2340.43674") * 45;
                int month = ran.Next(4);
                r.Quarter = 1;
                distribution.Rows.Add(r);
            }

            reports.Add(distribution);

            DRMFSS.Web.Reports.DistributionReport rpt = new Web.Reports.DistributionReport()
            {
                DataSource = reports[0].Rows
            };
            MasterReportBound report = new MasterReportBound()
            {
                Name = "Distribution Report - " + DateTime.Now.ToShortDateString(), DataSource = reports
            };

            report.rptSubReport.ReportSource = rpt;
            return(report);
        }
Exemple #7
0
        public ActionResult ForgetPasswordRequest(Models.ForgotPasswordRequestModel model)
        {
            if (ModelState.IsValid)
            {
                BLL.UserProfile profile = _userProfileService.GetUser(model.UserName);
                if (profile != null && !profile.LockedInInd)
                {
                    BLL.ForgetPasswordRequest req = new BLL.ForgetPasswordRequest()
                    {
                        Completed     = false,
                        ExpieryDate   = DateTime.Now.AddMonths(2),
                        GeneratedDate = DateTime.Now,
                        RequestKey    = MD5Hashing.MD5Hash(Guid.NewGuid().ToString()),
                        UserProfileID = profile.UserProfileID
                    };
                    if (_forgetPasswordRequestService.AddForgetPasswordRequest(req))
                    {
                        string to      = profile.Email;
                        string subject = "Password Change Request";
                        string link    = Request.Url.Host + "/Account/ForgetPassword/?key=" + req.RequestKey;
                        string body    = string.Format(@"Dear {1}
                                                            <br /><br />
                                                        A password reset request has been submitted for your DRMFSS - CTS account. If you submitted this password reset request, please follow the following link. 
                                                        <br /><br />
                                                        <a href='{0}'>Please Follow this Link</a> <br />
                                                        <br /><br />
                                                        Please ignore this message if the password request was not submitted by you. This request will expire in 24 hours.
                                                        <br /><br />
                                                       Thank you,<br />
                                                       Administrator.
                                                        ", link, profile.GetFullName());

                        try
                        {
                            // Read the configuration table for smtp settings.

                            string from     = _settingService.GetSettingValue("SMTP_EMAIL_FROM");
                            string smtp     = _settingService.GetSettingValue("SMTP_ADDRESS");
                            int    port     = Convert.ToInt32(_settingService.GetSettingValue("SMTP_PORT"));
                            string userName = _settingService.GetSettingValue("SMTP_USER_NAME");
                            string password = _settingService.GetSettingValue("SMTP_PASSWORD");
                            // send the email using the utilty method in the shared dll.
                            Shared.SendMail mail = new Shared.SendMail(from, to, subject, body, null, true, smtp, userName, password, port);
                            return(RedirectToAction("ConfirmPasswordChange"));
                        }
                        catch (Exception e)
                        {
                            ViewBag.ErrorMessage = "The user name or email address you provided is not correct. Please try again.";
                        }
                    }
                    else
                    {
                        ViewBag.ErrorMessage = "The user name or email address you provided is not correct. Please try again.";
                    }
                }
                else
                {
                    ViewBag.ErrorMessage = "The user name or email address you provided is not correct. Please try again.";
                }
            }
            return(View("ForgetPasswordRequest", model));
        }