本文整理汇总了C#中RedBloodDataContext类的典型用法代码示例。如果您正苦于以下问题:C# RedBloodDataContext类的具体用法?C# RedBloodDataContext怎么用?C# RedBloodDataContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RedBloodDataContext类属于命名空间,在下文中一共展示了RedBloodDataContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddDIN
public List<string> AddDIN(string DIN)
{
if (DINInList.Contains(DIN))
throw new Exception("Mã túi máu này đã có.");
Donation d = DonationBLL.Get(DIN);
if (d == null)
throw new Exception("Không có mã túi máu này.");
if (d.TestResultStatus == Donation.TestResultStatusX.Positive)
{
throw new Exception("Xét nghiệm sàng lọc: Dương tính.");
}
RedBloodDataContext db = new RedBloodDataContext();
int count = db.Packs.Where(r => ProductCodeInList.Contains(r.ProductCode) && r.DIN == DIN).Count();
if (count == 0)
throw new Exception("Mã túi máu này không có sản phẩm đầu vào.");
count = db.Packs.Where(r => ProductCodeOutList.Contains(r.ProductCode) && r.DIN == DIN).Count();
if (count > 0)
throw new Exception("Mã túi máu này đã có sản phẩm đầu ra.");
DINInList.Add(DIN);
return DINInList;
}
开发者ID:ghostnguyen,项目名称:redblood,代码行数:28,代码来源:ProductionBLL.cs
示例2: LinqDataSource1_Selecting
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);
}
开发者ID:ghostnguyen,项目名称:redblood,代码行数:27,代码来源:Rpt11.aspx.cs
示例3: LinqDataSourceIn_Selecting
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);
}
开发者ID:ghostnguyen,项目名称:redblood,代码行数:34,代码来源:TransCount.aspx.cs
示例4: LinqDataSourceEnd_Selecting
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);
}
开发者ID:ghostnguyen,项目名称:redblood,代码行数:26,代码来源:TransCount.aspx.cs
示例5: IsLogged
public static bool IsLogged(string method, DateTime date)
{
RedBloodDataContext db = new RedBloodDataContext();
//return db.Logs.Count(r => r.Method == method && r.Date.Value.Date == date) > 0;
return db.Logs.Any(r => r.Method == method && r.Date.Value.Date == date);
}
开发者ID:ghostnguyen,项目名称:daccf960-44f9-4f95-91c4-b1aba37effe1,代码行数:7,代码来源:LogBLL.cs
示例6: Get
public static TestDef Get(RedBloodDataContext db, int ID)
{
List<int> l = new List<int>();
l.Add(ID);
return Get(db, l).FirstOrDefault();
}
开发者ID:ghostnguyen,项目名称:redblood,代码行数:7,代码来源:TestDefBLL.cs
示例7: LinqDataSourceStart_Selecting
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);
}
开发者ID:ghostnguyen,项目名称:redblood,代码行数:28,代码来源:Rpt1.aspx.cs
示例8: Backup
public static void Backup(DateTime date)
{
Validate(date);
string err = "Process for day: " + date.Date.ToShortDateString() + ". ";
RedBloodDataContext db = new RedBloodDataContext();
if (db.PackRemainDailies.Where(r => r.Date.Value.Date == date.Date).Count() > 0)
{
LogBLL.LogsFailAndThrow(err + "Existing data.");
}
IQueryable<Pack> rows = db.Packs.Where(r => r.Status == Pack.StatusX.Product);
//Insert
foreach (Pack item in rows)
{
PackRemainDaily r = new PackRemainDaily();
r.PackID = item.ID;
r.Status = item.Status;
r.Date = date;
r.Note = "Process on: " + DateTime.Now.ToString();
db.PackRemainDailies.InsertOnSubmit(r);
}
db.SubmitChanges();
LogBLL.Logs();
}
开发者ID:ghostnguyen,项目名称:redblood,代码行数:31,代码来源:PackRemainDailyBLL.cs
示例9: LinqDataSource1_Selecting
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);
}
开发者ID:ghostnguyen,项目名称:redblood,代码行数:35,代码来源:Count.aspx.cs
示例10: Add
public static void Add(int orderID, string DIN, string productCode)
{
//using (TransactionScope scope = new TransactionScope())
//{
// scope.Complete();
//}
RedBloodDataContext db = new RedBloodDataContext();
Order r = OrderBLL.Get4Add(orderID);
Pack p = PackBLL.Get4Order(DIN, productCode);
var check_po = db.PackOrders.FirstOrDefault(r1 => r1.PackID == p.ID
&& r1.OrderID == r.ID && r1.ReturnID == null);
if (check_po == null)
{
PackOrder po = new PackOrder();
po.OrderID = r.ID;
po.PackID = p.ID;
db.PackOrders.InsertOnSubmit(po);
db.SubmitChanges();
PackTransaction.TypeX transType = r.Type == Order.TypeX.ForCR ? PackTransaction.TypeX.Out_Order4CR
: r.Type == Order.TypeX.ForOrg ? PackTransaction.TypeX.Out_Order4Org
: PackTransaction.TypeX.Out_OrderGen;
PackBLL.ChangeStatus(p.ID, Pack.StatusX.Delivered, transType, "PackOrderID = " + po.ID.ToString());
}
else {
throw new Exception("Túi máu đã có trong đợt cấp phát này.");
}
}
开发者ID:ghostnguyen,项目名称:daccf960-44f9-4f95-91c4-b1aba37effe1,代码行数:33,代码来源:PackOrderBLL.cs
示例11: LinqDataSource1_Selecting
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);
}
开发者ID:ghostnguyen,项目名称:daccf960-44f9-4f95-91c4-b1aba37effe1,代码行数:29,代码来源:CountList.aspx.cs
示例12: UpdateStatus
public static void UpdateStatus(RedBloodDataContext db, Guid packID, string note = "")
{
var p = PackDAL.Get(db, packID);
var v = p.Donation;
//Check Packs.Count is better than check Original Pack.
//Sometime DIN has Pack but not update Original Pack yet.
//Ex. Add Pack => Add Pack Status => Update DIN Status => Update Orginal Pack
if (v.Packs.Count == 0)
{
if (v.People == null)
{
UpdateStatus(db, v.DIN, Donation.StatusX.Init, note);
}
else
{
UpdateStatus(db, v.DIN, Donation.StatusX.Assigned, note);
}
}
else
{
if (v.Packs.Any(r => r.Status == Pack.StatusX.Delivered))
{
UpdateStatus(db, v.DIN, Donation.StatusX.HasPack_Lock, note);
}
else
{
UpdateStatus(db, v.DIN, Donation.StatusX.HasPack_UnLock, note);
}
}
//db.SubmitChanges();
}
开发者ID:ghostnguyen,项目名称:daccf960-44f9-4f95-91c4-b1aba37effe1,代码行数:34,代码来源:DonationDAL.cs
示例13: LinqDataSourceRpt_Selecting
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()
})
});
}
开发者ID:ghostnguyen,项目名称:redblood,代码行数:35,代码来源:Rpt910.aspx.cs
示例14: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
RedBloodDataContext db = new RedBloodDataContext();
List<Guid> geo1List = new List<Guid>();
geo1List.Add(Geo.BinhDuong);
geo1List.Add(Geo.BRVT);
geo1List.Add(Geo.DongNai);
geo1List.Add(Geo.TayNinh);
geo1List.Add(Geo.HCMC);
CheckBoxListGeo1.DataSource = db.Geos.Where(r => geo1List.Contains(r.ID));
CheckBoxListGeo1.DataBind();
foreach (ListItem item in CheckBoxListGeo1.Items)
{
item.Selected = true;
}
List<int> sourceList = new List<int>();
sourceList.Add(TestDef.Source.Donation);
sourceList.Add(TestDef.Source.RedCross);
sourceList.Add(TestDef.Source.Other);
CheckBoxListSource.DataSource = db.TestDefs.Where(r => sourceList.Contains(r.ID));
CheckBoxListSource.DataBind();
foreach (ListItem item in CheckBoxListSource.Items)
{
item.Selected = true;
}
}
}
开发者ID:ghostnguyen,项目名称:daccf960-44f9-4f95-91c4-b1aba37effe1,代码行数:31,代码来源:PackOrderCount.aspx.cs
示例15: btnSave_Click
protected void btnSave_Click(object sender, EventArgs e)
{
RedBloodDataContext db = new RedBloodDataContext();
Donation d = DonationBLL.Get(db, DIN);
if (d == null)
{
Clear();
}
else
{
//TODO: Check to see too late to update
// Code check will be here
d.Collector = txtCollector.Text.Trim();
if (d.Pack != null)
{
d.Pack.Volume = txtVolume.Text.ToInt();
d.Pack.Note = txtNote.Text.Trim();
}
d.Note = txtNote.Text.Trim();
db.SubmitChanges();
this.Alert("Lưu thành công.");
}
}
开发者ID:ghostnguyen,项目名称:redblood,代码行数:30,代码来源:CollectPack.aspx.cs
示例16: GetFirst
public static Hospital GetFirst()
{
RedBloodDataContext db = new RedBloodDataContext();
return (from s in db.Hospitals
select s).FirstOrDefault();
}
开发者ID:ghostnguyen,项目名称:daccf960-44f9-4f95-91c4-b1aba37effe1,代码行数:7,代码来源:HospitalBLL.cs
示例17: Assign
public static DonationErr Assign(string DIN, Guid peopleID, int campaignID, DateTime? collectedDate, string actor)
{
RedBloodDataContext db = new RedBloodDataContext();
Donation d = (from c in db.Donations
where c.DIN == DIN && c.PeopleID == null && c.CampaignID == null
select c).FirstOrDefault();
if (d == null)
{
return DonationErrEnum.NonExist;
}
try
{
d.PeopleID = peopleID;
d.CollectedDate = collectedDate;
d.CampaignID = campaignID;
d.Actor = actor;
UpdateStatus(db, d, Donation.StatusX.Assigned, "Assign peopleID=" + peopleID.ToString() + "&CampaignID=" + campaignID.ToString());
db.SubmitChanges();
CampaignBLL.SetStatus(campaignID);
}
catch (Exception ex)
{
return new DonationErr(ex.Message);
}
return DonationErrEnum.Non;
}
开发者ID:ghostnguyen,项目名称:redblood,代码行数:33,代码来源:DonationBLL.cs
示例18: Get
public static Hospital Get(Guid ID)
{
RedBloodDataContext db = new RedBloodDataContext();
return (from s in db.Hospitals
where s.ID == ID
select s).FirstOrDefault();
}
开发者ID:ghostnguyen,项目名称:daccf960-44f9-4f95-91c4-b1aba37effe1,代码行数:8,代码来源:HospitalBLL.cs
示例19: Delete
public static void Delete(int ID)
{
RedBloodDataContext db = new RedBloodDataContext();
Campaign e = Get(ID, db);
db.Campaigns.DeleteOnSubmit(e);
db.SubmitChanges();
}
开发者ID:ghostnguyen,项目名称:redblood,代码行数:8,代码来源:CampaignBLL.cs
示例20: Delete_Route
public void Delete_Route(TestDef c, RedBloodDataContext db)
{
foreach (TestDef e in c.Children)
{
Delete_Route(e, db);
}
db.TestDefs.DeleteOnSubmit(c);
}
开发者ID:ghostnguyen,项目名称:redblood,代码行数:8,代码来源:TestDefBLL.cs
注:本文中的RedBloodDataContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论