Esempio n. 1
0
    protected void LinqDataSourceIn_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        ucDateRange.Validated();

        RedBloodDataContext db = new RedBloodDataContext();

        e.Result = db.vw_PackTrans.Where(r => PackTransactionBLL.InTypeList.Contains(r.Type)
                                                && ucDateRange.FromDate <= r.Date
                                                && r.Date <= ucDateRange.ToDate)
            .ToList()
            .GroupBy(r => new { r.ProductCode, r.ProductDesc }, (r, sub) => new
            {
                r.ProductCode,
                r.ProductDesc,
                Total = sub.Sum(r1 => r1.Count),
                TotalInCollect = sub.Where(r1 => r1.Type == PackTransaction.TypeX.In_Collect)
                                    .Sum(r1 => r1.Count),
                TotalInProduct = sub.Where(r1 => r1.Type == PackTransaction.TypeX.In_Product)
                                    .Sum(r1 => r1.Count),
                TotalInReturn = sub.Where(r1 => r1.Type == PackTransaction.TypeX.In_Return)
                                    .Sum(r1 => r1.Count),
                BloodGroupSumary = sub.GroupBy(r1 => r1.BloodGroup, (r1, BGSub) => new
                {
                    BloodGroupDesc = BloodGroupBLL.GetDescription(r1),
                    Total = BGSub.Sum(r3 => r3.Count)
                }),
                VolumeSumary = sub.GroupBy(r1 => r1.Volume, (r1, VolSub) => new
                {
                    Volume = r1,
                    Total = VolSub.Sum(r3 => r3.Count)
                })
            })
            .OrderBy(r => r.ProductDesc);
    }
Esempio n. 2
0
    protected void LinqDataSourceEnd_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        ucDateRange.Validated();

        RedBloodDataContext db = new RedBloodDataContext();

        e.Result = db.vw_PackRemainDailies.Where(r => r.Date == ucDateRange.ToDate)
            .ToList()
            .GroupBy(r => new { r.ProductCode, r.ProductDesc }, (r, sub) => new
            {
                r.ProductCode,
                r.ProductDesc,
                Total = sub.Sum(r1 => r1.Count),
                BloodGroupSumary = sub.GroupBy(r1 => r1.BloodGroup, (r1, BGSub) => new
                {
                    BloodGroupDesc = BloodGroupBLL.GetDescription(r1),
                    Total = BGSub.Sum(r3 => r3.Count)
                }),
                VolumeSumary = sub.GroupBy(r1 => r1.Volume, (r1, VolSub) => new
                {
                    Volume = r1,
                    Total = VolSub.Sum(r3 => r3.Count)
                })
            })
            .OrderBy(r => r.ProductDesc);
    }
Esempio n. 3
0
    protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        var cCoupons = drvvv.drvvvSettings.GetDataContextInstance().Coupons.Where(x => x.Active && x.EndDate >= DateTime.Now);
        IQueryable<Business> cBusinesses = drvvv.drvvvSettings.GetDataContextInstance().Businesses;
        cBusinesses = cBusinesses.Where(x => x.CategoryID.HasValue && x.Category.ID == _catgoryID);

        int cityID;
        if (int.TryParse(Request.QueryString["City"], out cityID))
            cBusinesses = cBusinesses.Where(x => x.CityID.HasValue && (x.CityID == cityID || x.City.FromID.Value == cityID));//x.City.Cities.Any(y=> y.ID == cityID)

        if (!string.IsNullOrEmpty(Request.QueryString["SubCategories"]))
        {
            string tag = Request.QueryString["SubCategories"];
            cBusinesses = cBusinesses.Where(x => x.Tags.Contains(tag));//||
                //x.DescriptionEn.Contains(tag) || x.DescriptionDefault.Contains(tag) ||
                //x.TitleDefault.Contains(tag) || x.TitleEn.Contains(tag) ||
                //x.kosherEn.Contains(tag) || x.kosherDefault.Contains(tag)
                //);
        }
        if (!string.IsNullOrEmpty(Request.QueryString["Mehadrin"]))
        {
            cBusinesses = cBusinesses.Where(x => x.Tags.Contains("mehadrin") ||
                x.DescriptionEn.Contains("mehadrin") || x.DescriptionDefault.Contains("mehadrin") ||
                x.kosherEn.Contains("mehadrin") || x.kosherDefault.Contains("mehadrin")
                );
        }
        e.Result = cBusinesses.OrderByDescending(x => x.Priority).ThenBy(x => x.TitleEn);
    }
    protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        RedBloodDataContext db = new RedBloodDataContext();

        e.Result = db.Packs.Where(r => r.Status == Pack.StatusX.Product && r.ProductCode == ProductCode
            && (TR == Donation.TestResultStatusX.All || r.Donation.TestResultStatus == TR)
            )
            //.ToList()
            .Select(r => new
            {
                r.DIN,
                r.Donation.TestResultStatus,
                r.Donation.BloodGroup,
                r.Volume,
                r.ExpirationDate,
            })
            .ToList()
            .Select(r => new
            {
                r.DIN,
                r.TestResultStatus,
                BloodGroupDesc = BloodGroupBLL.GetDescription(r.BloodGroup),
                r.Volume,
                ExpirationDate = r.ExpirationDate.ToStringVN_Hour(),
                Expired = r.ExpirationDate.Value.Expired() ? "X" : "",
                ExpiredInDays = r.ExpirationDate.Value.ExpiredInDays(ExpiredInDays) ? "X" : ""
            })
            .OrderBy(r => r.TestResultStatus).ThenBy(r => r.DIN);
    }
        protected void AutoCompleteBoxHNDataSource_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            var data = GetData();
              var result = data.Select(c => new { c.HeatNumber }).Distinct();

              e.Result = result;
        }
Esempio n. 6
0
    protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        ucDateRange.Validated();

        RedBloodDataContext db = new RedBloodDataContext();

        e.Result = db.Campaigns.Where(r => r.Type == Campaign.TypeX.Short_run && ucDateRange.FromDate <= r.Date
                                    && r.Date <= ucDateRange.ToDate
                                    && r.CoopOrg.GeoID1 == ProvinceID)
                                .ToList()
                                .Select(r => new
                                                {
                                                    CoopOrg = r.CoopOrg.Name,
                                                    HostOrg = r.HostOrg.Name,
                                                    r.Date,
                                                    Total = r.CollectedDonations.Count(),
                                                    Total450 = r.CollectedDonations.Where(r2 => r2.Pack.Volume == 450).Count().ToStringRemoveZero(),
                                                    Total350 = r.CollectedDonations.Where(r2 => r2.Pack.Volume == 350).Count().ToStringRemoveZero(),
                                                    Total250 = r.CollectedDonations.Where(r2 => r2.Pack.Volume == 250).Count().ToStringRemoveZero(),
                                                    TotalXXX = r.CollectedDonations.Where(r2 => r2.Pack.Volume != 250 && r2.Pack.Volume != 350 && r2.Pack.Volume != 450).Count().ToStringRemoveZero(),
                                                    TotalPos = r.CollectedDonations.Where(r2 => r2.TestResultStatus == Donation.TestResultStatusX.Positive).Count().ToStringRemoveZero(),
                                                    TotalNeg = r.CollectedDonations.Where(r2 => r2.TestResultStatus == Donation.TestResultStatusX.Negative).Count().ToStringRemoveZero(),
                                                    TotalNon = r.CollectedDonations.Where(r2 => r2.TestResultStatus == Donation.TestResultStatusX.Non).Count().ToStringRemoveZero(),
                                                    TotalMiss = r.Donations.Where(r2 => r2.Pack == null).Count().ToStringRemoveZero()
                                                })
            .OrderBy(r => r.Date);
    }
Esempio n. 7
0
    protected void LinqDataSourceRpt_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        ucDateRange.Validated();

        RedBloodDataContext db = new RedBloodDataContext();

        e.Result = db.Campaigns.Where(r => ucDateRange.FromDate <= r.Date && r.Date <= ucDateRange.ToDate)
            .ToList()
            .Select(r => new
            {
                r.ID,
                Url = RedBloodSystem.Url4CollectRpt920
                   + "CampaignID=" + r.ID.ToString(),
                r.Name,
                r.Date,
                Total = r.CollectedDonations.Count(),
                HostName = r.HostOrg.Name,
                CoopName = r.CoopOrg.Name,
                TestResultPos = RedBloodSystem.checkingInfection.Select(r1 => new
                {
                    r1.Name,
                    Total = r.Donations.Where(r2 => r1.Decode(r2.InfectiousMarkers) == TR.pos.Name).Count()
                }).Where(r1 => r1.Total > 0),
                TestResultNA = RedBloodSystem.checkingInfection.Select(r1 => new
                {
                    r1.Name,
                    Total = r.Donations.Where(r2 => r1.Decode(r2.InfectiousMarkers) == TR.na.Name).Count()
                }).Where(r1 => r1.Total > 0),
                BloodGroupSumary = r.Donations.GroupBy(r1 => r1.BloodGroup, (r2, BGSub) => new
                {
                    BloodGroupDesc = BloodGroupBLL.GetDescription(r2),
                    Total = BGSub.Count()
                })
            });
    }
Esempio n. 8
0
 protected void sourceClient_Selecting(object sender, LinqDataSourceSelectEventArgs e)
 {
     if (!User.IsInRole(RSMTenon.ReportGenerator.ReportGenerator.AdminGroup)) {
         string where = String.Format(@"UserID = ""{0}""", User.Identity.Name);
         sourceClient.Where = where;
     }
 }
Esempio n. 9
0
    protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        var cCoupons = drvvv.drvvvSettings.GetDataContextInstance().Coupons.Where(x => x.Active && x.EndDate >= DateTime.Now );

        switch (drvvv.drvvvSettings.GetSite())
        {
            case drvvv.Sites.FrancoDeals:
                cCoupons = cCoupons.Where(x => x.TitleFr != null);
                break;
            case drvvv.Sites.ZebraDeals:
                cCoupons = cCoupons.Where(x => x.TitleDefault != null);
                break;
            default:
                cCoupons = cCoupons.Where(x => x.TitleEn != null);
                break;
        }

        int cityID, categoryID;
        //if (!string.IsNullOrEmpty(Request.QueryString["Catgory"]))
        //    cCoupons = cCoupons.Where(x => !x.CategoryID.HasValue || x.Category.ID == int.Parse(Request.QueryString["Catgory"]));

        if (int.TryParse(DropDownListCity.SelectedValue, out cityID))
            cCoupons = cCoupons.Where(x => x.CityID.HasValue && (x.CityID == cityID || x.City.FromID.Value == cityID));

        if (int.TryParse(DropDownListCategory.SelectedValue, out categoryID))
            cCoupons = cCoupons.Where(x => x.CategoryID.HasValue && x.CategoryID == categoryID);

        if (!string.IsNullOrEmpty(Request.QueryString["CouponID"]))
            cCoupons = cCoupons.Where(x => x.ID == int.Parse(Request.QueryString["CouponID"]));
        e.Result = cCoupons.OrderByDescending(x => x.Priority).OrderByDescending(x => x.ID);
    }
Esempio n. 10
0
    protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        RedBloodDataContext db = new RedBloodDataContext();

        e.Result = db.vw_ProductCounts.Where(r => r.Status == Pack.StatusX.Product)
            .ToList()
            .GroupBy(r => new { r.ProductCode, r.ProductDesc, r.Status }, (r, sub) => new
            {
                r.ProductCode,
                r.ProductDesc,
                r.Status,
                Total = sub.Sum(r1 => r1.Count),
                TotalExpired = sub.Where(r1 => r1.ExpirationDate.Value.Expired())
                                    .Sum(r1 => r1.Count).ToStringRemoveZero(),
                TotalExpiredInDays = sub.Where(r1 => r1.ExpirationDate.Value.ExpiredInDays(ExpiredInDays))
                                    .Sum(r1 => r1.Count).ToStringRemoveZero(),
                TotalTRNA = sub.Where(r1 => r1.TestResultStatus == Donation.TestResultStatusX.Non)
                                .Sum(r1 => r1.Count).ToStringRemoveZero(),
                TotalTRNeg = sub.Where(r1 => r1.TestResultStatus == Donation.TestResultStatusX.Negative)
                                .Sum(r1 => r1.Count).ToStringRemoveZero(),
                TotalTRPos = sub.Where(r1 => r1.TestResultStatus == Donation.TestResultStatusX.Positive)
                                .Sum(r1 => r1.Count).ToStringRemoveZero(),
                BloodGroupSumary = sub.GroupBy(r1 => r1.BloodGroup, (r1, BGSub) => new
                {
                    BloodGroupDesc = BloodGroupBLL.GetDescription(r1),
                    Total = BGSub.Sum(r3 => r3.Count)
                }),
                VolumeSumary = sub.GroupBy(r1 => r1.Volume, (r1, VolSub) => new
                {
                    Volume = r1.HasValue ? r1.Value.ToString() : "_",
                    Total = VolSub.Sum(r3 => r3.Count)
                })
            })
            .OrderBy(r => r.ProductDesc);
    }
Esempio n. 11
0
 protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
 {
     var kelAngg = from k in dc.viewKelAnggaranCodeCombineNames
                   //select new { k.KA_CODE, k.KaCodeName };
                   select k;
     e.Result = kelAngg;
 }
Esempio n. 12
0
        protected void autoCompleteBox_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            var data = GetData();
            var result = data.Select(c => new { c.bpName }).Distinct();

            e.Result = result;
        }
        protected void LinqDataSourcePack_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            if (CampaignDetail1.CampaignID > 0)
            {
                e.Result =
                    DonationBLL.GetUnLock(CampaignDetail1.CampaignID)
                    .Select(r => new
                    {
                        r.DIN,
                        r.Status,
                        r.People.Name,
                        CollectedDate = r.CollectedDate.ToStringVN_Hour(),
                        r.BloodGroup,
                        r.BloodGroupDesc,
                        ABOLog = r.DonationTestLogs.Where(r1 => r1.Type == DonationTestLog.TypeX.BloodGroup)
                        .Select(r1 => new
                        {
                            BloodGroupDesc = BloodGroupBLL.GetDescription(r1.Result),
                            Date = r1.Date.ToStringVN_Hour()
                        })

                    });
            }
            else
            {
                e.Cancel = true;
            }
        }
Esempio n. 14
0
 protected void AllChangesLinq_Selected(object sender, LinqDataSourceSelectEventArgs e)
 {
     DataClasses1DataContext con = new DataClasses1DataContext();
     var changes = from chang in con.ChangeLog orderby chang.Expr1 descending
                   select chang;
     e.Result = changes;
 }
Esempio n. 15
0
 protected void AllChangesLinq_Selected(object sender, LinqDataSourceSelectEventArgs e)
 {
     DataClasses1DataContext con = new DataClasses1DataContext();
     var changes = from chang in con.ChangeLog
                   let tableName = chang.TableName
                   let status = chang.TableProperty
                   let allStates = con.OrderStatus
                   let myOrder = con.Order
                   let myOrderItem=con.OrderItem
                   let Ref = (!chang.ReferenceId.HasValue)?Guid.Empty: chang.ReferenceId.Value
                   where chang.TableName == "Order" || chang.TableName == "OrderItem"
                   select new OrderLogging
                   {
                       LogId = chang.Expr1,
                       TableName = tableName,
                       Name = chang.Name,
                       FirstName = chang.FirstName,
                       Login = chang.Login,
                       Type= tableName=="Order" ? "Auftrag":"Auftragsposition",
                       Date = chang.Date,
                       ReferenceId = (!chang.ReferenceId.HasValue)?Guid.Empty: chang.ReferenceId.Value,
                       TranslatedText = TranslatedText(status,chang.Text, allStates),
                       OrderNumber = tableName == "Order" ? myOrder.FirstOrDefault(q => q.Id == Ref).Ordernumber : myOrderItem.FirstOrDefault(q => q.Id == Ref).Order.Ordernumber
                   };
     changes = changes.OrderByDescending(q=>q.OrderNumber);
     e.Result = changes;
 }
		protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
		{
			IQueryable<Unit> r = Global.Db.Units.Where(u => u.GameID == GameID);
			if (!string.IsNullOrEmpty(tbCode.Text)) r = r.Where(u => u.Code == tbCode.Text);
			if (!string.IsNullOrEmpty(tbName.Text)) r = r.Where(u => u.Name.Contains(tbName.Text));
			if (!string.IsNullOrEmpty(tbDescription.Text)) r = r.Where(u => u.Description.Contains(tbDescription.Text));
			if (!string.IsNullOrEmpty(tbParent.Text)) r = r.Where(u => u.ParentCode == tbParent.Text);
			if (!string.IsNullOrEmpty(ddLicense.SelectedValue)) r = r.Where(u => u.LicenseType == int.Parse(ddLicense.SelectedValue));

			r = r.OrderBy(x => x.OverallProgress);

			e.Result = from x in r select new
			           		{
			           			x.UnitID,
			           			x.Name,
			           			x.Code,
			           			x.CurrentStatus,
			           			x.LicenseType,
			           			x.ModelProgress,
			           			x.TextureProgress,
			           			x.ScriptProgress,
			           			x.OverallProgress,
			           			LastChanged = x.User.Login,
								CandidateCount = x.Candidates.Count
			           		};
		}
Esempio n. 17
0
    protected void LinqDataSourceStart_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        ucDateRange.Validated();

        RedBloodDataContext db = new RedBloodDataContext();

        e.Result = db.Campaigns.Where(r => r.Type == Campaign.TypeX.Short_run && ucDateRange.FromDate <= r.Date
                                                && r.Date <= ucDateRange.ToDate)
            .ToList()
                                                .GroupBy(r => new { r.CoopOrg.Geo1 }, (r, sub) => new
            {
                Province = r.Geo1.Fullname,
                Url = RedBloodSystem.Url4CollectRpt11
                    + "ProvinceID=" + r.Geo1.ID.ToString()
                    + "&from=" + ucDateRange.FromDate.Value.Date.ToShortDateString()
                    + "&to=" + ucDateRange.ToDate.Value.Date.ToShortDateString(),
                Total = sub.Sum(r1 => r1.CollectedDonations.Count()),
                Total450 = sub.Sum(r1 => r1.CollectedDonations.Where(r2 => r2.Pack.Volume == 450).Count()).ToStringRemoveZero(),
                Total350 = sub.Sum(r1 => r1.CollectedDonations.Where(r2 => r2.Pack.Volume == 350).Count()).ToStringRemoveZero(),
                Total250 = sub.Sum(r1 => r1.CollectedDonations.Where(r2 => r2.Pack.Volume == 250).Count()).ToStringRemoveZero(),
                TotalXXX = sub.Sum(r1 => r1.CollectedDonations.Where(r2 => r2.Pack.Volume != 250 && r2.Pack.Volume != 350 && r2.Pack.Volume != 450).Count()).ToStringRemoveZero(),
                TotalPos = sub.Sum(r1 => r1.CollectedDonations.Where(r2 => r2.TestResultStatus == Donation.TestResultStatusX.Positive).Count()).ToStringRemoveZero(),
                TotalNeg = sub.Sum(r1 => r1.CollectedDonations.Where(r2 => r2.TestResultStatus == Donation.TestResultStatusX.Negative).Count()).ToStringRemoveZero(),
                TotalNon = sub.Sum(r1 => r1.CollectedDonations.Where(r2 => r2.TestResultStatus == Donation.TestResultStatusX.Non).Count()).ToStringRemoveZero(),
                TotalMiss = sub.Sum(r1 => r1.Donations.Where(r2 => r2.Pack == null).Count()).ToStringRemoveZero()
            })
            .OrderBy(r => r.Province);
    }
Esempio n. 18
0
    /// <summary>
    /// Populates the grid with all the forms and their properties
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ldsForm_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        GRASPEntities db = new GRASPEntities();

        var forms = from f in db.Form
                    where f.finalised == 1
                    select new
                    {
                        Name = f.name,
                        CreateDate = f.FormCreateDate,
                        Owner = f.owner,
                        Group = f.permittedGroup_path,
                        Id = f.id
                        //Actions = "<a style=\"color:#0058B1\" href=\"/Admin/Data_Entry/DataEntry.aspx?formID=" + SqlFunctions.StringConvert(f.id).TrimStart() + "\"><i class=\"fa fa-pencil-square-o\"></i> New Data</a>"
                    };

        e.Result = forms.AsEnumerable().Select(x => new
        {
            Name = x.Name,
            CreateDate = x.CreateDate,
            Owner = x.Owner,
            Group = x.Group,
            Actions = "<a style=\"color:#0058B1\" href=\"DataEntryWebForm.aspx?formID=" + x.Id.ToString() + "\"><i class=\"fa fa-pencil-square-o\"></i> New Data</a>"
        });
    }
Esempio n. 19
0
    /// <summary>
    /// Fills the grid with all the forms
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ldsForm_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        GRASPEntities db = new GRASPEntities();

        var forms = (from f in db.Form
                    join fr in db.FormResponse on f.id equals fr.parentForm_id into j1
                    from j2 in j1.DefaultIfEmpty()
                    where f.finalised == 1
                    group j2 by new { f.id, f.name, f.FormCreateDate, f.owner, f.permittedGroup_path} into g
                    select new
                    {
                        Name = g.Key.name,
                        CreateDate = g.Key.FormCreateDate,
                        Owner = g.Key.owner,
                        Group = g.Key.permittedGroup_path,
                        Count = g.Count(t=>t.id !=null),
                        Id = g.Key.id
                    }).OrderByDescending(x => x.Id); //Order them by newest.

        e.Result = forms.AsEnumerable().Select(x => new
        {
            Name = x.Name,
            CreateDate = x.CreateDate.Value.ToString("dd MMM yyyy"),
            Owner = x.Owner,
            Group =x.Group,
            Responses = x.Count,
            Id = x.Id
            //Actions = (x.Count>0) ?"<a style=\"color:#0058B1\" href=\"javascript:ImportForm('" + x.Id.ToString() + "','" + x.Name + "');void(0);\"><i class=\"fa fa-upload fa-2\"></i>Import</a>"+
            //" <a style=\"margin-left: 5px;color:#0058B1\" href=\"javascript:ExportSettings('" + x.Id.ToString() + "','" + x.Name + "');void(0);\"><i class=\"fa fa-download fa-2\"></i>Export</a>"+
            //" <a style=\"margin-left: 5px;color:#0058B1\" href=\"javascript:ViewForm('" + x.Id.ToString() + "','" + x.Name + "');void(0);\"><i class=\"fa fa-eye fa-2\"></i>View</a>" : "<a style=\"color:#0058B1\" href=\"javascript:ImportForm('" + x.Id.ToString() + "','" + x.Name + "');void(0);\"><i class=\"fa fa-upload fa-2\"></i>Import</a>"
        });
    }
Esempio n. 20
0
        protected void AutoCompleteBoxCRDataSource_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            var data = GetData();
              var result = data.Select(c => new { c.customerReference }).Distinct();

              e.Result = result;
        }
    protected void LinqDataSourceEnd_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        ucDateRange.Validated();

        var packBLL = new PackBLL();

        e.Result = packBLL.GetRemainByDate(ucDateRange.ToDate.Value)
            .Select(r => new { r.ProductCode, r.Donation.BloodGroup, r.Volume })
            .ToList()
            .GroupBy(r => new { r.ProductCode }, (r, sub) => new
            {
                r.ProductCode,
                ProductDesc = ProductBLL.GetDesc(r.ProductCode),
                Total = sub.Count(),
                BloodGroupSumary = sub.GroupBy(r1 => r1.BloodGroup, (r1, BGSub) => new
                {
                    BloodGroupDesc = BloodGroupBLL.GetDescription(r1),
                    Total = BGSub.Count(),
                    Order = BloodGroupBLL.GetOrder(r1),
                }).OrderBy(r1 => r1.Order).ThenBy(r1 => r1.BloodGroupDesc),
                VolumeSumary = sub.GroupBy(r1 => r1.Volume, (r1, VolSub) => new
                {
                    Volume = r1,
                    Total = VolSub.Count()
                })
            })
            .OrderBy(r => r.ProductDesc);
    }
		protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
		{
			e.Result = from u in Global.Db.Units
					   group u by u.Unit1
						   into g orderby g.Key
						   select new { g.Key };
		}
    protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
    {
        List<Donation> list = DonationBLL.Get(CampaignDetail1.CampaignID).ToList();
        e.Result = list;

        Summary(list.ToList());
    }
Esempio n. 24
0
        protected void AutoCompleteBoxIDataSource_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            var data = GetData();
              //  var result = data.Select(c => new { ItemCode = c.itemCode + "  -  " + c.itemDescription }).Distinct();
              var result = data.Select(c => new { ItemCode = c.itemCode }).Distinct();

              e.Result = result;
        }
Esempio n. 25
0
        protected void GetAllCustomerDataSource_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            DataClasses1DataContext dbContext = new DataClasses1DataContext();

            var query = from cust in dbContext.Customer
                        select cust;
            e.Result = query;
        }
		protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
		{
			e.Result = (from x in Global.Db.Comments
			           where Equals(x.ModelID, ModelID) && Equals(x.UnitID, UnitID)
			           // note hacked "Equals" needed for SQL null handling
			           select new {Name = x.User.Login, x.Time, Text = Global.Linkify(x.Text)}).ToList();

		}
		protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)
		{
			e.Result = from x in Global.Db.Events
			           orderby x.Time descending
			           select new {FullText = String.Format("{0} {1}{2}", x.SummaryLinked,Global.Linkify(x.Text), x.SvnLog != null ? "<br/>" + x.SvnLog : null), x.Time};
			
			
		}
Esempio n. 28
0
 protected void LinqDataSourceUnCollect_Selecting(object sender, LinqDataSourceSelectEventArgs e)
 {
     if (CampaignDetail1.CampaignID > 0)
     {
         e.Result = CampaignBLL.Get(CampaignDetail1.CampaignID).Donations.Where(r => r.OrgPackID == null);
     }
     else { e.Cancel = true; }
 }
Esempio n. 29
0
 // specify the Select query that creates a combined first and last name
 protected void authorsLinqDataSource_Selecting( object sender, 
     LinqDataSourceSelectEventArgs e)
 {
     e.Result =
      from author in database.Authors
      select new { Name = author.FirstName + " " + author.LastName,
         author.AuthorID };
 }
Esempio n. 30
0
 // specify the Select query that gets the specified author's books
 protected void titlesLinqDataSource_Selecting( object sender, 
     LinqDataSourceSelectEventArgs e)
 {
     e.Result =
      from book in database.AuthorISBNs
      where book.AuthorID ==
         Convert.ToInt32( authorsDropDownList.SelectedValue )
      select book.Title;
 }
Esempio n. 31
0
 protected void forumDataSource_Selecting(object sender, System.Web.UI.WebControls.LinqDataSourceSelectEventArgs e)
 {
     e.Result = from f in db.Forums
                let lastPostId = f.Topics.Max(t => t.Posts.Where(p => p.Visible).Max(p => p.PostId))
                                 where f.Visible && f.CategoryId == Category.CategoryId
                                 select new {
         f.ForumId,
         TopicCount = f.Topics.Count,
         PostCount  = (from t in f.Topics
                       from p in t.Posts
                       select p).Count(),
         LastPost = (from p in db.Posts
                     where p.PostId == lastPostId
                     select new { p.UserId, p.Timestamp }).FirstOrDefault(),
         f.Title,
         Date = f.Timestamp
     };
 }
        protected override object GetSource(QueryContext context)
        {
            LinqDataSourceSelectEventArgs selectEventArgs = new LinqDataSourceSelectEventArgs(
                context.Arguments,
                context.WhereParameters,
                context.OrderByParameters,
                context.GroupByParameters,
                context.OrderGroupsByParameters,
                context.SelectParameters);

            OnSelecting(selectEventArgs);
            if (selectEventArgs.Cancel)
            {
                return(null);
            }

            _selectResult = selectEventArgs.Result;
            object table = _selectResult;

            // Original values should only be stored for valid delete and update scenarios.
            _storeOriginalValues = StoreOriginalValuesInViewState && (CanDelete || CanUpdate) &&
                                   String.IsNullOrEmpty(GroupBy) && String.IsNullOrEmpty(SelectNew);

            if (_selectResult == null)
            {
                table         = base.GetSource(context);
                _selectResult = table;
            }
            // If the provided select result was not a DLinq table and we need to store
            // original values then we must get the table and create a new data context
            // instance so that we can access the column metadata.
            else if (!(table is ITable) && _storeOriginalValues)
            {
                table = base.GetSource(context);
            }

            return(table);
        }
Esempio n. 33
0
    protected void searchSource_Selecting(object sender, System.Web.UI.WebControls.LinqDataSourceSelectEventArgs e)
    {
        FudgeDataContext db = new FudgeDataContext();
        var problems        = from p in db.Problems
                              where p.Visible
                              let attempts = p.Runs.Count(r => r.Status != RunStatus.InternalError)
                                             let solved = (from r in p.Runs
                                                           where !r.TestRuns.Any() && r.Status == RunStatus.Done
                                                           select r).Count()
                                                          let percent = attempts == 0 ? 0 : (solved / (1.0 * attempts)) * 100
                                                                        orderby p.Timestamp descending
                                                                        select new {
            Problem  = p,
            Attempts = attempts,
            Solved   = solved,
            Accuracy = percent
        };

        e.Result = from p in problems
                   where p.Problem.Name.Contains(search.Text) ||
                   p.Problem.ProblemTags.Any(t => t.Tag.Keyword.Contains(search.Text))
                   select p;
    }