当前位置: 首页>>代码示例>>C#>>正文


C# OpenEnvironmentEntities.AddToT_ATTAINS_ASSESS_UNITS方法代码示例

本文整理汇总了C#中OpenEnvironment.App_Logic.DataAccessLayer.OpenEnvironmentEntities.AddToT_ATTAINS_ASSESS_UNITS方法的典型用法代码示例。如果您正苦于以下问题:C# OpenEnvironmentEntities.AddToT_ATTAINS_ASSESS_UNITS方法的具体用法?C# OpenEnvironmentEntities.AddToT_ATTAINS_ASSESS_UNITS怎么用?C# OpenEnvironmentEntities.AddToT_ATTAINS_ASSESS_UNITS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenEnvironment.App_Logic.DataAccessLayer.OpenEnvironmentEntities的用法示例。


在下文中一共展示了OpenEnvironmentEntities.AddToT_ATTAINS_ASSESS_UNITS方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InsertOrUpdateATTAINS_ASSESS_UNITS

        public static int InsertOrUpdateATTAINS_ASSESS_UNITS(int? aTTAINS_ASSESS_UNIT_IDX, int? aTTAINS_REPORT_IDX, string aSSESS_UNIT_ID, string aSSESS_UNIT_NAME, 
            string lOCATION_DESC, string aGENCY_CODE, string sTATE_CODE, string aCT_IND, string wATER_TYPE_CODE, decimal? wATER_SIZE, string wATER_UNIT_CODE,
            string uSE_CLASS_CODE, string uSE_CLASS_NAME, String cREATE_USER = "system")
        {
            using (OpenEnvironmentEntities ctx = new OpenEnvironmentEntities())
            {
                Boolean insInd = false;
                try
                {
                    if (aTTAINS_ASSESS_UNIT_IDX == -1) aTTAINS_ASSESS_UNIT_IDX = null;

                    T_ATTAINS_ASSESS_UNITS a = null;

                    if (aTTAINS_ASSESS_UNIT_IDX != null)
                        a = (from c in ctx.T_ATTAINS_ASSESS_UNITS
                             where c.ATTAINS_ASSESS_UNIT_IDX == aTTAINS_ASSESS_UNIT_IDX
                             select c).FirstOrDefault();

                    if (a == null)
                    {
                        a = new T_ATTAINS_ASSESS_UNITS();
                        insInd = true;
                    }

                    if (aTTAINS_REPORT_IDX != null) a.ATTAINS_REPORT_IDX = aTTAINS_REPORT_IDX.ConvertOrDefault<int>();
                    if (aSSESS_UNIT_ID != null) a.ASSESS_UNIT_ID = aSSESS_UNIT_ID;
                    if (aSSESS_UNIT_NAME != null) a.ASSESS_UNIT_NAME = aSSESS_UNIT_NAME;
                    if (lOCATION_DESC != null) a.LOCATION_DESC = lOCATION_DESC;
                    if (aGENCY_CODE != null) a.AGENCY_CODE = aGENCY_CODE;
                    if (sTATE_CODE != null) a.STATE_CODE = sTATE_CODE;
                    if (aCT_IND != null) a.ACT_IND = aCT_IND;
                    if (wATER_TYPE_CODE != null) a.WATER_TYPE_CODE = wATER_TYPE_CODE;
                    if (wATER_SIZE != null) a.WATER_SIZE = wATER_SIZE;
                    if (wATER_UNIT_CODE != null) a.WATER_UNIT_CODE = wATER_UNIT_CODE;
                    if (uSE_CLASS_CODE != null) a.USE_CLASS_CODE = uSE_CLASS_CODE;
                    if (uSE_CLASS_NAME != null) a.USE_CLASS_NAME = uSE_CLASS_NAME;

                    if (insInd) //insert case
                    {
                        a.CREATE_USERID = cREATE_USER.ToUpper();
                        a.CREATE_DT = System.DateTime.Now;
                        ctx.AddToT_ATTAINS_ASSESS_UNITS(a);
                    }
                    else
                    {
                        a.MODIFY_USERID = cREATE_USER.ToUpper();
                        a.MODIFY_DT = System.DateTime.Now;
                    }

                    ctx.SaveChanges();

                    return a.ATTAINS_ASSESS_UNIT_IDX;
                }
                catch (Exception ex)
                {
                    return 0;
                }
            }
        }
开发者ID:open-environment,项目名称:open-waters,代码行数:59,代码来源:db_Attains.cs


注:本文中的OpenEnvironment.App_Logic.DataAccessLayer.OpenEnvironmentEntities.AddToT_ATTAINS_ASSESS_UNITS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。