示例#1
0
        public bool AddCtrlEstDeptMap(DataTable dataTable)
        {
            int affectedRow = 0;

            IDbConnection conn = DbAgentHelper.CreateDbConnection();

            conn.Open();
            IDbTransaction trx = conn.BeginTransaction();

            try
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    affectedRow += _ctrlDeptMap.Delete(conn
                                                       , trx
                                                       , DataTypeUtility.GetValue(dataRow["CTRL_ID"])
                                                       , DataTypeUtility.GetToInt32(dataRow["DEPT_REF_ID"]));

                    affectedRow += _ctrlDeptMap.Insert(conn
                                                       , trx
                                                       , DataTypeUtility.GetValue(dataRow["CTRL_ID"])
                                                       , DataTypeUtility.GetToInt32(dataRow["COMP_ID"])
                                                       , DataTypeUtility.GetToInt32(dataRow["DEPT_REF_ID"])
                                                       , DataTypeUtility.GetToDateTime(dataRow["DATE"])
                                                       , DataTypeUtility.GetToInt32(dataRow["USER"]));
                }

                trx.Commit();
            }
            catch (Exception ex)
            {
                trx.Rollback();
                return(false);
            }
            finally
            {
                conn.Close();
            }

            return((affectedRow > 0) ? true : false);
        }
示例#2
0
        public bool RemoveCtrlInfo(string ctrl_id)
        {
            int affectedRow = 0;

            Dac_CtrlEstMaps  ctrlEstMap  = new Dac_CtrlEstMaps();
            Dac_CtrlDeptMaps ctrlDeptMap = new Dac_CtrlDeptMaps();

            IDbConnection conn = DbAgentHelper.CreateDbConnection();

            conn.Open();
            IDbTransaction trx = conn.BeginTransaction();

            try
            {
                affectedRow += ctrlDeptMap.Delete(conn
                                                  , trx
                                                  , ctrl_id
                                                  , 0);

                affectedRow += ctrlEstMap.Delete(conn
                                                 , trx
                                                 , ctrl_id
                                                 , "");

                affectedRow += _ctrlInfo.Delete(conn
                                                , trx
                                                , ctrl_id
                                                , 0
                                                , "");

                trx.Commit();
            }
            catch (Exception ex)
            {
                trx.Rollback();
                return(false);
            }
            finally
            {
                conn.Close();
            }

            return((affectedRow > 0) ? true : false);
        }