Esempio n. 1
0
        public int Add(PEIS.Model.BusSetFeeDetail model)
        {
            StringBuilder stringBuilder = new StringBuilder();

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

            if (single == null)
            {
                result = 0;
            }
            else
            {
                result = Convert.ToInt32(single);
            }
            return(result);
        }
Esempio n. 2
0
        public List <PEIS.Model.BusSetFeeDetail> DataTableToList(DataTable dt)
        {
            List <PEIS.Model.BusSetFeeDetail> list = new List <PEIS.Model.BusSetFeeDetail>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    PEIS.Model.BusSetFeeDetail busSetFeeDetail = new PEIS.Model.BusSetFeeDetail();
                    if (dt.Rows[i]["ID_DtlSetFee"].ToString() != "")
                    {
                        busSetFeeDetail.ID_DtlSetFee = int.Parse(dt.Rows[i]["ID_DtlSetFee"].ToString());
                    }
                    if (dt.Rows[i]["PEPackageID"].ToString() != "")
                    {
                        busSetFeeDetail.PEPackageID = new int?(int.Parse(dt.Rows[i]["PEPackageID"].ToString()));
                    }
                    if (dt.Rows[i]["ID_FeeItem"].ToString() != "")
                    {
                        busSetFeeDetail.ID_FeeItem = new int?(int.Parse(dt.Rows[i]["ID_FeeItem"].ToString()));
                    }
                    list.Add(busSetFeeDetail);
                }
            }
            return(list);
        }
Esempio n. 3
0
        public bool Update(PEIS.Model.BusSetFeeDetail model)
        {
            StringBuilder stringBuilder = new StringBuilder();

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

            return(num > 0);
        }
Esempio n. 4
0
        public PEIS.Model.BusSetFeeDetail GetModel(int ID_DtlSetFee)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select  top 1 ID_DtlSetFee,PEPackageID,ID_FeeItem from BusSetFeeDetail ");
            stringBuilder.Append(" where ID_DtlSetFee=@ID_DtlSetFee");
            SqlParameter[] array = new SqlParameter[]
            {
                new SqlParameter("@ID_DtlSetFee", SqlDbType.Int, 4)
            };
            array[0].Value = ID_DtlSetFee;
            PEIS.Model.BusSetFeeDetail busSetFeeDetail = new PEIS.Model.BusSetFeeDetail();
            DataSet dataSet = DbHelperSQL.Query(stringBuilder.ToString(), array);

            PEIS.Model.BusSetFeeDetail result;
            if (dataSet.Tables[0].Rows.Count > 0)
            {
                if (dataSet.Tables[0].Rows[0]["ID_DtlSetFee"].ToString() != "")
                {
                    busSetFeeDetail.ID_DtlSetFee = int.Parse(dataSet.Tables[0].Rows[0]["ID_DtlSetFee"].ToString());
                }
                if (dataSet.Tables[0].Rows[0]["PEPackageID"].ToString() != "")
                {
                    busSetFeeDetail.PEPackageID = new int?(int.Parse(dataSet.Tables[0].Rows[0]["PEPackageID"].ToString()));
                }
                if (dataSet.Tables[0].Rows[0]["ID_FeeItem"].ToString() != "")
                {
                    busSetFeeDetail.ID_FeeItem = new int?(int.Parse(dataSet.Tables[0].Rows[0]["ID_FeeItem"].ToString()));
                }
                result = busSetFeeDetail;
            }
            else
            {
                result = null;
            }
            return(result);
        }
Esempio n. 5
0
 public bool Update(PEIS.Model.BusSetFeeDetail model)
 {
     return(this.dal.Update(model));
 }
Esempio n. 6
0
 public int Add(PEIS.Model.BusSetFeeDetail model)
 {
     return(this.dal.Add(model));
 }