Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (var db = Database.SPBase())
            {
                Label1.Text = db.RepLng.First(w => w.RepId == 4 && w.LangId == 2).Name;

                var wh = db.Warehouse.Where(w => w.UserAccessWh.Any(a => a.UserId == 0)).Select(s => new { WId = s.WId.ToString(), s.Name, s.Def }).ToList();

                WhComboBox.DataSource = new List <WhComboBoxItem>()
                {
                    new WhComboBoxItem {
                        WId = "*", Name = "Усі"
                    }
                }.Concat(wh.Select(s => new WhComboBoxItem
                {
                    WId  = s.WId,
                    Name = s.Name
                }).ToList());
                WhComboBox.DataBind();

                GrpComboBox.DataSource = new List <GrpComboBoxItem>()
                {
                    new GrpComboBoxItem {
                        GrpId = 0, Name = "Усі"
                    }
                }.Concat(db.MatGroup.Where(w => w.Deleted == 0).Select(s => new GrpComboBoxItem {
                    GrpId = s.GrpId, Name = s.Name
                }).ToList());
                GrpComboBox.DataBind();

                var k_list = new List <KagentComboBoxItem>()
                {
                    new KagentComboBoxItem {
                        KaId = 0, Name = "Усі"
                    }
                }.Concat(db.Kagent.Where(w => w.Deleted == 0 && (!w.Archived.HasValue || w.Archived == 0)).OrderBy(o => o.Name).Select(s => new KagentComboBoxItem {
                    KaId = s.KaId, Name = s.Name
                })).ToList();
                KagentComboBox.DataSource = k_list;
                KagentComboBox.DataBind();

                if (!IsPostBack)
                {
                    StartDateEdit.Date = DateTime.Now.Date.AddDays(-1);
                    EndDateEdit.Date   = DateTime.Now.Date.AddHours(23).AddMinutes(59).AddSeconds(59);

                    WhComboBox.Value     = "*";
                    GrpComboBox.Value    = 0;
                    KagentComboBox.Value = 0;
                }
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (var db = Database.SPBase())
            {
                Label1.Text = db.RepLng.First(w => w.RepId == 7 && w.LangId == 2).Name;

                var wh = db.Warehouse.Where(w => w.UserAccessWh.Any(a => a.UserId == 0)).Select(s => new { WId = s.WId.ToString(), s.Name, s.Def }).ToList();

                WhComboBox.DataSource = new List <WhComboBoxItem>()
                {
                    new WhComboBoxItem {
                        WId = "*", Name = "Усі"
                    }
                }.Concat(wh.Select(s => new WhComboBoxItem
                {
                    WId  = s.WId,
                    Name = s.Name
                }).ToList());
                WhComboBox.DataBind();

                GrpComboBox.DataSource = new List <GrpComboBoxItem>()
                {
                    new GrpComboBoxItem {
                        GrpId = 0, Name = "Усі"
                    }
                }.Concat(db.MatGroup.Where(w => w.Deleted == 0).Select(s => new GrpComboBoxItem {
                    GrpId = s.GrpId, Name = s.Name
                }).ToList());
                GrpComboBox.DataBind();
            }

            if (!IsPostBack)
            {
                OnDateDBEdit.Date = DateTime.Now;
                WhComboBox.Value  = "*";
                GrpComboBox.Value = 0;
            }
        }