コード例 #1
0
ファイル: LYGLRule.cs プロジェクト: zhp-apeng/HTMLTERP
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="p_BE">要修改的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RUpdate(BaseEntity p_BE, BaseEntity[] p_BE2, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         LYGL    entity  = (LYGL)p_BE;
         LYGLCtl control = new LYGLCtl(sqlTrans);
         control.Update(entity);
         LYGLDtsRule rule = new LYGLDtsRule();
         rule.RSave(entity, p_BE2, sqlTrans);
         //string sql = "DELETE Dev_LYGLDts  WHERE MainID="+SysString.ToDBString(entity.ID);
         //sqlTrans.ExecuteNonQuery(sql);
         //for (int i = 0; i < p_BE2.Length; i++)
         //{
         //    LYGLDtsRule rule = new LYGLDtsRule();
         //    LYGLDts entityDts = (LYGLDts)p_BE2[i];
         //    entityDts.MainID = entity.ID;
         //    entityDts.Seq = i + 1;
         //    rule.RAdd(entityDts, sqlTrans);
         //}
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
コード例 #2
0
ファイル: LYGLRule.cs プロジェクト: zhp-apeng/HTMLTERP
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, BaseEntity[] p_BE2, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                LYGL      entity = (LYGL)p_BE;
                string    sql    = "SELECT FormNo FROM Dev_LYGL WHERE FormNo=" + SysString.ToDBString(entity.FormNo);
                DataTable dt     = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("留样单单号已存在,请双击重新生成");
                }
                LYGLCtl control = new LYGLCtl(sqlTrans);
                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Dev_LYGL, sqlTrans);

                control.AddNew(entity);
                for (int i = 0; i < p_BE2.Length; i++)
                {
                    LYGLDtsRule rule      = new LYGLDtsRule();
                    LYGLDts     entityDts = (LYGLDts)p_BE2[i];
                    entityDts.MainID = entity.ID;
                    entityDts.Seq    = i + 1;
                    entityDts.LYType = (int)EnumLYType.新单;
                    rule.RAdd(entityDts, sqlTrans);
                }
                FormNoControlRule rulest = new FormNoControlRule();
                //rulest.RAddSort((int)FormNoControlEnum.留样单号, sqlTrans);
                rulest.RAddSort("Dev_LYGL", "FormNo", 0, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }