コード例 #1
0
        public Contractor Get(int nID, int nUserID)
        {
            Connection.Open();
            Command.CommandText = ContractorDA.Get(nID, nUserID);

            SqlDataReader reader       = Command.ExecuteReader();
            Contractor    _oContractor = new Contractor();

            if (reader.HasRows)
            {
                _oContractor = MakeObject(reader);
            }
            reader.Close();
            Connection.Close();
            return(_oContractor);
        }
コード例 #2
0
        public List <Contractor> Gets(int nBUID, int nContractor)
        {
            Connection.Open();
            Command.CommandText = ContractorDA.Gets(nBUID, nContractor);

            SqlDataReader     reader        = Command.ExecuteReader();
            Contractor        _oContractor  = new Contractor();
            List <Contractor> _oContractors = new List <Contractor>();

            if (reader.HasRows)
            {
                _oContractors = MakeObjects(reader);
            }
            reader.Close();
            Connection.Close();
            return(_oContractors);
        }
コード例 #3
0
        public string Delete(Contractor oContractor, int nUserID)
        {
            string sReturnMessage = "";

            Connection.Open();
            Command.CommandText = ContractorDA.IUD(oContractor, EnumDBOperation.Delete, nUserID);
            try
            {
                Command.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                sReturnMessage = e.Message.Split('~')[0];
            }
            Connection.Close();
            return(sReturnMessage);
        }
コード例 #4
0
        public Contractor IUD(Contractor oContractor, int nUserID)
        {
            Connection.Open();
            if (oContractor.ContractorID == 0)
            {
                Command.CommandText = ContractorDA.IUD(oContractor, EnumDBOperation.Insert, nUserID);
            }
            else
            {
                Command.CommandText = ContractorDA.IUD(oContractor, EnumDBOperation.Update, nUserID);
            }
            SqlDataReader reader       = Command.ExecuteReader();
            Contractor    _oContractor = new Contractor();

            if (reader.HasRows)
            {
                _oContractor = MakeObject(reader);
            }
            reader.Close();
            Connection.Close();
            return(_oContractor);
        }