private int Update(DBConnection Connection, PERMIT_ATTACHMENTDC objPERMIT_ATTACHMENT)
        {
            int updateCount = 0;

            StringBuilder sql = new StringBuilder();

            sql.Append("proc_PERMIT_ATTACHMENTSUpdate");

            DBCommandWarpper dbCommandWrapper = new DBCommandWarpper(Connection.dataBase.GetStoredProcCommand(sql.ToString()), Connection);


            dbCommandWrapper.AddInParameter("p_PERMIT_ID", DbType.Int32, objPERMIT_ATTACHMENT.PERMIT_ID);
            dbCommandWrapper.AddInParameter("p_ATTACHMENT_ID", DbType.Int32, objPERMIT_ATTACHMENT.ATTACHMENT_ID);


            if (Connection.Transaction != null)
            {
                updateCount = Connection.dataBase.ExecuteNonQuery(dbCommandWrapper.DBCommand, Connection.Transaction);
            }
            else
            {
                updateCount = Connection.dataBase.ExecuteNonQuery(dbCommandWrapper.DBCommand);
            }

            if (updateCount == 0)
            {
                objPERMIT_ATTACHMENT.IsDirty = IsDirty = true;
            }

            return(updateCount);
        }
        public PERMIT_ATTACHMENTDC LoadByPrimaryKey(DBConnection Connection, int PERMIT_ID, int ATTACHMENT_ID)
        {
            PERMIT_ATTACHMENTDC objPERMIT_ATTACHMENT = new PERMIT_ATTACHMENTDC();
            StringBuilder       sql = new StringBuilder();

            sql.Append("proc_PERMIT_ATTACHMENTSLoadByPrimaryKey");

            DBCommandWarpper dbCommandWrapper = new DBCommandWarpper(Connection.dataBase.GetStoredProcCommand(sql.ToString()), Connection);

            dbCommandWrapper.AddInParameter("p_PERMIT_ID", DbType.Int32, PERMIT_ID);
            dbCommandWrapper.AddInParameter("p_ATTACHMENT_ID", DbType.Int32, ATTACHMENT_ID);


            IDataReader reader = null;

            if (Connection.Transaction != null)
            {
                reader = Connection.dataBase.ExecuteReader(dbCommandWrapper.DBCommand, Connection.Transaction);
            }
            else
            {
                reader = Connection.dataBase.ExecuteReader(dbCommandWrapper.DBCommand);
            }

            objPERMIT_ATTACHMENT = FillObject(reader);
            return(objPERMIT_ATTACHMENT);
        }
        private int Insert(DBConnection Connection, JOB_ATTACHMENTDC objJOB_ATTACHMENT)
        {
            int insertCount = 0;

            StringBuilder sql = new StringBuilder();

            sql.Append("proc_JOB_ATTACHMENTSInsert");

            DBCommandWarpper dbCommandWrapper = new DBCommandWarpper(Connection.dataBase.GetStoredProcCommand(sql.ToString()), Connection);


            dbCommandWrapper.AddInParameter("p_JOB_ID", DbType.Int32, objJOB_ATTACHMENT.JOB_ID);
            dbCommandWrapper.AddInParameter("p_ATTACHMENT_ID", DbType.Int32, objJOB_ATTACHMENT.ATTACHMENT_ID);


            if (Connection.Transaction != null)
            {
                insertCount = Connection.dataBase.ExecuteNonQuery(dbCommandWrapper.DBCommand, Connection.Transaction);
            }
            else
            {
                insertCount = Connection.dataBase.ExecuteNonQuery(dbCommandWrapper.DBCommand);
            }

            return(insertCount);
        }
        public List <COMPANIEDC> GetCompaniesByRmags(String Rmags, DBConnection Connection)
        {
            List <COMPANIEDC> objCOMPANIES = new List <COMPANIEDC>();
            StringBuilder     sql          = new StringBuilder();

            sql.Append("proc_COMPANIES_BY_RMAGS");

            DBCommandWarpper dbCommandWrapper = new DBCommandWarpper(Connection.dataBase.GetStoredProcCommand(sql.ToString()), Connection);

            dbCommandWrapper.AddInParameter("p_RMAGS", DbType.String, Rmags);
            DataSet ds = new DataSet();

            if (Connection.Transaction != null)
            {
                ds = Connection.dataBase.ExecuteDataSet(dbCommandWrapper.DBCommand, Connection.Transaction);
            }
            else
            {
                ds = Connection.dataBase.ExecuteDataSet(dbCommandWrapper.DBCommand);
            }

            COMPANIEDC ObjCompany;

            foreach (DataRow drRow in ds.Tables[0].Rows)
            {
                ObjCompany              = new COMPANIEDC();
                ObjCompany.COMPANY_ID   = (int)drRow["COMPANY_ID"];
                ObjCompany.COMPANY_NAME = (String)drRow["COMPANY_NAME"];
                ObjCompany.RMAG_ID      = (int)drRow["RMAG_ID"];
                objCOMPANIES.Add(ObjCompany);
            }

            return(objCOMPANIES);
        }
        public List <COMPANIES_RMAGDC> GetRmagsByCompanyId(DBConnection Connection, int CompanyId)
        {
            List <COMPANIES_RMAGDC> objCOMPANIES_RMAG = new List <COMPANIES_RMAGDC>();
            StringBuilder           sql = new StringBuilder();

            sql.Append("proc_COMPANIES_GetRmagsByCompanyId");

            DBCommandWarpper dbCommandWrapper = new DBCommandWarpper(Connection.dataBase.GetStoredProcCommand(sql.ToString()), Connection);

            dbCommandWrapper.AddInParameter("p_COMPANY_ID", DbType.Int32, CompanyId);

            DataSet ds = new DataSet();

            if (Connection.Transaction != null)
            {
                ds = Connection.dataBase.ExecuteDataSet(dbCommandWrapper.DBCommand, Connection.Transaction);
            }
            else
            {
                ds = Connection.dataBase.ExecuteDataSet(dbCommandWrapper.DBCommand);
            }

            foreach (DataRow drRow in ds.Tables[0].Rows)
            {
                objCOMPANIES_RMAG.Add(FillObject(drRow));
            }

            return(objCOMPANIES_RMAG);
        }
Exemple #6
0
        private int Delete(DBConnection Connection, PROJECT_ATTACHMENTDC objPROJECT_ATTACHMENT)
        {
            int deleteCount = 0;

            StringBuilder sql = new StringBuilder();

            sql.Append("proc_PROJECT_ATTACHMENTSDelete");

            DBCommandWarpper dbCommandWrapper = new DBCommandWarpper(Connection.dataBase.GetStoredProcCommand(sql.ToString()), Connection);

            dbCommandWrapper.AddInParameter("p_PROJECT_ID", DbType.Int32, objPROJECT_ATTACHMENT.PROJECT_ID);
            dbCommandWrapper.AddInParameter("p_ATTACHMENT_ID", DbType.Int32, objPROJECT_ATTACHMENT.ATTACHMENT_ID);

            if (Connection.Transaction != null)
            {
                deleteCount = Connection.dataBase.ExecuteNonQuery(dbCommandWrapper.DBCommand, Connection.Transaction);
            }
            else
            {
                deleteCount = Connection.dataBase.ExecuteNonQuery(dbCommandWrapper.DBCommand);
            }

            return(deleteCount);
        }