예제 #1
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);
                ReportManage    entity  = (ReportManage)p_BE;
                ReportManageCtl control = new ReportManageCtl(sqlTrans);


                string sql = "DELETE FROM Data_ReportManageDts WHERE MainID=" + entity.ID.ToString();
                sqlTrans.ExecuteNonQuery(sql);//删除原单据明细数据

                sql = "DELETE FROM Data_ReportFile WHERE FileID=" + entity.ID.ToString();
                sqlTrans.ExecuteNonQuery(sql);//删除原单据明细数据

                control.Delete(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
예제 #2
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Delete(BaseEntity p_Entity)
        {
            try
            {
                ReportManage MasterEntity = (ReportManage)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //删除主表数据
                string Sql = "";
                Sql = "DELETE FROM Data_ReportManage WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID);
                //执行
                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)EnumMessage.CommonDBDelete), E);
            }
        }
예제 #3
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        public void RAdd(ReportManage p_BE, BaseEntity[] p_BE2, ReportFile p_BE3)
        {
            try
            {
                IDBTransAccess sqlTrans = TransSysUtils.GetDBTransAccess();
                try
                {
                    sqlTrans.OpenTrans();

                    this.RAdd(p_BE, p_BE2, p_BE3, sqlTrans);

                    sqlTrans.CommitTrans();
                }
                catch (Exception TE)
                {
                    sqlTrans.RollbackTrans();
                    throw TE;
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
예제 #4
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(ReportManage p_BE, BaseEntity[] p_BE2, ReportFile p_BE3, IDBTransAccess sqlTrans)
        {
            try
            {
                this.RAdd(p_BE, sqlTrans);
                ReportManageDtsRule ruledts = new ReportManageDtsRule();
                ruledts.RSave(p_BE, p_BE2, sqlTrans);//保存从表

                ReportFileRule ruleFile = new ReportFileRule();
                p_BE3.FileID = p_BE.ID;
                ruleFile.RAdd(p_BE3, sqlTrans);

                string sql = " UPDATE Data_ReportManage SET  FileID = " + p_BE3.ID;
                sql += " WHERE ID =" + p_BE.ID;
                sqlTrans.ExecuteNonQuery(sql);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
예제 #5
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="p_BE">要修改的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         ReportManage    entity  = (ReportManage)p_BE;
         ReportManageCtl control = new ReportManageCtl(sqlTrans);
         control.Update(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);
                ReportManage    entity  = (ReportManage)p_BE;
                ReportManageCtl control = new ReportManageCtl(sqlTrans);
                entity.ID = (int)EntityIDTable.GetID(27, sqlTrans);//(long)SysEntity.Data_ReportManage
                control.AddNew(entity);

                WFormNoControlRule noControlRule = new WFormNoControlRule();
                noControlRule.RAddSort(39, sqlTrans);//(int)FormNoControlEnum.报表流水号
                //noControlRule.RAddSort(   ("Data_ReportManage", "FileName", sqlTrans);
            }
            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_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int AddNew(BaseEntity p_Entity)
        {
            try
            {
                ReportManage MasterEntity = (ReportManage)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //新增主表数据
                StringBuilder MasterField = new StringBuilder();
                StringBuilder MasterValue = new StringBuilder();
                MasterField.Append("INSERT INTO Data_ReportManage(");
                MasterValue.Append(" VALUES(");
                MasterField.Append("ID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ID) + ",");
                MasterField.Append("ParentID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ParentID) + ",");
                MasterField.Append("WinListID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.WinListID) + ",");
                MasterField.Append("Seq" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Seq) + ",");
                MasterField.Append("ReportName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ReportName) + ",");
                MasterField.Append("FileName" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FileName) + ",");
                MasterField.Append("FileID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.FileID) + ",");
                MasterField.Append("ModelType" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ModelType) + ",");
                MasterField.Append("ModelID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.ModelID) + ",");
                MasterField.Append("Url" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Url) + ",");
                MasterField.Append("Remark" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.Remark) + ",");
                MasterField.Append("MDate" + ",");
                if (MasterEntity.MDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    MasterValue.Append(SysString.ToDBString(MasterEntity.MDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    MasterValue.Append("null,");
                }

                MasterField.Append("MUser" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MUser) + ",");
                MasterField.Append("MenuID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.MenuID) + ",");
                MasterField.Append("WinID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.WinID) + ",");
                MasterField.Append("HeadTypeID" + ",");
                MasterValue.Append(SysString.ToDBString(MasterEntity.HeadTypeID) + ",");
                MasterField.Append("SubTypeID" + ")");
                MasterValue.Append(SysString.ToDBString(MasterEntity.SubTypeID) + ")");



                //执行
                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)EnumMessage.CommonDBInsert), E);
            }
        }
예제 #9
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_Entity">实体类</param>
        /// <returns>操作影响的记录行数</returns>
        public override int Update(BaseEntity p_Entity)
        {
            try
            {
                ReportManage MasterEntity = (ReportManage)p_Entity;
                if (MasterEntity.ID == 0)
                {
                    return(0);
                }

                //更新主表数据
                StringBuilder UpdateBuilder = new StringBuilder();
                UpdateBuilder.Append("UPDATE Data_ReportManage SET ");
                UpdateBuilder.Append(" ID=" + SysString.ToDBString(MasterEntity.ID) + ",");
                UpdateBuilder.Append(" ParentID=" + SysString.ToDBString(MasterEntity.ParentID) + ",");
                UpdateBuilder.Append(" WinListID=" + SysString.ToDBString(MasterEntity.WinListID) + ",");
                UpdateBuilder.Append(" Seq=" + SysString.ToDBString(MasterEntity.Seq) + ",");
                UpdateBuilder.Append(" ReportName=" + SysString.ToDBString(MasterEntity.ReportName) + ",");
                UpdateBuilder.Append(" FileName=" + SysString.ToDBString(MasterEntity.FileName) + ",");
                UpdateBuilder.Append(" FileID=" + SysString.ToDBString(MasterEntity.FileID) + ",");
                UpdateBuilder.Append(" ModelType=" + SysString.ToDBString(MasterEntity.ModelType) + ",");
                UpdateBuilder.Append(" ModelID=" + SysString.ToDBString(MasterEntity.ModelID) + ",");
                UpdateBuilder.Append(" Url=" + SysString.ToDBString(MasterEntity.Url) + ",");
                UpdateBuilder.Append(" Remark=" + SysString.ToDBString(MasterEntity.Remark) + ",");

                if (MasterEntity.MDate != SystemConfiguration.DateTimeDefaultValue)
                {
                    UpdateBuilder.Append(" MDate=" + SysString.ToDBString(MasterEntity.MDate.ToString("yyyy-MM-dd HH:mm:ss")) + ",");
                }
                else
                {
                    UpdateBuilder.Append(" MDate=null,");
                }

                UpdateBuilder.Append(" MUser="******",");
                UpdateBuilder.Append(" MenuID=" + SysString.ToDBString(MasterEntity.MenuID) + ",");
                UpdateBuilder.Append(" WinID=" + SysString.ToDBString(MasterEntity.WinID) + ",");
                UpdateBuilder.Append(" HeadTypeID=" + SysString.ToDBString(MasterEntity.HeadTypeID) + ",");
                UpdateBuilder.Append(" SubTypeID=" + SysString.ToDBString(MasterEntity.SubTypeID));

                UpdateBuilder.Append(" WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID));



                //执行
                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)EnumMessage.CommonDBUpdate), E);
            }
        }
예제 #10
0
 /// <summary>
 /// 检查将要操作的数据是否符合业务规则
 /// </summary>
 /// <param name="p_BE"></param>
 private void CheckCorrect(BaseEntity p_BE)
 {
     ReportManage entity = (ReportManage)p_BE;
 }