Esempio n. 1
0
 private void tsmiByVendorFilter_Click(object sender, EventArgs e)
 {
     System.Data.SqlClient.SqlCommand command = Purchases.Vendor.Select(-1, Guid.Empty);
     command.Connection = this.cConnection;
     System.Data.SqlClient.SqlDataAdapter sda = new System.Data.SqlClient.SqlDataAdapter(command);
     System.Data.DataTable tbl = new System.Data.DataTable("Vendors");
     sda.Fill(tbl);
     VisualControls.ElementsList elist = new VisualControls.ElementsList( new VisualControls.ListOptions(), "Продавцы", "VendorName", "VendorID", tbl);
     if (elist.ShowDialog() == DialogResult.OK){
         int i = 0;
         Purchases.Criteria crt = new Purchases.Criteria();
         crt.Vendors = new List<Guid>(elist.Selected.Length);
         foreach (Guid vendor in elist.Selected){
             crt.Vendors.Add(vendor);
         }
         this.LoadReceipts(crt);
     }
     return;
 }
Esempio n. 2
0
 private void tsmiByCategoryFilter_Click(object sender, EventArgs e)
 {
     System.Data.SqlClient.SqlCommand command = Producer.Categories.Select(Guid.Empty);
     command.Connection = this.cConnection;
     System.Data.SqlClient.SqlDataAdapter sda = new System.Data.SqlClient.SqlDataAdapter(command);
     System.Data.DataTable tbl = new System.Data.DataTable("Categories");
     sda.Fill(tbl);
     VisualControls.ElementsList elist = new VisualControls.ElementsList(new VisualControls.ListOptions(), "Категории", "CategoryName", "CategoryID", tbl);
     if (elist.ShowDialog() == DialogResult.OK)
     {
         //int i = 0;
         Purchases.Criteria crt = new Purchases.Criteria();
         crt.Categories = new List<Guid>(elist.Selected.Length);
         foreach (Guid category in elist.Selected)
         {
             crt.Categories.Add(category);
         }
         this.LoadReceipts(crt);
     }
     return;
 }
Esempio n. 3
0
 private void ByPresetDateFilter( DateTime start )
 {
     Purchases.Criteria crt = new Purchases.Criteria();
     crt.DateFilter = Purchases.DateFilterType.Between;
     DateTime [] dates = new DateTime[2];
     dates[0] = start;
     dates[1] = System.DateTime.Now;
     crt.Dates = dates;
     this.ByDateFilter( crt );
 }
Esempio n. 4
0
        private void vBudgetForm_Load(object sender, EventArgs e)
        {
            this.lvReceipts.Columns.Clear();
            this.settings.DefaultLanguage = Properties.Settings.Default.Language;
            CultureInfo nс = new CultureInfo(this.settings.DefaultLanguage);
            Thread.CurrentThread.CurrentCulture = nс;
            Thread.CurrentThread.CurrentUICulture = nс;

            this.manager = new System.Resources.ResourceManager("vBudgetForm.vBudgetResource", System.Reflection.Assembly.GetExecutingAssembly());
            this.lvReceipts.Columns.Add("№", 50);
            this.lvReceipts.Columns.Add("ID", 70);
            this.lvReceipts.Columns.Add(this.manager.GetString("Columns.Number"), 100);
            this.lvReceipts.Columns.Add(this.manager.GetString("Columns.Paid"), 100);
            this.lvReceipts.Columns.Add(this.manager.GetString("Columns.Vendor"), 200);
            this.lvReceipts.Columns.Add(this.manager.GetString("Columns.Price"), 100);
            this.lvReceipts.Columns.Add(this.manager.GetString("Columns.Comment"), 150);
            this.lvReceipts.Columns.Add(this.manager.GetString("Columns.Created"), 100);

            // 'File' submenu
            this.tsmiFile.Text = this.manager.GetString("Menu.F");
            this.tsmiSettings.Text = this.manager.GetString("Menu.F.Settings");
            this.tsmiExit.Text = this.manager.GetString("Menu.F.Exit");

            // 'View' submenu
            this.tsmiViewSection.Text = this.manager.GetString("Menu.V");
            this.tsmiFilters.Text = this.manager.GetString("Menu.V.Filters");
            this.tsmiSections.Text = this.manager.GetString("Menu.V.Sections");
            this.tsmiSort.Text = this.manager.GetString("Menu.V.SortBy");

            // 'View' -> 'Sort by' submenu
            this.tsmiByWeeks.Text = this.manager.GetString("Menu.V.Sort.ByWeeks");
            this.tsmiByMonths.Text = this.manager.GetString("Menu.V.Sort.ByMonths");
            this.tsmiByID.Text = this.manager.GetString("Menu.V.Sort.ByIdentifier");
            this.tsmiByCreationDate.Text = this.manager.GetString("Menu.V.Sort.ByCreationDate");
            this.tsmiByDays.Text = this.manager.GetString("Menu.V.Sort.ByDays");

            // 'Actions' submenu
            this.tsmiActions.Text = this.manager.GetString("Menu.A");
            this.tsmiNewReceipt.Text = this.manager.GetString("Menu.A.New");
            this.tsmiNewClonedReceipt.Text = this.manager.GetString("Menu.A.NewCloned");
            this.tsmiPersons.Text = this.manager.GetString("Menu.A.Persons");
            this.tsmiDataExchange.Text = this.manager.GetString("Menu.A.Exchange");

            // 'Digests' submenu
            this.tsmiDigests.Text = this.manager.GetString("Menu.D");

            this.tsmiMakers.Text = this.manager.GetString("Menu.D.Makers");
            this.tsmiProducts.Text = this.manager.GetString("Menu.D.Products");
            this.tsmiCategories.Text = this.manager.GetString("Menu.D.Categories");
            this.tsmiVendors.Text = this.manager.GetString("Menu.D.Vendors");
            this.tsmiBrands.Text = this.manager.GetString("Menu.D.Brands");
            this.tsmiAffilates.Text = this.manager.GetString("Menu.D.Affilates");

            this.tsmiDiscountCards.Text = this.manager.GetString("Menu.D.DiscountCards");

            // 'Statistics' submenu
            this.tsmiStatistics.Text = this.manager.GetString("Menu.S");
            this.tsmiOftenlyBought.Text = this.manager.GetString("Menu.S.OftenlyPurchases");
            this.tsmiProductPrices.Text = this.manager.GetString("Menu.S.ProductsPrices");

            // Context menu
            this.tsmiAddClonedReceipt.Text = this.manager.GetString("Menu.A.NewCloned");

            if (this.TryConnect()){

                Purchases.Criteria crt = new Purchases.Criteria();
                DateTime [] dates = new DateTime[1] { System.DateTime.Now.AddDays(-7.0) };
                crt.Dates = new DateTime[1];
                crt.Dates = dates;
                crt.DateFilter = Purchases.DateFilterType.MoreOrEqual;
                this.LoadReceipts(crt);
            }
            return;
        }
Esempio n. 5
0
 private void tsmiTopPurchases_Click(object sender, EventArgs e)
 {
     Purchases.Criteria crt = new Purchases.Criteria();
     crt.Top = 23;
     this.LoadReceipts(crt);
 }
Esempio n. 6
0
 private void tsmiOnPeriod_Click(object sender, EventArgs e)
 {
     this.tsmiByLastQuarter.Checked = false;
     this.tsmiByLastWeek.Checked = false;
     this.tsmiByLastMonth.Checked = false;
     this.tsmiByLastThreeMonths.Checked = false;
     this.tsmiOnPeriod.Checked = true;
     VisualControls.PeriodPicker period = new VisualControls.PeriodPicker();
     if (this.dates != null){
         period.StartDate = this.dates[0];
         period.EndtDate = dates[1];
     }else{
         this.dates = new DateTime[2];
     }
     if (period.ShowDialog() == DialogResult.OK){
         Purchases.Criteria crt = new Purchases.Criteria();
         crt.DateFilter = Purchases.DateFilterType.Between;
         dates[0] = period.StartDate;
         dates[1] = period.EndtDate;
         crt.Dates = this.dates;
         this.ByDateFilter(crt);
     }
     return;
 }