Beispiel #1
0
        public List <PEIS.Model.BusFeeDetail> DataTableToList(DataTable dt)
        {
            List <PEIS.Model.BusFeeDetail> list = new List <PEIS.Model.BusFeeDetail>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    PEIS.Model.BusFeeDetail busFeeDetail = new PEIS.Model.BusFeeDetail();
                    if (dt.Rows[i]["ID_DtlFee"].ToString() != "")
                    {
                        busFeeDetail.ID_DtlFee = int.Parse(dt.Rows[i]["ID_DtlFee"].ToString());
                    }
                    if (dt.Rows[i]["ID_Fee"].ToString() != "")
                    {
                        busFeeDetail.ID_Fee = new int?(int.Parse(dt.Rows[i]["ID_Fee"].ToString()));
                    }
                    if (dt.Rows[i]["ID_ExamItem"].ToString() != "")
                    {
                        busFeeDetail.ID_ExamItem = new int?(int.Parse(dt.Rows[i]["ID_ExamItem"].ToString()));
                    }
                    list.Add(busFeeDetail);
                }
            }
            return(list);
        }
Beispiel #2
0
        public int Add(PEIS.Model.BusFeeDetail model)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("insert into BusFeeDetail(");
            stringBuilder.Append("ID_Fee,ID_ExamItem)");
            stringBuilder.Append(" values (");
            stringBuilder.Append("@ID_Fee,@ID_ExamItem)");
            stringBuilder.Append(";select @@IDENTITY");
            SqlParameter[] array = new SqlParameter[]
            {
                new SqlParameter("@ID_Fee", SqlDbType.Int, 4),
                new SqlParameter("@ID_ExamItem", SqlDbType.Int, 4)
            };
            array[0].Value = model.ID_Fee;
            array[1].Value = model.ID_ExamItem;
            object single = DbHelperSQL.GetSingle(stringBuilder.ToString(), array);
            int    result;

            if (single == null)
            {
                result = 0;
            }
            else
            {
                result = Convert.ToInt32(single);
            }
            return(result);
        }
Beispiel #3
0
        public bool Update(PEIS.Model.BusFeeDetail model)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("update BusFeeDetail set ");
            stringBuilder.Append("ID_Fee=@ID_Fee,");
            stringBuilder.Append("ID_ExamItem=@ID_ExamItem");
            stringBuilder.Append(" where ID_DtlFee=@ID_DtlFee");
            SqlParameter[] array = new SqlParameter[]
            {
                new SqlParameter("@ID_Fee", SqlDbType.Int, 4),
                new SqlParameter("@ID_ExamItem", SqlDbType.Int, 4),
                new SqlParameter("@ID_DtlFee", SqlDbType.Int, 4)
            };
            array[0].Value = model.ID_Fee;
            array[1].Value = model.ID_ExamItem;
            array[2].Value = model.ID_DtlFee;
            int num = DbHelperSQL.ExecuteSql(stringBuilder.ToString(), array);

            return(num > 0);
        }
Beispiel #4
0
        public PEIS.Model.BusFeeDetail GetModel(int ID_DtlFee)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select  top 1 ID_DtlFee,ID_Fee,ID_ExamItem from BusFeeDetail ");
            stringBuilder.Append(" where ID_DtlFee=@ID_DtlFee");
            SqlParameter[] array = new SqlParameter[]
            {
                new SqlParameter("@ID_DtlFee", SqlDbType.Int, 4)
            };
            array[0].Value = ID_DtlFee;
            PEIS.Model.BusFeeDetail busFeeDetail = new PEIS.Model.BusFeeDetail();
            DataSet dataSet = DbHelperSQL.Query(stringBuilder.ToString(), array);

            PEIS.Model.BusFeeDetail result;
            if (dataSet.Tables[0].Rows.Count > 0)
            {
                if (dataSet.Tables[0].Rows[0]["ID_DtlFee"].ToString() != "")
                {
                    busFeeDetail.ID_DtlFee = int.Parse(dataSet.Tables[0].Rows[0]["ID_DtlFee"].ToString());
                }
                if (dataSet.Tables[0].Rows[0]["ID_Fee"].ToString() != "")
                {
                    busFeeDetail.ID_Fee = new int?(int.Parse(dataSet.Tables[0].Rows[0]["ID_Fee"].ToString()));
                }
                if (dataSet.Tables[0].Rows[0]["ID_ExamItem"].ToString() != "")
                {
                    busFeeDetail.ID_ExamItem = new int?(int.Parse(dataSet.Tables[0].Rows[0]["ID_ExamItem"].ToString()));
                }
                result = busFeeDetail;
            }
            else
            {
                result = null;
            }
            return(result);
        }
Beispiel #5
0
 public bool Update(PEIS.Model.BusFeeDetail model)
 {
     return(this.dal.Update(model));
 }
Beispiel #6
0
 public int Add(PEIS.Model.BusFeeDetail model)
 {
     return(this.dal.Add(model));
 }