Пример #1
0
        ///
        /// 插入一个WJ_RECORD实体到数据库。
        ///
        /// 将要插入的实体
        public int InsertEntity(DataSetWJ_RECORD entity)
        {
            CheckData(entity);
            int  iRtn         = 0;
            bool isExistTrans = db.IsInTransaction();

            if (!isExistTrans)
            {
                db.BeginTrans();
            }

            try
            {
                foreach (DataRow row in entity.Tables["WJ_RECORD"].Rows)
                {
                    int j = db.exeSql(new SS_WJ_RECORD_InsertWJ_RECORD(), row);
                    iRtn = iRtn + j;
                }

                if (!isExistTrans)
                {
                    db.CommitTrans();
                }
                return(iRtn);
            }
            catch (Exception e)
            {
                if (!isExistTrans)
                {
                    db.RollbackTrans();
                }
                throw e;
            }
        }
Пример #2
0
        /////////////
        #endregion

        //// 2006-09-11
        public DataSetWJ_RECORD GetDataSet(SqlClass sC, string sTableName)
        {
            DataSetWJ_RECORD ds = new  DataSetWJ_RECORD();

            db.FillDataSet(sC, ds, sTableName);
            return(ds);
        }
Пример #3
0
        }         // Data_SelectByIDWJ_RECORD

        #endregion

        #region Data_WJ_RECORD_SelectAll
        ///
        /// 对于SelectAll的类的实现(数据库操作)。
        ///
        public DataSetWJ_RECORD  Data_WJ_RECORD_SelectAll(string sTj)
        {
            DataSetWJ_RECORD       ds = new DataSetWJ_RECORD();
            SS_WJ_RECORD_SelectAll ss = new SS_WJ_RECORD_SelectAll();

            ss.SqlString = ss.SqlString.Replace("1=1", sTj);

            db.FillDataSet(ss, ds, "WJ_RECORD");
            return(ds);
        }         // Data_SelectAll
Пример #4
0
        //wuqb modify 2007-03-27



        //强名DataSet

        #region Data_WJ_RECORD_SelectByIDWJ_RECORD
        ///
        /// 对于SelectByIDWJ_RECORD的类的实现(数据库操作)。
        ///
        public DataSetWJ_RECORD  Data_WJ_RECORD_SelectByIDWJ_RECORD(System.String VID)
        {
            DataSetWJ_RECORD ds = new DataSetWJ_RECORD();
            SS_WJ_RECORD_SelectByIDWJ_RECORD ss = new SS_WJ_RECORD_SelectByIDWJ_RECORD();

            ss.VID = VID;

            db.FillDataSet(ss, ds, "WJ_RECORD");
            return(ds);
        }         // Data_SelectByIDWJ_RECORD
Пример #5
0
        ///
        /// 检查给定的实体是否有给定状态的更改,如果有把更改的行提交到数据库。
        ///
        /// 要检验的实体
        /// 要检查更改的状态

        /// 2006-05-21
        public int CommitChanges(DataSetWJ_RECORD entity, DataRowState drs, ArrayList alUpdateColumn, ArrayList alUpdateControl)
        {
            db.SetUpdateControl(alUpdateControl);
            db.SetUpdateColumn(alUpdateColumn);
            int iRet = CommitChanges(entity, drs);

            db.SetUpdateControl(null);
            db.SetUpdateColumn(null);
            return(iRet);
        }
Пример #6
0
        ///
        /// 按照WJ_RECORD实体的主表的主键查询数据。
        ///
        /// 主键的值
        public DataSetWJ_RECORD FindByPrimaryKey(object KeyValue)
        {
            DataSetWJ_RECORD entity             = new DataSetWJ_RECORD();
            SS_WJ_RECORD_SelectByIDWJ_RECORD ss = new SS_WJ_RECORD_SelectByIDWJ_RECORD();

            ss.Params[0].Value = KeyValue;
            db.FillDataSet(ss, entity, "WJ_RECORD");

            return(entity);
        }
Пример #7
0
        /////////////////


        public int CommitChanges(DataSetWJ_RECORD entity, DataRowState drs)
        {
            int iRtn = 0;

            if (!entity.HasChanges(drs))
            {
                return(iRtn);
            }
            CheckData(entity);

            bool isExistTrans = db.IsInTransaction();

            if (!isExistTrans)
            {
                db.BeginTrans();
            }

            try
            {
                if (drs == DataRowState.Deleted)
                {
                    iRtn += DeleteEntity(entity.GetChangesEntity(drs));
                }
                else if (drs == DataRowState.Modified)
                {
                    iRtn += UpdateEntity(entity.GetChangesEntity(drs));
                }
                else if (drs == DataRowState.Added)
                {
                    iRtn += InsertEntity(entity.GetChangesEntity(drs));
                }
                if (!isExistTrans)
                {
                    db.CommitTrans();
                }
                return(iRtn);
            }
            catch (Exception e)
            {
                if (isExistTrans)
                {
                    db.RollbackTrans();
                }
                throw e;
            }
        }
Пример #8
0
        ///
        /// 检查给定的实体是否有更改,如果有把更改的行提交到数据库。
        ///
        /// 要检验的实体



        public int CommitChanges(DataSetWJ_RECORD entity)
        {
            int iRtn = 0;

            if (!entity.HasChanges())
            {
                return(iRtn);
            }
            CheckData(entity);

            bool isExistTrans = db.IsInTransaction();

            if (!isExistTrans)
            {
                db.BeginTrans();
            }

            try
            {
                //CommitChanges(entity, DataRowState.Deleted);
                //CommitChanges(entity, DataRowState.Modified);
                //CommitChanges(entity, DataRowState.Added);

                ////////// 2006-05-21
                iRtn += CommitChanges(entity, DataRowState.Deleted, null, null);
                iRtn += CommitChanges(entity, DataRowState.Modified, alUpdateColumn, alUpdateControl);
                iRtn += CommitChanges(entity, DataRowState.Added, null, null);
                /////////////

                if (!isExistTrans)
                {
                    db.CommitTrans();
                }
                return(iRtn);
            }
            catch (Exception e)
            {
                if (isExistTrans)
                {
                    db.RollbackTrans();
                }
                throw e;
            }
        }
Пример #9
0
 ///
 /// 校验数据输入的有效性。
 ///
 /// 要检验的实体
 protected void CheckData(DataSetWJ_RECORD entity)
 {
     //在这里可以加入操作之前所需要对实体检验的代码
 }
Пример #10
0
        /// 2006-05-21
        ///

        public int CommitChanges(DataSetWJ_RECORD entity, ArrayList alUpdateColumn, ArrayList alUpdateControl)
        {
            this.alUpdateColumn  = alUpdateColumn;
            this.alUpdateControl = alUpdateControl;
            return(CommitChanges(entity));
        }