private void ShowReport(Infrastructure.Report.ExportType reportType)
        {
            var varList =
                (GridControl.ItemsSource as System.Collections.Generic.List <ViewModels.MemberTransactionViewModel>)
                .OrderBy(current => current.Date)
                .Select(current => new
            {
                current.AmountRialFormat,
                current.PersianDate,
                current.TransactionDescription,
            })
                .ToList();

            Stimulsoft.Report.StiReport oStiReport = new Stimulsoft.Report.StiReport();

            oStiReport.Load(Properties.Resources.MemberTransactionsReport);
            oStiReport.Dictionary.Variables.Add("Today", System.DateTime.Now.ToPersianDate());
            oStiReport.Dictionary.Variables.Add("FundName", Utility.CurrentFund.Name);
            oStiReport.Dictionary.Variables.Add("FundManagerName", Utility.CurrentFund.ManagerName);
            oStiReport.Dictionary.Variables.Add("MemberName", Utility.CurrentMember.FullName.ToString());
            oStiReport.RegBusinessObject("Transactions", varList);
            oStiReport.Compile();
            oStiReport.RenderWithWpf();
            oStiReport.DoAction(action: reportType, fileName: "گزارش واریز اعضا");
        }
Exemplo n.º 2
0
        private void ShowReport(Infrastructure.Report.ExportType reportType)
        {
            var varList = (InstallmentPerLoanGridControl.ItemsSource as System.Collections.Generic.List <ViewModels.InstallmentViewModel>)
                          .Select(current => new
            {
                current.AmountRialFormat,
                current.PersianInstallmentDate,
                current.PersianPaymentDate,
                current.IsPayedDescription,
            })
                          .ToList();

            Stimulsoft.Report.StiReport oStiReport = new Stimulsoft.Report.StiReport();

            oStiReport.Load(Properties.Resources.InstallmentListReport);

            oStiReport.Dictionary.Variables.Add("Today", System.DateTime.Now.ToPersianDate());
            oStiReport.Dictionary.Variables.Add("FundName", Utility.CurrentFund.Name);
            oStiReport.Dictionary.Variables.Add("FundManagerName", Utility.CurrentFund.ManagerName);
            oStiReport.Dictionary.Variables.Add("MemberName", Utility.CurrentLoan.Member.FullName.ToString());
            oStiReport.Dictionary.Variables.Add("LoanAmount", (new ViewModels.LoanViewModel {
                LoanAmount = Utility.CurrentLoan.LoanAmount
            }).LoanAmountRialFormat);
            oStiReport.Dictionary.Variables.Add("RefundAmount", (new ViewModels.LoanViewModel {
                RefundAmount = Utility.CurrentLoan.RefundAmount
            }).RefundAmountRialFormat);

            oStiReport.RegBusinessObject("InstallmentsList", varList);
            oStiReport.Compile();
            oStiReport.RenderWithWpf();
            oStiReport.DoAction(action: reportType, fileName: "گزارش لیست اقساط");
        }
        private void ShowReport(Infrastructure.Report.ExportType reportType)
        {
            var varObject = new
            {
                LoansCount              = LoansCountLabel.Content,
                LoansAmount             = LoansAmountLabel.Content,
                PayedLoansCount         = PayedLoansCountLabel.Content,
                PayedLoansAmount        = PayedLoansAmountLabel.Content,
                InstallmentsCount       = InstallmentsCountLabel.Content,
                InstallmentsAmount      = InstallmentsAmountLabel.Content,
                PayedInstallmentsCount  = PayedInstallmentsCountLabel.Content,
                PayedInstallmentsAmount = PayedInstallmentsAmountLabel.Content,
            };

            Stimulsoft.Report.StiReport oStiReport = new Stimulsoft.Report.StiReport();

            oStiReport.Load(Properties.Resources.FundBalanceReport);

            oStiReport.Dictionary.Variables.Add("Today", System.DateTime.Now.ToPersianDate());
            oStiReport.Dictionary.Variables.Add("FundName", Utility.CurrentFund.Name);
            oStiReport.Dictionary.Variables.Add("FundManagerName", Utility.CurrentFund.ManagerName);
            oStiReport.Dictionary.Variables.Add("FundBalance", Utility.CurrentFund.Balance.ToRialStringFormat());

            oStiReport.RegBusinessObject("MemberBalance", varObject);
            oStiReport.Compile();
            oStiReport.RenderWithWpf();

            oStiReport.DoAction(action: reportType, fileName: "تراز مالی " + Utility.CurrentMember.FullName.ToString());
        }
        private void ShowReport(Infrastructure.Report.ExportType reportType)
        {
            DAL.UnitOfWork oUnitOfWork = null;

            try
            {
                oUnitOfWork = new DAL.UnitOfWork();

                var varList = oUnitOfWork.UserRepository
                              .Get()
                              .OrderBy(current => current.Username)
                              .Select(current => new ViewModels.UserViewModel()
                {
                    Id                = current.Id,
                    Username          = current.Username,
                    RegisterationDate = current.RegisterationDate,
                    IsAdmin           = current.IsAdmin,
                    LastLoginTime     = current.LastLoginTime,
                })
                              .ToList();

                var varListToReport = varList
                                      .OrderBy(current => current.Username)
                                      .Select(current => new
                {
                    Username = current.Username,
                    PersianRegisterationDate = current.PersianRegisterationDate,
                    IsAdminDescription       = current.IsAdminDescription,
                    PersianLastLoginTime     = current.PersianLastLoginTime,
                })
                                      .ToList();

                Stimulsoft.Report.StiReport usersReport = new Stimulsoft.Report.StiReport();

                usersReport.Load(Properties.Resources.UsersViewReport);
                usersReport.Dictionary.Variables.Add("Today", System.DateTime.Now.ToPersianDate());
                usersReport.RegBusinessObject("Users", varListToReport);
                usersReport.Compile();
                usersReport.RenderWithWpf();

                usersReport.DoAction(reportType, "گزارش کاربران");

                oUnitOfWork.Save();
            }
            catch (System.Exception ex)
            {
                Infrastructure.MessageBox.Show(ex.Message);
            }
            finally
            {
                if (oUnitOfWork != null)
                {
                    oUnitOfWork.Dispose();
                    oUnitOfWork = null;
                }
            }
        }
Exemplo n.º 5
0
        private void OBackgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            this.Dispatcher.Invoke(() =>
            {
                EnterEmailPasswordWindow oEnterEmailPasswordWindow = e.Argument as EnterEmailPasswordWindow;

                var varList = (InstallmentPerLoanGridControl.ItemsSource as System.Collections.Generic.List <ViewModels.InstallmentViewModel>)
                              .Select(current => new
                {
                    current.AmountRialFormat,
                    current.PersianInstallmentDate,
                    current.PersianPaymentDate,
                    current.IsPayedDescription,
                })
                              .ToList();

                Stimulsoft.Report.StiReport oStiReport = new Stimulsoft.Report.StiReport();

                oStiReport.Load(Properties.Resources.InstallmentListReport);

                oStiReport.Dictionary.Variables.Add("Today", System.DateTime.Now.ToPersianDate());
                oStiReport.Dictionary.Variables.Add("FundName", Utility.CurrentFund.Name);
                oStiReport.Dictionary.Variables.Add("FundManagerName", Utility.CurrentFund.ManagerName);
                oStiReport.Dictionary.Variables.Add("MemberName", Utility.CurrentLoan.Member.FullName.ToString());
                oStiReport.Dictionary.Variables.Add("LoanAmount", (new ViewModels.LoanViewModel {
                    LoanAmount = Utility.CurrentLoan.LoanAmount
                }).LoanAmountRialFormat);
                oStiReport.Dictionary.Variables.Add("RefundAmount", (new ViewModels.LoanViewModel {
                    RefundAmount = Utility.CurrentLoan.RefundAmount
                }).RefundAmountRialFormat);

                oStiReport.RegBusinessObject("InstallmentsList", varList);
                oStiReport.Compile();
                oStiReport.RenderWithWpf();

                System.IO.MemoryStream oMemoryStream = new System.IO.MemoryStream();

                oStiReport.ExportDocument(Stimulsoft.Report.StiExportFormat.Pdf, oMemoryStream);
                oMemoryStream.Seek(0, System.IO.SeekOrigin.Begin);

                Utility.SendEmail
                (
                    senderEmail: Utility.CurrentUser.EmailAddress,
                    senderPassword: oEnterEmailPasswordWindow.EmailPassword,
                    displayName: Utility.CurrentUser.FullName.ToString(),
                    receiverEmail: Utility.CurrentMember.EmailAddress,
                    subject: Utility.CurrentFund.Name + " | " + "لیست اقساط " + Utility.CurrentMember.FullName.ToString(),
                    body: "لیست اقساط " + Utility.CurrentMember.FullName.ToString() +
                    System.Environment.NewLine +
                    new FarsiLibrary.Utils.PersianDate(System.DateTime.Now).ToString(),
                    attachment: oMemoryStream,
                    attachmentName: "لیست اقساط " + Utility.CurrentMember.FullName.ToString()
                );
            });
        }
Exemplo n.º 6
0
        public ActionResult LoadReport()
        {
            var product = db.Products.OrderByDescending(p => p.Quantity).Take(8).ToList();
            var R       = new Stimulsoft.Report.StiReport();

            R.Load(Server.MapPath("/Reports/QtyReport.mrt"));
            R.Compile();
            R.RegBusinessObject("myData", product);

            return(Stimulsoft.Report.Mvc.StiMvcViewer.GetReportSnapshotResult(R));
        }
        private void OBackgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            this.Dispatcher.Invoke(() =>
            {
                EnterEmailPasswordWindow oEnterEmailPasswordWindow = e.Argument as EnterEmailPasswordWindow;

                var varObject = new
                {
                    LoansCount              = LoansCountLabel.Content,
                    LoansAmount             = LoansAmountLabel.Content,
                    PayedLoansCount         = PayedLoansCountLabel.Content,
                    PayedLoansAmount        = PayedLoansAmountLabel.Content,
                    InstallmentsCount       = InstallmentsCountLabel.Content,
                    InstallmentsAmount      = InstallmentsAmountLabel.Content,
                    PayedInstallmentsCount  = PayedInstallmentsCountLabel.Content,
                    PayedInstallmentsAmount = PayedInstallmentsAmountLabel.Content,
                };

                Stimulsoft.Report.StiReport oStiReport = new Stimulsoft.Report.StiReport();

                oStiReport.Load(Properties.Resources.FundBalanceReport);

                oStiReport.Dictionary.Variables.Add("Today", System.DateTime.Now.ToPersianDate());
                oStiReport.Dictionary.Variables.Add("FundName", Utility.CurrentFund.Name);
                oStiReport.Dictionary.Variables.Add("FundManagerName", Utility.CurrentFund.ManagerName);
                oStiReport.Dictionary.Variables.Add("FundBalance", Utility.CurrentFund.Balance.ToRialStringFormat());

                oStiReport.RegBusinessObject("MemberBalance", varObject);
                oStiReport.Compile();
                oStiReport.RenderWithWpf();

                System.IO.MemoryStream oMemoryStream = new System.IO.MemoryStream();

                oStiReport.ExportDocument(Stimulsoft.Report.StiExportFormat.Pdf, oMemoryStream);
                oMemoryStream.Seek(0, System.IO.SeekOrigin.Begin);

                Utility.SendEmail
                (
                    senderEmail: Utility.CurrentUser.EmailAddress,
                    senderPassword: oEnterEmailPasswordWindow.EmailPassword,
                    displayName: Utility.CurrentUser.FullName.ToString(),
                    receiverEmail: Utility.CurrentMember.EmailAddress,
                    subject: Utility.CurrentFund.Name + " | " + "تراز مالی عضو  " + Utility.CurrentMember.FullName.ToString(),
                    body: "تراز مالی " + Utility.CurrentMember.FullName.ToString() +
                    System.Environment.NewLine +
                    new FarsiLibrary.Utils.PersianDate(System.DateTime.Now).ToString(),
                    attachment: oMemoryStream,
                    attachmentName: "تراز مالی " + Utility.CurrentMember.FullName.ToString()
                );
            });
        }
Exemplo n.º 8
0
 private void Print_Click(object sender, EventArgs e)
 {
     try
     {
         Stimulsoft.Report.StiReport rpt = new Stimulsoft.Report.StiReport();
         string startupPath = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
         rpt.Load(startupPath + "\\Reports\\GoodsReport.mrt");
         rpt.Dictionary.Variables["today"].Value = DateTodayFullChar();
         rpt.RegBusinessObject("Goods", (List <Connection.Services.GoodsService>)dataGridView1.DataSource);
         rpt.Render();
         rpt.Show();
     }
     catch (Exception ex)
     {
         System.Windows.Forms.MessageBox.Show(ex.ToString());
     }
 }
Exemplo n.º 9
0
        public ShellViewModel()
        {
            _ProductCollection = new List <ProductModel>()
            {
                new ProductModel()
                {
                    Name = "Product 1", Price = 100
                },
                new ProductModel()
                {
                    Name = "Product 2", Price = 200
                }
            };

            ActiveReport = new Stimulsoft.Report.StiReport();
            ActiveReport.RegBusinessObject("Products", _ProductCollection);
            ActiveReport.Dictionary.Synchronize();
        }
Exemplo n.º 10
0
        private void ShowReport(Infrastructure.Report.ExportType reportType)
        {
            var varList = (MembersLoanGridControl.ItemsSource as System.Collections.Generic.List <ViewModels.LoanViewModel>)
                          .OrderBy(current => current.StartDate)
                          .Select(current => new
            {
                current.LoanAmountRialFormat,
                current.RefundAmountRialFormat,
                current.PersianEndDate,
                current.PersianStartDate,
                current.InstallmentsCount,
                current.IsPayedDescrption,
                current.Description,
            })
                          .ToList();

            if (varList.Count == 0)
            {
                Infrastructure.MessageBox.Show
                (
                    caption: Infrastructure.MessageBox.Caption.Error,
                    text: "اطلاعاتی برای تهیه گزارش در جدول موجود نمی‌باشد. "
                );

                return;
            }

            Stimulsoft.Report.StiReport oStiReport = new Stimulsoft.Report.StiReport();

            oStiReport.Load(Properties.Resources.MembersLoansListReport);

            oStiReport.Dictionary.Variables.Add("Today", System.DateTime.Now.ToPersianDate());
            oStiReport.Dictionary.Variables.Add("FundName", Utility.CurrentFund.Name);
            oStiReport.Dictionary.Variables.Add("FundManagerName", Utility.CurrentFund.ManagerName);
            oStiReport.Dictionary.Variables.Add("MemberName", Utility.CurrentMember.FullName.ToString());
            oStiReport.Dictionary.Variables.Add("LoanStatus", LoanStatusComboBox.Text);
            oStiReport.RegBusinessObject("Loans", varList);
            oStiReport.Compile();
            oStiReport.RenderWithWpf();

            string fileName = string.Format("گزارش {0} {1}", LoanStatusComboBox.Text, Utility.CurrentMember.FullName.ToString());

            oStiReport.DoAction(action: reportType, fileName: fileName);
        }
Exemplo n.º 11
0
        private void ShowReport(Infrastructure.Report.ExportType reportType)
        {
            var varList = (LoansGridControl.ItemsSource as System.Collections.Generic.List <Models.Loan>)
                          .OrderBy(current => current.StartDate)
                          .Select(current => new ViewModels.LoanViewModel()
            {
                IsPayed           = current.IsPayed,
                IsActive          = current.IsActive,
                LoanAmount        = current.LoanAmount,
                RefundAmount      = current.RefundAmount,
                EndDate           = current.EndDate,
                StartDate         = current.StartDate,
                InstallmentsCount = current.InstallmentsCount,
                MemberId          = current.MemberId,
            })
                          .Select(current => new
            {
                current.LoanAmountRialFormat,
                current.RefundAmountRialFormat,
                current.PersianEndDate,
                current.PersianStartDate,
                current.InstallmentsCount,
                current.IsPayedDescrption,
                FullName = current.FullName.ToString(),
            })
                          .ToList();

            ;


            Stimulsoft.Report.StiReport oStiReport = new Stimulsoft.Report.StiReport();

            oStiReport.Load(Properties.Resources.ConfirmedLoansListReport);

            oStiReport.Dictionary.Variables.Add("Today", System.DateTime.Now.ToPersianDate());
            oStiReport.Dictionary.Variables.Add("FundName", Utility.CurrentFund.Name);
            oStiReport.Dictionary.Variables.Add("FundManagerName", Utility.CurrentFund.ManagerName);
            oStiReport.RegBusinessObject("Loans", varList);
            oStiReport.Compile();
            oStiReport.RenderWithWpf();

            oStiReport.DoAction(action: reportType, fileName: "گزارش وام‌های پرداختی");
        }
Exemplo n.º 12
0
        private void ShowReport(Infrastructure.Report.ExportType reportType)
        {
            var varList =
                (GridControl.ItemsSource as System.Collections.Generic.List <ViewModels.TransactionViewModel>)
                .OrderBy(current => current.Date)
                .Select(current => new
            {
                current.AmountRialFormat,
                current.BalanceRialFormat,
                current.PersianDate,
                current.TransactionDescription,
                MemberFullName = current.MemberFullName.ToString(),
            })
                .ToList();

            if (varList.Count == 0)
            {
                Infrastructure.MessageBox.Show
                (
                    caption: Infrastructure.MessageBox.Caption.Error,
                    text: "اطلاعاتی برای تهیه گزارش در جدول موجود نمی‌باشد. " + System.Environment.NewLine + "لطفا بازه زمانی دیگری را انتخاب نمایید."
                );

                return;
            }

            Stimulsoft.Report.StiReport oStiReport = new Stimulsoft.Report.StiReport();

            oStiReport.Load(Properties.Resources.TransactionsReport);
            oStiReport.Dictionary.Variables.Add("Today", System.DateTime.Now.ToPersianDate());
            oStiReport.Dictionary.Variables.Add("FundName", Utility.CurrentFund.Name);
            oStiReport.Dictionary.Variables.Add("FundManagerName", Utility.CurrentFund.ManagerName);
            oStiReport.Dictionary.Variables.Add("FromDate", varList.Select(current => current.PersianDate).FirstOrDefault());
            oStiReport.Dictionary.Variables.Add("ToDate", varList.Select(current => current.PersianDate).LastOrDefault());
            oStiReport.RegBusinessObject("Transactions", varList);
            oStiReport.Compile();
            oStiReport.RenderWithWpf();
            oStiReport.DoAction(action: reportType, fileName: "گزارش ریز حساب صندوق");
        }
Exemplo n.º 13
0
        private static byte[] GetPdfBytes(byte[] reportTemplate, List <ReportDataSource> dataSources)
        {
            using (Stimulsoft.Report.StiReport stiReport = new Stimulsoft.Report.StiReport())
            {
                foreach (var dataSource in dataSources)
                {
                    stiReport.RegBusinessObject(dataSource.DataSourceName, dataSource.DataSource);
                }

                stiReport.Load(reportTemplate);
                stiReport.Render();

                byte[] result = null;
                using (MemoryStream stream = new MemoryStream())
                {
                    StiPdfExportService pdfService = new StiPdfExportService();
                    pdfService.ExportPdf(stiReport, stream);
                    result = stream.ToArray();
                }
                return(result);
            }
        }
Exemplo n.º 14
0
        private void ShowReport(Infrastructure.Report.ExportType reportType)
        {
            DAL.UnitOfWork oUnitOfWork = null;

            try
            {
                oUnitOfWork = new DAL.UnitOfWork();

                var varList = oUnitOfWork.MemberRepository
                              .MembersToReport()
                              .ToList();

                Stimulsoft.Report.StiReport oReport = new Stimulsoft.Report.StiReport();

                oReport.Load(Properties.Resources.MembersViewReport);
                oReport.Dictionary.Variables.Add("Today", System.DateTime.Now.ToPersianDate());
                oReport.Dictionary.Variables.Add("FundName", Utility.CurrentFund.Name);
                oReport.Dictionary.Variables.Add("FundManagerName", Utility.CurrentFund.ManagerName);
                oReport.RegBusinessObject("Members", varList);
                oReport.Compile();
                oReport.RenderWithWpf();
                oReport.DoAction(reportType, string.Format("گزارش اعضا ({0}) ", Utility.CurrentFund.Name));

                oUnitOfWork.Save();
            }
            catch (System.Exception ex)
            {
                Infrastructure.MessageBox.Show(ex.Message);
            }
            finally
            {
                if (oUnitOfWork != null)
                {
                    oUnitOfWork.Dispose();
                    oUnitOfWork = null;
                }
            }
        }
Exemplo n.º 15
0
        private void ShowReport(Infrastructure.Report.ExportType reportType)
        {
            Stimulsoft.Report.StiReport oStiReport = new Stimulsoft.Report.StiReport();

            DAL.UnitOfWork oUnitOfWork = null;

            try
            {
                oUnitOfWork = new DAL.UnitOfWork();

                Models.Member oMember = oUnitOfWork.MemberRepository
                                        .GetById(CurrentId);

                ViewModels.MembershipCardViewModel oViewModel =
                    new ViewModels.MembershipCardViewModel();

                oViewModel.FirstName      = oMember.FullName.FirstName;
                oViewModel.LastName       = oMember.FullName.LastName;
                oViewModel.FatherName     = oMember.FatherName;
                oViewModel.Gender         = oMember.Gender;
                oViewModel.NationalCode   = oMember.NationalCode;
                oViewModel.EmailAddress   = oMember.EmailAddress;
                oViewModel.FundName       = oMember.Fund.Name;
                oViewModel.PhoneNumber    = oMember.PhoneNumber;
                oViewModel.MembershipDate = oMember.MembershipDate;

                if (oMember.Picture != null)
                {
                    System.IO.MemoryStream oMemoryStream = new System.IO.MemoryStream(oMember.Picture);
                    System.Drawing.Image   oImage        = System.Drawing.Image.FromStream(oMemoryStream);
                    oViewModel.Picture = oImage;
                }
                else
                {
                    System.Drawing.Image oImage = Properties.Resources.ImageNull;
                    oViewModel.Picture = oImage;
                }

                var varData =
                    new
                {
                    FirstName             = oViewModel.FirstName,
                    LastName              = oViewModel.LastName,
                    Picture               = oViewModel.Picture,
                    FatherName            = oViewModel.FatherName,
                    GenderDescription     = oViewModel.GenderDescription,
                    FundName              = oViewModel.FundName,
                    PhoneNumber           = oViewModel.PhoneNumber,
                    PersianMembershipDate = oViewModel.PersianMembershipDate,
                    EmailAddress          = oViewModel.EmailAddress,
                    NationalCode          = oViewModel.NationalCode,
                };

                oStiReport.Load(Properties.Resources.MembershipCardReport);
                oStiReport.RegBusinessObject("MembershipCard", varData);
                oStiReport.Compile();
                oStiReport.RenderWithWpf();

                oStiReport.DoAction(reportType, string.Format("{0} {1}", "کارت عضویت", oMember.FullName.FirstName + "" + oMember.FullName.LastName));

                oUnitOfWork.Save();
            }
            catch (System.Exception ex)
            {
                Infrastructure.MessageBox.Show(ex.Message);;
            }
            finally
            {
                if (oUnitOfWork != null)
                {
                    oUnitOfWork.Dispose();
                    oUnitOfWork = null;
                }
            }
        }
Exemplo n.º 16
0
        private void OBackgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            this.Dispatcher.Invoke(() =>
            {
                EnterEmailPasswordWindow oEnterEmailPasswordWindow = e.Argument as EnterEmailPasswordWindow;

                var varList = (MembersLoanGridControl.ItemsSource as System.Collections.Generic.List <ViewModels.LoanViewModel>)
                              .OrderBy(current => current.StartDate)
                              .Select(current => new
                {
                    current.LoanAmountRialFormat,
                    current.RefundAmountRialFormat,
                    current.PersianEndDate,
                    current.PersianStartDate,
                    current.InstallmentsCount,
                    current.IsPayedDescrption,
                    current.Description,
                })
                              .ToList();

                if (varList.Count == 0)
                {
                    Infrastructure.MessageBox.Show
                    (
                        caption: Infrastructure.MessageBox.Caption.Error,
                        text: "اطلاعاتی برای ارسال توسط پست الکترونیکی موجود نمی‌باشد. "
                    );

                    return;
                }

                Stimulsoft.Report.StiReport oStiReport = new Stimulsoft.Report.StiReport();

                oStiReport.Load(Properties.Resources.MembersLoansListReport);

                oStiReport.Dictionary.Variables.Add("Today", System.DateTime.Now.ToPersianDate());
                oStiReport.Dictionary.Variables.Add("FundName", Utility.CurrentFund.Name);
                oStiReport.Dictionary.Variables.Add("FundManagerName", Utility.CurrentFund.ManagerName);
                oStiReport.Dictionary.Variables.Add("MemberName", Utility.CurrentMember.FullName.ToString());
                oStiReport.Dictionary.Variables.Add("LoanStatus", LoanStatusComboBox.Text);
                oStiReport.RegBusinessObject("Loans", varList);
                oStiReport.Compile();
                oStiReport.RenderWithWpf();

                string fileName = string.Format("گزارش {0} {1}", LoanStatusComboBox.Text, Utility.CurrentMember.FullName.ToString());

                System.IO.MemoryStream oMemoryStream = new System.IO.MemoryStream();

                oStiReport.ExportDocument(Stimulsoft.Report.StiExportFormat.Pdf, oMemoryStream);
                oMemoryStream.Seek(0, System.IO.SeekOrigin.Begin);

                Utility.SendEmail
                (
                    senderEmail: Utility.CurrentUser.EmailAddress,
                    senderPassword: oEnterEmailPasswordWindow.EmailPassword,
                    displayName: Utility.CurrentUser.FullName.ToString(),
                    receiverEmail: Utility.CurrentMember.EmailAddress,
                    subject: Utility.CurrentFund.Name + " | " + LoanStatusComboBox.Text + " " + Utility.CurrentMember.FullName.ToString(),
                    body: LoanStatusComboBox.Text + Utility.CurrentMember.FullName.ToString() +
                    System.Environment.NewLine +
                    new FarsiLibrary.Utils.PersianDate(System.DateTime.Now).ToString(),
                    attachment: oMemoryStream,
                    attachmentName: fileName
                );
            });
        }
Exemplo n.º 17
0
        private void OEmailBackgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            this.Dispatcher.Invoke(() =>
            {
                DAL.UnitOfWork oUnitOfWork = new DAL.UnitOfWork();

                if (SendEmailToggleSwitch.IsChecked == true && IsConnectedToInternet == true)
                {

                    EnterEmailPasswordWindow oEnterEmailPasswordWindow = new EnterEmailPasswordWindow();

                    if (oEnterEmailPasswordWindow.ShowDialog() == true)
                    {
                        var varList = oUnitOfWork.InstallmentRepository
                        .Get()
                        .Where(current => current.LoanId == Utility.CurrentLoan.Id)
                        .Select(current => new ViewModels.InstallmentViewModel()
                        {
                            Id = current.Id,
                            Amount = current.PaymentAmount,
                            InstallmentDate = current.InstallmentDate,
                            PaymentDate = current.PaymentDate,
                            IsActive = !(current.IsPayed),
                            IsPayed = current.IsPayed,
                        })
                        .OrderBy(current => current.InstallmentDate)
                        .ToList()
                        .Select(current => new
                        {
                            current.AmountRialFormat,
                            current.PersianInstallmentDate,
                            current.PersianPaymentDate,
                            current.IsPayedDescription,
                        })
                        .ToList();

                        Stimulsoft.Report.StiReport oStiReport = new Stimulsoft.Report.StiReport();

                        oStiReport.Load(Properties.Resources.InstallmentListReport);

                        oStiReport.Dictionary.Variables.Add("Today", System.DateTime.Now.ToPersianDate());
                        oStiReport.Dictionary.Variables.Add("FundName", Utility.CurrentFund.Name);
                        oStiReport.Dictionary.Variables.Add("FundManagerName", Utility.CurrentFund.ManagerName);
                        oStiReport.Dictionary.Variables.Add("MemberName", Utility.CurrentMember.FullName.ToString());
                        oStiReport.Dictionary.Variables.Add("LoanAmount", (new ViewModels.LoanViewModel { LoanAmount = Utility.CurrentLoan.LoanAmount }).LoanAmountRialFormat);
                        oStiReport.Dictionary.Variables.Add("RefundAmount", (new ViewModels.LoanViewModel { RefundAmount = Utility.CurrentLoan.RefundAmount }).RefundAmountRialFormat);

                        oStiReport.RegBusinessObject("InstallmentsList", varList);
                        oStiReport.Compile();
                        oStiReport.RenderWithWpf();

                        System.IO.MemoryStream oMemoryStream = new System.IO.MemoryStream();

                        oStiReport.ExportDocument(Stimulsoft.Report.StiExportFormat.Pdf, oMemoryStream);
                        oMemoryStream.Seek(0, System.IO.SeekOrigin.Begin);

                        Utility.SendEmail
                        (
                            senderEmail: Utility.CurrentUser.EmailAddress,
                            senderPassword: oEnterEmailPasswordWindow.EmailPassword,
                            displayName: Utility.CurrentUser.FullName.ToString(),
                            receiverEmail: Utility.CurrentMember.EmailAddress,
                            subject: Utility.CurrentFund.Name + " | " + "پرداخت وام" + Utility.CurrentMember.FullName.ToString(),
                            body: "لیست اقساط وام پرداخت شده توسط صندوق به " + Utility.CurrentMember.FullName.ToString() +
                            System.Environment.NewLine +
                            new FarsiLibrary.Utils.PersianDate(System.DateTime.Now).ToString(),
                            attachment: oMemoryStream,
                            attachmentName: "لیست اقساط وام پرداخت شده"
                        );
                    }
                    else
                    {
                        Utility.MainWindow.MainProgressBar.IsIndeterminate = false;
                        Utility.MainWindow.MainProgressBar.Visibility = System.Windows.Visibility.Hidden;
                    }
                }
                else
                {
                    Utility.MainWindow.MainProgressBar.IsIndeterminate = false;
                    Utility.MainWindow.MainProgressBar.Visibility = System.Windows.Visibility.Hidden;
                }
            });
        }
Exemplo n.º 18
0
        private void ShowReport(Infrastructure.Report.ExportType reportType)
        {
            DAL.UnitOfWork oUnitOfWork = null;

            try
            {
                oUnitOfWork = new DAL.UnitOfWork();

                var varList = (MembersGridControl.ItemsSource as System.Collections.Generic.List <Models.Member>)
                              .Where(current => current.FundId == Utility.CurrentFund.Id)
                              .OrderBy(current => current.FullName.LastName)
                              .ThenBy(current => current.FullName.FirstName)
                              .Select(current => new ViewModels.MemberViewModel()
                {
                    Id             = current.Id,
                    EmailAddress   = current.EmailAddress,
                    FatherName     = current.FatherName,
                    FullName       = current.FullName,
                    Gender         = current.Gender,
                    MembershipDate = current.MembershipDate,
                    NationalCode   = current.NationalCode,
                    PhoneNumber    = current.PhoneNumber,
                    Picture        = current.Picture,
                })
                              .ToList();

                var varMembersToReport = varList
                                         .Select(current => new
                {
                    FullName = current.MemberName,
                    Gender   = current.GenderDescription,
                    current.FatherName,
                    MembershipDate = current.PersianMembershipDate,
                    current.NationalCode,
                    current.PhoneNumber,
                    current.EmailAddress,
                    current.Image,
                })
                                         .ToList();

                Stimulsoft.Report.StiReport oReport = new Stimulsoft.Report.StiReport();

                string genderTitle = (GenderComboBox.SelectedIndex == 2) ? "اعضای خانم صندوق" : (GenderComboBox.SelectedIndex == 1) ? "اعضای آقا عضو صندوق" : "همه اعضای صندوق";

                oReport.Load(Properties.Resources.MembersListReport);
                oReport.Dictionary.Variables.Add("Today", System.DateTime.Now.ToPersianDate());
                oReport.Dictionary.Variables.Add("FundName", Utility.CurrentFund.Name);
                oReport.Dictionary.Variables.Add("FundManagerName", Utility.CurrentFund.ManagerName);
                oReport.Dictionary.Variables.Add("Gender", genderTitle);
                oReport.RegBusinessObject("Members", varMembersToReport);
                oReport.Compile();
                oReport.RenderWithWpf();
                oReport.DoAction(reportType, string.Format("گزارش اعضا ({0}) ", Utility.CurrentFund.Name));

                oUnitOfWork.Save();
            }
            catch (System.Exception ex)
            {
                Infrastructure.MessageBox.Show(ex.Message);
            }
            finally
            {
                if (oUnitOfWork != null)
                {
                    oUnitOfWork.Dispose();
                    oUnitOfWork = null;
                }
            }
        }