Exemple #1
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="p_BE">要删除的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RSave(BaseEntity[] p_BE, BaseEntity[] p_BESub, string p_OPID, IDBTransAccess sqlTrans)
 {
     try
     {
         string sql = "DELETE FROM Data_OPWinList WHERE OPID=" + SysString.ToDBString(p_OPID);
         sqlTrans.ExecuteNonQuery(sql);
         sql = "DELETE FROM Data_OPWinListSub WHERE OPID=" + SysString.ToDBString(p_OPID);
         sqlTrans.ExecuteNonQuery(sql);
         for (int i = 0; i < p_BE.Length; i++)
         {
             this.RAdd(p_BE[i], sqlTrans);
         }
         OPWinListSubRule rule = new OPWinListSubRule();
         for (int i = 0; i < p_BESub.Length; i++)
         {
             rule.RAdd(p_BESub[i], sqlTrans);
         }
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Exemple #2
0
        /// <summary>
        /// 批量保存
        /// </summary>
        /// <param name="p_BE">要删除的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAllSave(BaseEntity[] p_BE, BaseEntity[] p_BESub, IDBTransAccess sqlTrans)
        {
            try
            {
                string sql = "DELETE FROM Data_OPWinList WHERE 1=1";
                sqlTrans.ExecuteNonQuery(sql);
                sql = "DELETE FROM Data_OPWinListSub WHERE 1=1";
                sqlTrans.ExecuteNonQuery(sql);

                sql = "  SELECT OPID FROM Data_OP WHERE ISNULL(DefaultFlag,0)=0 AND ISNULL(UseableFlag,0)=1";
                DataTable dt = sqlTrans.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    for (int j = 0; j < dt.Rows.Count; j++)
                    {
                        for (int i = 0; i < p_BE.Length; i++)
                        {
                            OPWinList entity = (OPWinList)p_BE[i];
                            entity.OPID = dt.Rows[j]["OPID"].ToString();
                            this.RAdd(entity, sqlTrans);
                        }
                        OPWinListSubRule rule = new OPWinListSubRule();
                        for (int i = 0; i < p_BESub.Length; i++)
                        {
                            OPWinListSub entitySub = (OPWinListSub)p_BESub[i];
                            entitySub.OPID = dt.Rows[j]["OPID"].ToString();
                            rule.RAdd(entitySub, sqlTrans);
                        }
                    }
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }