Пример #1
0
        /// <summary>
        /// 获得实体
        /// </summary>
        /// <returns></returns>
        private ReportManageDts[] EntityDtsGet()
        {
            int index = GetDataCompleteNum();

            ReportManageDts[] entitydts = new ReportManageDts[index];
            index = 0;
            for (int i = 0; i < gridView1.RowCount; i++)
            {
                if (CheckDataCompleteDts(i))
                {
                    entitydts[index]        = new ReportManageDts();
                    entitydts[index].MainID = HTDataID;
                    entitydts[index].Seq    = i + 1;
                    entitydts[index].SelectByID();

                    entitydts[index].DataSourceName = SysConvert.ToString(gridView1.GetRowCellValue(i, "DataSourceName"));
                    entitydts[index].SqlName        = SysConvert.ToString(gridView1.GetRowCellValue(i, "SqlName"));
                    entitydts[index].SqlStr         = SysConvert.ToString(gridView1.GetRowCellValue(i, "SqlStr"));
                    entitydts[index].QueryName      = SysConvert.ToString(gridView1.GetRowCellValue(i, "QueryName"));
                    entitydts[index].Remark         = SysConvert.ToString(gridView1.GetRowCellValue(i, "Remark"));
                    entitydts[index].SqlFlag        = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "SqlFlag"));
                    entitydts[index].SourceType     = SysConvert.ToInt32(gridView1.GetRowCellValue(i, "SourceType"));
                    entitydts[index].OrderCondition = SysConvert.ToString(gridView1.GetRowCellValue(i, "OrderCondition"));

                    index++;
                }
            }
            return(entitydts);
        }
Пример #2
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                ReportManageDts MasterEntity = (ReportManageDts)p_Entity;
                if (MasterEntity.MainID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Data_ReportManageDts WHERE " + "MainID=" + SysString.ToDBString(MasterEntity.MainID) + " AND Seq=" + SysString.ToDBString(MasterEntity.Seq);
                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(Sql);
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(Sql);
                }

                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E);
            }
        }
Пример #3
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                ReportManageDts MasterEntity = (ReportManageDts)p_Entity;
                if (MasterEntity.MainID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO Data_ReportManageDts(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("MainID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MainID) + ",");
                MasterField.Append("Seq" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Seq) + ",");
                MasterField.Append("DataSourceName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.DataSourceName) + ",");
                MasterField.Append("SqlName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SqlName) + ",");
                MasterField.Append("SqlStr" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SqlStr) + ",");
                MasterField.Append("QueryName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.QueryName) + ",");
                MasterField.Append("Remark" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ",");
                MasterField.Append("SqlFlag" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SqlFlag) + ",");
                MasterField.Append("SourceType" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SourceType) + ")");



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(MasterField.Append(MasterValue.ToString()).ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBInsert), E);
            }
        }
Пример #4
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                ReportManageDts MasterEntity = (ReportManageDts)p_Entity;
                if (MasterEntity.MainID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE Data_ReportManageDts SET ");
                UpdateBuilder.Append(" MainID=" + SysString.ToDBString(MasterEntity.MainID) + ",");
                UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ",");
                UpdateBuilder.Append(" DataSourceName=" + SysString.ToDBString(MasterEntity.DataSourceName) + ",");
                UpdateBuilder.Append(" SqlName=" + SysString.ToDBString(MasterEntity.SqlName) + ",");
                UpdateBuilder.Append(" SqlStr=" + SysString.ToDBString(MasterEntity.SqlStr) + ",");
                UpdateBuilder.Append(" QueryName=" + SysString.ToDBString(MasterEntity.QueryName) + ",");
                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ",");
                UpdateBuilder.Append(" SqlFlag=" + SysString.ToDBString(MasterEntity.SqlFlag) + ",");
                UpdateBuilder.Append(" SourceType=" + SysString.ToDBString(MasterEntity.SourceType));

                UpdateBuilder.Append(" WHERE " + "MainID=" + SysString.ToDBString(MasterEntity.MainID) + " AND Seq=" + SysString.ToDBString(MasterEntity.Seq));



                //执行
                int AffectedRows = 0;
                if (!this.sqlTransFlag)
                {
                    AffectedRows = this.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                else
                {
                    AffectedRows = sqlTrans.ExecuteNonQuery(UpdateBuilder.ToString());
                }
                return(AffectedRows);
            }
            catch (BaseException E)
            {
                throw new BaseException(E.Message, E);
            }
            catch (Exception E)
            {
                throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBUpdate), E);
            }
        }
Пример #5
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="p_BE">要删除的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         ReportManageDts    entity  = (ReportManageDts)p_BE;
         ReportManageDtsCtl control = new ReportManageDtsCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #6
0
 /// <summary>
 /// 新增(传入事务处理)
 /// </summary>
 /// <param name="p_BE">要新增的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         ReportManageDts    entity  = (ReportManageDts)p_BE;
         ReportManageDtsCtl control = new ReportManageDtsCtl(sqlTrans);
         //entity.ID=(int)EntityIDTable.GetID((long)SysEntity.Data_ReportManageDts,sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #7
0
 /// <summary>
 /// 保存(传入事务处理)
 /// </summary>
 /// <param name="p_Entity"></param>
 /// <param name="p_BE"></param>
 /// <param name="sqlTrans"></param>
 public void RSave(ReportManage p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         string sql = "DELETE FROM Data_ReportManageDts WHERE MainID=" + p_Entity.ID.ToString();
         sqlTrans.ExecuteNonQuery(sql);//删除原单据明细数据
         for (int i = 0; i < p_BE.Length; i++)
         {
             ReportManageDts entitydts = (ReportManageDts)p_BE[i];
             sql              = "SELECT ISNULL(MAX(Seq),0)+1 As MSEQ FROM Data_ReportManageDts WHERE MainID=" + p_Entity.ID.ToString();
             entitydts.Seq    = SysConvert.ToInt32(sqlTrans.Fill(sql).Rows[0][0].ToString());//找到最大的Seq
             entitydts.MainID = p_Entity.ID;
             this.RAdd(entitydts, sqlTrans);
         }
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #8
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     ReportManageDts entity = (ReportManageDts)p_BE;
 }