本文整理汇总了C#中OpenEnvironment.App_Logic.DataAccessLayer.OpenEnvironmentEntities.AddToT_WQX_IMPORT_TEMP_SAMPLE方法的典型用法代码示例。如果您正苦于以下问题:C# OpenEnvironmentEntities.AddToT_WQX_IMPORT_TEMP_SAMPLE方法的具体用法?C# OpenEnvironmentEntities.AddToT_WQX_IMPORT_TEMP_SAMPLE怎么用?C# OpenEnvironmentEntities.AddToT_WQX_IMPORT_TEMP_SAMPLE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenEnvironment.App_Logic.DataAccessLayer.OpenEnvironmentEntities
的用法示例。
在下文中一共展示了OpenEnvironmentEntities.AddToT_WQX_IMPORT_TEMP_SAMPLE方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertUpdateWQX_IMPORT_TEMP_SAMPLE_New
//.........这里部分代码省略.........
//validate mandatory fields
WQX_IMPORT_TEMP_SAMPLE_GenVal(ref a, _allRules, colVals, "MONLOC_ID");
WQX_IMPORT_TEMP_SAMPLE_GenVal(ref a, _allRules, colVals, "ACTIVITY_ID");
WQX_IMPORT_TEMP_SAMPLE_GenVal(ref a, _allRules, colVals, "ACT_TYPE");
WQX_IMPORT_TEMP_SAMPLE_GenVal(ref a, _allRules, colVals, "ACT_MEDIA");
WQX_IMPORT_TEMP_SAMPLE_GenVal(ref a, _allRules, colVals, "ACT_START_DT");
//loop through all optional fields
List<string> rFields = new List<string>(new string[] { "ACT_SUBMEDIA","ACT_END_DT","ACT_TIME_ZONE","RELATIVE_DEPTH_NAME","ACT_DEPTHHEIGHT_MSR",
"ACT_DEPTHHEIGHT_MSR_UNIT","TOP_DEPTHHEIGHT_MSR","TOP_DEPTHHEIGHT_MSR_UNIT","BOT_DEPTHHEIGHT_MSR","BOT_DEPTHHEIGHT_MSR_UNIT","DEPTH_REF_POINT",
"ACT_COMMENT","BIO_ASSEMBLAGE_SAMPLED","BIO_DURATION_MSR","BIO_DURATION_MSR_UNIT","BIO_SAMP_COMPONENT", "BIO_SAMP_COMPONENT_SEQ","BIO_REACH_LEN_MSR",
"BIO_REACH_LEN_MSR_UNIT","BIO_REACH_WID_MSR","BIO_REACH_WID_MSR_UNIT","BIO_PASS_COUNT","BIO_NET_TYPE","BIO_NET_AREA_MSR","BIO_NET_AREA_MSR_UNIT",
"BIO_NET_MESHSIZE_MSR","BIO_MESHSIZE_MSR_UNIT","BIO_BOAT_SPEED_MSR","BIO_BOAT_SPEED_MSR_UNIT","BIO_CURR_SPEED_MSR","BIO_CURR_SPEED_MSR_UNIT",
"BIO_TOXICITY_TEST_TYPE","SAMP_COLL_METHOD_IDX","SAMP_COLL_METHOD_ID","SAMP_COLL_METHOD_CTX","SAMP_COLL_EQUIP","SAMP_COLL_EQUIP_COMMENT",
"SAMP_PREP_IDX","SAMP_PREP_ID","SAMP_PREP_CTX","SAMP_PREP_CONT_TYPE","SAMP_PREP_CONT_COLOR","SAMP_PREP_CHEM_PRESERV","SAMP_PREP_THERM_PRESERV","SAMP_PREP_STORAGE_DESC"
});
foreach (KeyValuePair<string, string> entry in colVals)
if (rFields.Contains(entry.Key))
WQX_IMPORT_TEMP_SAMPLE_GenVal(ref a, _allRules, colVals, entry.Key);
//********************** CUSTOM POST VALIDATION ********************************************
//SET MONLOC_IDX based on supplied MONLOC_ID
if (!string.IsNullOrEmpty(a.MONLOC_ID))
{
T_WQX_MONLOC mm = db_WQX.GetWQX_MONLOC_ByIDString(oRG_ID, a.MONLOC_ID);
if (mm == null) { a.IMPORT_STATUS_CD = "F"; a.IMPORT_STATUS_DESC += "Invalid Monitoring Location ID."; }
else { a.MONLOC_IDX = mm.MONLOC_IDX; }
}
//SET ACTIVITY TIMEZONE IF NOT SUPPLIED
if (string.IsNullOrEmpty(a.ACT_TIME_ZONE))
a.ACT_TIME_ZONE = Utils.GetWQXTimeZoneByDate(a.ACT_START_DT.ConvertOrDefault<DateTime>());
//special sampling collection method handling
if (a.SAMP_COLL_METHOD_IDX != null)
{
//if IDX is populated, grab ID/Name/Ctx
T_WQX_REF_SAMP_COL_METHOD scm = db_Ref.GetT_WQX_REF_SAMP_COL_METHOD_ByIDX(a.SAMP_COLL_METHOD_IDX);
if (scm != null)
{
a.SAMP_COLL_METHOD_ID = scm.SAMP_COLL_METHOD_ID;
a.SAMP_COLL_METHOD_NAME = scm.SAMP_COLL_METHOD_NAME;
a.SAMP_COLL_METHOD_CTX = scm.SAMP_COLL_METHOD_CTX;
}
}
else
{
if (!string.IsNullOrEmpty(a.SAMP_COLL_METHOD_ID))
{
T_WQX_REF_SAMP_COL_METHOD scm = db_Ref.GetT_WQX_REF_SAMP_COL_METHOD_ByIDandContext(a.SAMP_COLL_METHOD_ID, a.SAMP_COLL_METHOD_CTX);
if (scm != null)
a.SAMP_COLL_METHOD_IDX = scm.SAMP_COLL_METHOD_IDX;
else //no matching sample collection method lookup found
{ a.IMPORT_STATUS_CD = "F"; a.IMPORT_STATUS_DESC += "No matching Sample Collection Method found - please add it at the Reference Data screen first. "; }
}
}
//special validation requiring sampling collection method if activity type contains "Sample"
if (a.SAMP_COLL_METHOD_IDX == null && a.ACT_TYPE.ToUpper().Contains("SAMPLE"))
{ a.IMPORT_STATUS_CD = "F"; a.IMPORT_STATUS_DESC += "Sample Collection Method is required when Activity Type contains the term -Sample-. "; }
//special validation requiring sampling collection equipment if activity type contains "Sample"
if (string.IsNullOrEmpty(a.SAMP_COLL_EQUIP) && a.ACT_TYPE.ToUpper().Contains("SAMPLE"))
{ a.IMPORT_STATUS_CD = "F"; a.IMPORT_STATUS_DESC += "Sample Collection Equipment is required when Activity Type contains the term -Sample-. "; }
//sampling prep method handling
if (a.SAMP_PREP_IDX == null)
{
if (string.IsNullOrEmpty(a.SAMP_PREP_CTX) && !string.IsNullOrEmpty(a.SAMP_PREP_ID))
a.SAMP_PREP_CTX = oRG_ID;
if (!string.IsNullOrEmpty(a.SAMP_PREP_ID) && !string.IsNullOrEmpty(a.SAMP_PREP_CTX))
{
//see if matching prep method exists
T_WQX_REF_SAMP_PREP sp = db_Ref.GetT_WQX_REF_SAMP_PREP_ByIDandContext(a.SAMP_PREP_ID, a.SAMP_PREP_CTX);
if (sp != null)
a.SAMP_PREP_IDX = sp.SAMP_PREP_IDX;
else //no matching sample prep method lookup found
{ a.IMPORT_STATUS_CD = "F"; a.IMPORT_STATUS_DESC += "No matching Sample Prep Method found - please add it at the Reference Data screen first. "; }
}
}
//********************** CUSTOM POST VALIDATION ********************************************
a.IMPORT_STATUS_DESC = a.IMPORT_STATUS_DESC.SubStringPlus(0, 200);
if (insInd) //insert case
ctx.AddToT_WQX_IMPORT_TEMP_SAMPLE(a);
ctx.SaveChanges();
return a.TEMP_SAMPLE_IDX;
}
}
catch (Exception ex)
{
return 0;
}
}
示例2: InsertOrUpdateWQX_IMPORT_TEMP_SAMPLE
//.........这里部分代码省略.........
if (!string.IsNullOrEmpty(sAMP_COLL_METHOD_NAME))
{
a.SAMP_COLL_METHOD_NAME = sAMP_COLL_METHOD_NAME.Trim().SubStringPlus(0, 120);
}
}
}
if (a.SAMP_COLL_METHOD_IDX == null && a.ACT_TYPE.ToUpper().Contains("SAMPLE"))
{ sTATUS_CD = "F"; sTATUS_DESC += "Sample Collection Method is required when Activity Type contains the term -Sample-. "; }
if (!string.IsNullOrEmpty(sAMP_COLL_EQUIP))
{
a.SAMP_COLL_EQUIP = sAMP_COLL_EQUIP.Trim().SubStringPlus(0, 40);
if (db_Ref.GetT_WQX_REF_DATA_ByKey("SampleCollectionEquipment", sAMP_COLL_EQUIP.Trim()) == false) { sTATUS_CD = "F"; sTATUS_DESC += "Sample Collection Equipment not valid. "; }
}
else
{
//special validation requiring sampling collection equipment if activity type contains "Sample"
if (a.ACT_TYPE.ToUpper().Contains("SAMPLE"))
{ sTATUS_CD = "F"; sTATUS_DESC += "Sample Collection Equipment is required when Activity Type contains the term -Sample-. "; }
}
if (!string.IsNullOrEmpty(sAMP_COLL_EQUIP_COMMENT))
{
a.SAMP_COLL_EQUIP_COMMENT = sAMP_COLL_EQUIP_COMMENT.Trim().SubStringPlus(0, 4000);
}
if (sAMP_PREP_IDX != null)
a.SAMP_PREP_IDX = sAMP_PREP_IDX;
else
{
//set context to org id if none is provided
if (!string.IsNullOrEmpty(sAMP_PREP_ID) && string.IsNullOrEmpty(sAMP_PREP_CTX))
sAMP_PREP_CTX = oRG_ID;
if (!string.IsNullOrEmpty(sAMP_PREP_ID) && !string.IsNullOrEmpty(sAMP_PREP_CTX))
{
//see if matching prep method exists
T_WQX_REF_SAMP_PREP sp = db_Ref.GetT_WQX_REF_SAMP_PREP_ByIDandContext(sAMP_PREP_ID.Trim(), sAMP_PREP_CTX.Trim());
if (sp != null)
a.SAMP_PREP_IDX = sp.SAMP_PREP_IDX;
//****************************************
a.SAMP_PREP_ID = sAMP_PREP_ID.Trim().SubStringPlus(0, 20);
a.SAMP_PREP_CTX = sAMP_PREP_CTX.Trim().SubStringPlus(0, 120);
if (!string.IsNullOrEmpty(sAMP_PREP_NAME))
{
a.SAMP_PREP_NAME = sAMP_PREP_NAME.Trim().SubStringPlus(0, 120);
}
}
}
if (!string.IsNullOrEmpty(sAMP_PREP_CONT_TYPE))
{
a.SAMP_PREP_CONT_TYPE = sAMP_PREP_CONT_TYPE.Trim().SubStringPlus(0, 35);
if (db_Ref.GetT_WQX_REF_DATA_ByKey("SampleContainerType", sAMP_PREP_CONT_TYPE.Trim()) == false) { sTATUS_CD = "F"; sTATUS_DESC += "Sample Container Type not valid. "; }
}
if (!string.IsNullOrEmpty(sAMP_PREP_CONT_COLOR))
{
a.SAMP_PREP_CONT_COLOR = sAMP_PREP_CONT_COLOR.Trim().SubStringPlus(0, 15);
if (db_Ref.GetT_WQX_REF_DATA_ByKey("SampleContainerColor", sAMP_PREP_CONT_COLOR.Trim()) == false) { sTATUS_CD = "F"; sTATUS_DESC += "Sample Container Color not valid. "; }
}
if (!string.IsNullOrEmpty(sAMP_PREP_CHEM_PRESERV))
{
a.SAMP_PREP_CHEM_PRESERV = sAMP_PREP_CHEM_PRESERV.Trim().SubStringPlus(0, 250);
}
if (!string.IsNullOrEmpty(sAMP_PREP_THERM_PRESERV))
{
a.SAMP_PREP_THERM_PRESERV = sAMP_PREP_THERM_PRESERV.Trim().SubStringPlus(0, 25);
if (db_Ref.GetT_WQX_REF_DATA_ByKey("ThermalPreservativeUsed", sAMP_PREP_THERM_PRESERV.Trim()) == false) { sTATUS_CD = "F"; sTATUS_DESC += "Thermal Preservative Used not valid. "; }
}
if (!string.IsNullOrEmpty(sAMP_PREP_STORAGE_DESC))
{
a.SAMP_PREP_STORAGE_DESC = sAMP_PREP_STORAGE_DESC.Trim().SubStringPlus(0, 250);
}
if (sTATUS_CD != null) a.IMPORT_STATUS_CD = sTATUS_CD;
if (sTATUS_DESC != null) a.IMPORT_STATUS_DESC = sTATUS_DESC.SubStringPlus(0,100);
if (insInd) //insert case
ctx.AddToT_WQX_IMPORT_TEMP_SAMPLE(a);
ctx.SaveChanges();
return a.TEMP_SAMPLE_IDX;
}
}
catch (Exception ex)
{
sTATUS_CD = "F";
sTATUS_DESC += "Unspecified error";
return 0;
}
}