예제 #1
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {//load
            try
            {
                HelpClass.StartAwait(grid_main);
                btns = new Button[] { btn_firstPage, btn_prevPage, btn_activePage, btn_nextPage, btn_lastPage };

                #region translate
                if (MainWindow.lang.Equals("en"))
                {
                    MainWindow.resourcemanager = new ResourceManager("AdministratorApp.en_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection    = FlowDirection.LeftToRight;
                }
                else
                {
                    MainWindow.resourcemanager = new ResourceManager("AdministratorApp.ar_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection    = FlowDirection.RightToLeft;
                }
                translat();
                #endregion

                #region fill page count combo
                var typelist = new[] {
                    new { Text = "20", Value = "20" },
                    new { Text = "50", Value = "50" },
                    new { Text = "100", Value = "100" }
                };
                cb_itemPerPage.DisplayMemberPath = "Text";
                cb_itemPerPage.SelectedValuePath = "Value";
                cb_itemPerPage.ItemsSource       = typelist;
                #endregion

                chk_allSerials.IsChecked = false;
                posSerialsQuery          = await RefreshList();

                isActiveCount = posSerials.Count(s => s.isActive == 1);

                pu = await puModel.GetByID(packageUserID);

                p = await pModel.GetByID(pu.packageId.Value);

                cb_itemPerPage.SelectedIndex = 0;

                Tb_search_TextChanged(tb_search, null);

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
        private async void Dg_book_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                //HelpClass.StartAwait(grid_main);

                BookSts book = dg_book.SelectedItem as BookSts;
                if (book.packageUserId > 0)
                {
                    PackageUser puModel     = new PackageUser();
                    PackageUser packageUser = await puModel.GetByID(book.packageUserId);

                    Packages pModel  = new Packages();
                    Packages package = await pModel.GetByID(book.packageId.Value);

                    if (packageUser.packageId > 0)
                    {
                        MainWindow.mainWindow.Btn_sales_Click(MainWindow.mainWindow.btn_sales, null);
                        uc_sales.Instance.Window_Loaded(null, null);
                        uc_sales.Instance.Btn_sale_Click(uc_sales.Instance.btn_sale, null);
                        uc_sale.Instance.UserControl_Loaded(null, null);
                        uc_sale.Instance.package = package;

                        uc_sale.Instance.oldCustomerId          = packageUser.customerId.Value;
                        uc_sale.Instance.oldAgentId             = packageUser.userId.Value;
                        uc_sale.Instance.oldPackageId           = packageUser.packageId.Value;
                        uc_sale.Instance.oldCountryPackageId    = packageUser.countryPackageId.Value;
                        uc_sale.Instance.packuser               = packageUser;
                        uc_sale.Instance.btn_serials.IsEnabled  = true;
                        uc_sale.Instance.tb_activationCode.Text = packageUser.packageSaleCode;
                        uc_sale.Instance.isOnline               = packageUser.isOnlineServer.Value;
                        HelpClass.clearValidate(uc_sale.requiredControlList, this);
                    }
                }
                //Clear();
                //ClearPackageUser();

                //HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                //HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
예제 #3
0
        public async Task <string> BuildReport()
        {
            //string firstTitle = "paymentsReport";
            ////string secondTitle = "";
            ////string subTitle = "";
            //string Title = "";

            List <ReportParameter> paramarr = new List <ReportParameter>();
            List <PackageUser>     purl     = new List <PackageUser>();

            packUserRep = await packUserRep.GetByID(packuser.packageUserId);
            await getdata();

            if (PayOpModel.payOpId <= 0)
            {
                return("0");//not pay yet
            }
            else
            {
                string addpath;
                bool   isArabic = ReportCls.checkLang();
                if (isArabic)
                {
                    addpath = @"\Reports\Sale\Book\Ar\ArBook.rdlc";
                }
                else
                {
                    addpath = @"\Reports\Sale\Book\En\EnBook.rdlc";
                }
                //D:\myproj\posproject3\AdministratorApp\AdministratorApp\Reports\Sale\Book\En\EnBook.rdlc
                string reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);
                //     subTitle = clsReports.ReportTabTitle(firstTitle, secondTitle);
                //  Title = MainWindow.resourcemanagerreport.GetString("trAccountantReport");


                clsReports.setReportLanguage(paramarr);
                clsReports.Header(paramarr);
                SetReportparam(paramarr);
                clsReports.BookSale(purl, rep, reppath, paramarr);
                rep.SetParameters(paramarr);

                rep.Refresh();
                return("1");
            }
        }
        private async void Dg_book_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                // HelpClass.StartAwait(grid_main);

                PaymentsSts payment = dg_book.SelectedItem as PaymentsSts;
                if (payment.packageUserId > 0)
                {
                    PackageUser puModel     = new PackageUser();
                    PackageUser packageUser = await puModel.GetByID(payment.packageUserId);

                    Packages pModel  = new Packages();
                    Packages package = await pModel.GetByID(payment.packageId.Value);

                    if (packageUser.packageId > 0)
                    {
                        uc_sales.Instance.isPayment     = true;
                        uc_payment.Instance.isFirstTime = false;
                        MainWindow.mainWindow.Btn_sales_Click(MainWindow.mainWindow.btn_sales, null);
                        uc_sales.Instance.Window_Loaded(null, null);
                        uc_sales.Instance.Btn_packageUser_Click(uc_sales.Instance.btn_packageUser, null);
                        uc_payment.Instance.cusID      = payment.customerId.Value;
                        uc_payment.Instance.packuserID = payment.packageUserId;
                        uc_payment.Instance.discount_  = payment.discountValue;
                        uc_payment.Instance.UserControl_Loaded(null, null);
                    }
                }
                //Clear();
                //ClearPackageUser();

                //HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                //HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
예제 #5
0
        private async void Btn_exportToExcel_Click(object sender, RoutedEventArgs e)
        {//excel
            try
            {
                HelpClass.StartAwait(grid_main);

                PackageUser puModel = new PackageUser();
                PackageUser pu      = await puModel.GetByID(packageUserID);

                string customer = pu.customerName + " " + pu.customerLastName;
                string package  = pu.packageName;
                string key      = pu.packageSaleCode;
                string agent    = pu.userName + " " + pu.userLastName;
                string s        = "";
                #region
                Thread t1 = new Thread(() =>
                {
                    BuildReport();
                    this.Dispatcher.Invoke(() =>
                    {
                        saveFileDialog.Filter = "EXCEL|*.xls;";
                        if (saveFileDialog.ShowDialog() == true)
                        {
                            string filepath = saveFileDialog.FileName;
                            LocalReportExtensions.ExportToExcel(rep, filepath);
                        }
                    });
                });
                t1.Start();
                #endregion

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
예제 #6
0
        //ReportCls reportclass = new ReportCls();

        public async void  BuildReport()
        {
            List <ReportParameter> paramarr = new List <ReportParameter>();

            string addpath     = "";
            string firstTitle  = "Serials";
            string secondTitle = "";
            string subTitle    = "";
            string Title       = "";

            bool isArabic = ReportCls.checkLang();

            //if (isArabic)
            //{
            //addpath = @"\Reports\StatisticReport\Accounts\Paymetns\Ar\ArVendor.rdlc";
            //secondTitle = "vendors";
            //}
            //else
            //{
            //addpath = @"\Reports\StatisticReport\Accounts\Paymetns\En\Vendor.rdlc";
            //secondTitle = "vendors";
            //}
            addpath = @"\Reports\Sale\Book\Serials\En\serials.rdlc";

            string      reppath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, addpath);
            PackageUser puModel = new PackageUser();
            Customers   cuModel = new Customers();
            Users       agModel = new Users();

            puModel = await puModel.GetByID(packageUserID);

            cuModel = await cuModel.GetByID((int)puModel.customerId);

            agModel = await agModel.GetByID((int)puModel.userId);

            string serkey    = puModel.packageSaleCode;
            string agentname = "";

            if (agModel.userId == 3)
            {
                agentname = "Increase";
            }
            else
            {
                agentname = agModel.name + " " + agModel.lastName;
            }



            //ReportCls.checkLang();
            //subTitle = clsReports.ReportTabTitle(firstTitle, secondTitle);
            Title = "Serials";
            paramarr.Add(new ReportParameter("trTitle", Title));

            paramarr.Add(new ReportParameter("Agent", agentname));
            paramarr.Add(new ReportParameter("Customer", cuModel.custname + " " + cuModel.lastName));
            paramarr.Add(new ReportParameter("serverKey", serkey));

            List <PosSerials> repserialList = new List <PosSerials>();

            repserialList = await posSerialModel.GetByPackUserId(packageUserID);

            clsReports.serialsReport(repserialList.Where(s => s.isActive == 1), rep, reppath, paramarr);
            //clsReports.setReportLanguage(paramarr);
            //clsReports.Header(paramarr);

            rep.SetParameters(paramarr);

            rep.Refresh();
        }