Пример #1
0
        private void WarehouseUserControl_Load(object sender, EventArgs e)
        {
            WbGridView.RestoreLayoutFromRegistry(IHelper.reg_layout_path + "WarehouseUserControl\\WbGridView");
            WhMatGridView.RestoreLayoutFromRegistry(IHelper.reg_layout_path + "WarehouseUserControl\\WhMatGridView");

            if (!DesignMode)
            {
                custom_mat_list = new List <CustomMatListWH>();
                MatListGridControl.DataSource = custom_mat_list;

                whContentTab.ShowTabHeader = DevExpress.Utils.DefaultBoolean.False;
                OnDateEdit.DateTime        = DateTime.Now;

                whKagentList.Properties.DataSource = DBHelper.KagentsList;// new List<object>() { new { KaId = 0, Name = "Усі" } }.Concat(new BaseEntities().Kagent.Select(s => new { s.KaId, s.Name }));
                if (whKagentList.EditValue == null || whKagentList.EditValue == DBNull.Value)
                {
                    whKagentList.EditValue = 0;
                }

                WhComboBox.Properties.DataSource = new List <checkedWhList>()
                {
                    new checkedWhList {
                        WId = "*", Name = "Усі", IsChecked = false
                    }
                }.Concat(new BaseEntities().Warehouse.Select(s => new checkedWhList {
                    WId = s.WId.ToString(), Name = s.Name, IsChecked = false
                }).ToList());
                WhComboBox.EditValue = "*";


                var whlist = new BaseEntities().Warehouse.Select(s => new checkedWhList {
                    WId = s.WId.ToString(), Name = s.Name, IsChecked = false
                }).ToList();
                foreach (var item in whlist)
                {
                    checkedComboBoxEdit1.Properties.Items.Add(item.WId, item.Name, item.IsChecked ? CheckState.Checked : CheckState.Unchecked, true);
                }

                wbSatusList.Properties.DataSource = new List <object>()
                {
                    new { Id = -1, Name = "Усі" }, new { Id = 1, Name = "Проведені" }, new { Id = 0, Name = "Непроведені" }
                };
                wbSatusList.EditValue = -1;

                wbStartDate.EditValue = DateTime.Now.Date.AddDays(-1);
                wbEndDate.EditValue   = DateTime.Now.Date.SetEndDay();

                repositoryItemLookUpEdit1.DataSource = DBHelper.WhList;
                repositoryItemLookUpEdit2.DataSource = DB.SkladBase().PriceTypes.ToList();

                AvgMatPriceGridColumn.Visible = (DBHelper.CurrentUser.ShowPrice == 1);
                AvgMatPriceGridColumn.OptionsColumn.ShowInCustomizationForm = AvgMatPriceGridColumn.Visible;
                SumMatRemainGridColumn.Visible = AvgMatPriceGridColumn.Visible;
                SumMatRemainGridColumn.OptionsColumn.ShowInCustomizationForm = AvgMatPriceGridColumn.Visible;

                if (WHTreeList.DataSource == null)
                {
                    GetTree(1);
                }

                bandedGridColumn2.Caption = $"{bandedGridColumn2.Caption}, {DBHelper.NationalCurrency.ShortName}";

                var user_settings = new UserSettingsRepository(DBHelper.CurrentUser.UserId, new BaseEntities());

                WbGridView.Appearance.Row.Font      = new Font(user_settings.GridFontName, (float)user_settings.GridFontSize);
                WhMatGridView.Appearance.Row.Font   = new Font(user_settings.GridFontName, (float)user_settings.GridFontSize);
                MatListGridView.Appearance.Row.Font = new Font(user_settings.GridFontName, (float)user_settings.GridFontSize);
            }

            whContentTab.Visible = true;
        }