예제 #1
0
        public PassThrusBO getPassThrus(int rateID)
        {
            SqlDataReader sqlDataRdr = base.GetDataReader("SELECT RateCode FROM RateCode WHERE (RateTypeCode='PassThru') AND RateSeqNum=" + rateID);

            PassThrusBO myPassThrus = new PassThrusBO(this.RateSchedulePassThrus);

            string rateCode; int passThruRateID;
            while(sqlDataRdr.Read())
            {
                rateCode = sqlDataRdr["RateCode"].ToString();

                if ( (rateCode=="All") || (rateCode=="None") )
                {	myPassThrus.addPassThru(new PassThruStruct(0, rateCode));	}
                else
                {
                    passThruRateID = Convert.ToInt32(rateCode);
                    myPassThrus.addPassThru(new PassThruStruct(passThruRateID, this.RateSchedulePassThrus.getPassThruName(passThruRateID)));
                }
            }

            base.CloseConnection();

            return myPassThrus;
        }
예제 #2
0
        public void updatePassThrus(PassThrusBO passThrus, RateBO rate)
        {
            SqlParameter[] sqlParams;

            ArrayList passThrusList = passThrus.getArrayListOfPassThrus();

            ArrayList passThrusCodeList = new ArrayList();

            PassThruStruct passThru;
            for(int k=0; k<passThrusList.Count; k++)
            {
                passThru = (PassThruStruct) passThrusList[k];

                if ( (passThru.RateName=="All") || (passThru.RateName=="None") )
                {	passThrusCodeList.Add(passThru.RateName);	}
                else
                {	passThrusCodeList.Add(passThru.RateID.ToString());	}
            }

            DataSet oDataSet = base.GetDataSet("SELECT * FROM RateCode WHERE RateTypeCode='PassThru' AND RateSeqNum=" + rate.ID);

            sqlParams = base.GetParameters("DeleteRateCode");

            foreach(DataRow dRow in oDataSet.Tables[0].Rows)
            {
                if (! passThrusCodeList.Contains(dRow["RateCode"].ToString()) )
                {
                    sqlParams[0].Value = dRow["RateCodeSeqNum"];
                    sqlParams[1].Value = dRow["RateSeqNum"];
                    sqlParams[2].Value = dRow["RateSchedSeqNum"];
                    base.ExecuteDelete("DeleteRateCode", sqlParams);
                }
                else
                {	passThrusCodeList.Remove(dRow["RateCode"].ToString());	}
            }

            sqlParams = base.GetParameters("UpdateRateCode");

            for(int k=0; k<passThrusCodeList.Count; k++)
            {
                foreach(SqlParameter sqlParam in sqlParams)
                {
                    switch(sqlParam.ParameterName)
                    {
                        case "@RateCodeSeqNum" :	sqlParam.Value = DBNull.Value; break;
                        case "@RateSeqNum" : sqlParam.Value = rate.ID; break;
                        case "@RateSchedSeqNum" : sqlParam.Value = rate.RateScheduleID; break;
                        case "@RateTypeCode" : sqlParam.Value = "PassThru"; break;
                        case "@RateCode" : sqlParam.Value = passThrusCodeList[k].ToString(); break;
                        default : break;
                    }
                }
                base.ExecuteUpdate("UpdateRateCode", sqlParams);
            }
        }
예제 #3
0
 public void insertPassThrus(PassThrusBO passThrus, RateBO rate)
 {
     updatePassThrus(passThrus, rate);
 }