Ejemplo n.º 1
0
        //数据持久化
        internal static void  SaveToDb(ToolNumInfo pToolNumInfo, ToolNum pToolNum, bool pIsNew)
        {
            pToolNum.ToolNumId = pToolNumInfo.toolNumId;
            pToolNum.Num1      = pToolNumInfo.num1;
            pToolNum.Num2      = pToolNumInfo.num2;
            pToolNum.Num3      = pToolNumInfo.num3;
            pToolNum.Num4      = pToolNumInfo.num4;
            pToolNum.Num5      = pToolNumInfo.num5;
            pToolNum.Num6      = pToolNumInfo.num6;
            pToolNum.Num7      = pToolNumInfo.num7;
            pToolNum.Num8      = pToolNumInfo.num8;
            pToolNum.Num9      = pToolNumInfo.num9;
            pToolNum.Num10     = pToolNumInfo.num10;
            pToolNum.Num11     = pToolNumInfo.num11;
            pToolNum.Num12     = pToolNumInfo.num12;
            pToolNum.Num13     = pToolNumInfo.num13;
            pToolNum.Num14     = pToolNumInfo.num14;
            pToolNum.Num15     = pToolNumInfo.num15;
            pToolNum.Num16     = pToolNumInfo.num16;
            pToolNum.Num17     = pToolNumInfo.num17;
            pToolNum.Num18     = pToolNumInfo.num18;
            pToolNum.Num19     = pToolNumInfo.num19;
            pToolNum.Num20     = pToolNumInfo.num20;
            pToolNum.Num21     = pToolNumInfo.num21;
            pToolNum.Num22     = pToolNumInfo.num22;
            pToolNum.Num23     = pToolNumInfo.num23;
            pToolNum.Num24     = pToolNumInfo.num24;
            pToolNum.Num25     = pToolNumInfo.num25;
            pToolNum.Num26     = pToolNumInfo.num26;
            pToolNum.Num27     = pToolNumInfo.num27;
            pToolNum.Num28     = pToolNumInfo.num28;
            pToolNum.Num29     = pToolNumInfo.num29;
            pToolNum.Num30     = pToolNumInfo.num30;
            pToolNum.Num31     = pToolNumInfo.num31;
            pToolNum.Num32     = pToolNumInfo.num32;
            pToolNum.Num33     = pToolNumInfo.num33;
            pToolNum.Num34     = pToolNumInfo.num34;
            pToolNum.Num35     = pToolNumInfo.num35;
            pToolNum.Num36     = pToolNumInfo.num36;
            pToolNum.Num37     = pToolNumInfo.num37;
            pToolNum.Num38     = pToolNumInfo.num38;
            pToolNum.Num39     = pToolNumInfo.num39;
            pToolNum.Num40     = pToolNumInfo.num40;
            pToolNum.IsNew     = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pToolNum.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(ToolNumInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pToolNumInfo.toolNumId = pToolNum.ToolNumId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(ToolNumInfo)))
            {
                ResetCache();
            }
        }
Ejemplo n.º 2
0
 //数据持久化
 internal static void SaveToDb(ToolNumInfo pToolNumInfo, ToolNum  pToolNum,bool pIsNew)
 {
     pToolNum.ToolNumId = pToolNumInfo.toolNumId;
      		pToolNum.Num1 = pToolNumInfo.num1;
      		pToolNum.Num2 = pToolNumInfo.num2;
      		pToolNum.Num3 = pToolNumInfo.num3;
      		pToolNum.Num4 = pToolNumInfo.num4;
      		pToolNum.Num5 = pToolNumInfo.num5;
      		pToolNum.Num6 = pToolNumInfo.num6;
      		pToolNum.Num7 = pToolNumInfo.num7;
      		pToolNum.Num8 = pToolNumInfo.num8;
      		pToolNum.Num9 = pToolNumInfo.num9;
      		pToolNum.Num10 = pToolNumInfo.num10;
      		pToolNum.Num11 = pToolNumInfo.num11;
      		pToolNum.Num12 = pToolNumInfo.num12;
      		pToolNum.Num13 = pToolNumInfo.num13;
      		pToolNum.Num14 = pToolNumInfo.num14;
      		pToolNum.Num15 = pToolNumInfo.num15;
      		pToolNum.Num16 = pToolNumInfo.num16;
      		pToolNum.Num17 = pToolNumInfo.num17;
      		pToolNum.Num18 = pToolNumInfo.num18;
      		pToolNum.Num19 = pToolNumInfo.num19;
      		pToolNum.Num20 = pToolNumInfo.num20;
      		pToolNum.Num21 = pToolNumInfo.num21;
      		pToolNum.Num22 = pToolNumInfo.num22;
      		pToolNum.Num23 = pToolNumInfo.num23;
      		pToolNum.Num24 = pToolNumInfo.num24;
      		pToolNum.Num25 = pToolNumInfo.num25;
      		pToolNum.Num26 = pToolNumInfo.num26;
      		pToolNum.Num27 = pToolNumInfo.num27;
      		pToolNum.Num28 = pToolNumInfo.num28;
      		pToolNum.Num29 = pToolNumInfo.num29;
      		pToolNum.Num30 = pToolNumInfo.num30;
      		pToolNum.Num31 = pToolNumInfo.num31;
      		pToolNum.Num32 = pToolNumInfo.num32;
      		pToolNum.Num33 = pToolNumInfo.num33;
      		pToolNum.Num34 = pToolNumInfo.num34;
      		pToolNum.Num35 = pToolNumInfo.num35;
      		pToolNum.Num36 = pToolNumInfo.num36;
      		pToolNum.Num37 = pToolNumInfo.num37;
      		pToolNum.Num38 = pToolNumInfo.num38;
      		pToolNum.Num39 = pToolNumInfo.num39;
      		pToolNum.Num40 = pToolNumInfo.num40;
     pToolNum.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pToolNum.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(ToolNumInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pToolNumInfo.toolNumId = pToolNum.ToolNumId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(ToolNumInfo)))
     {
         ResetCache();
     }
 }