本文整理匯總了C#中OpenEnvironment.App_Logic.DataAccessLayer.OpenEnvironmentEntities.AddToT_WQX_REF_LAB方法的典型用法代碼示例。如果您正苦於以下問題:C# OpenEnvironmentEntities.AddToT_WQX_REF_LAB方法的具體用法?C# OpenEnvironmentEntities.AddToT_WQX_REF_LAB怎麽用?C# OpenEnvironmentEntities.AddToT_WQX_REF_LAB使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OpenEnvironment.App_Logic.DataAccessLayer.OpenEnvironmentEntities
的用法示例。
在下文中一共展示了OpenEnvironmentEntities.AddToT_WQX_REF_LAB方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: InsertOrUpdateT_WQX_REF_LAB
public static int InsertOrUpdateT_WQX_REF_LAB(global::System.Int32? lAB_IDX, global::System.String lAB_NAME, string lAB_ACCRED_IND, string lAB_ACCRED_AUTHORITY, string oRG_ID, bool aCT_IND)
{
using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
{
try
{
Boolean insInd = true;
T_WQX_REF_LAB a = new T_WQX_REF_LAB();
if (ctx.T_WQX_REF_LAB.Any(o => o.LAB_IDX == lAB_IDX))
{
//update case
a = (from c in ctx.T_WQX_REF_LAB
where c.LAB_IDX == lAB_IDX
select c).FirstOrDefault();
insInd = false;
}
else
{
if (ctx.T_WQX_REF_LAB.Any(o => o.LAB_NAME == lAB_NAME && o.ORG_ID == oRG_ID))
{
//update case
a = (from c in ctx.T_WQX_REF_LAB
where c.LAB_NAME == lAB_NAME
&& c.ORG_ID == oRG_ID
select c).FirstOrDefault();
insInd = false;
}
}
if (lAB_NAME != null) a.LAB_NAME = lAB_NAME;
if (lAB_ACCRED_IND != null) a.LAB_ACCRED_IND = lAB_ACCRED_IND;
if (lAB_ACCRED_AUTHORITY != null) a.LAB_ACCRED_AUTHORITY = lAB_ACCRED_AUTHORITY;
if (oRG_ID != null) a.ORG_ID = oRG_ID;
a.ACT_IND = aCT_IND;
a.UPDATE_DT = System.DateTime.Now;
if (insInd) //insert case
{
a.CREATE_DT = System.DateTime.Now;
ctx.AddToT_WQX_REF_LAB(a);
}
ctx.SaveChanges();
return a.LAB_IDX;
}
catch (Exception ex)
{
return 0;
}
}
}