Esempio n. 1
0
        public PEIS.Model.BusConclusionType GetModel(int ID_ConclusionType)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select  top 1 ID_ConclusionType,ConclusionTypeName,InputCode,Is_Banned,ID_BanOpr,BanOperator,BanDate,BanDescribe from BusConclusionType ");
            stringBuilder.Append(" where ID_ConclusionType=@ID_ConclusionType");
            SqlParameter[] array = new SqlParameter[]
            {
                new SqlParameter("@ID_ConclusionType", SqlDbType.Int, 4)
            };
            array[0].Value = ID_ConclusionType;
            PEIS.Model.BusConclusionType busConclusionType = new PEIS.Model.BusConclusionType();
            DataSet dataSet = DbHelperSQL.Query(stringBuilder.ToString(), array);

            PEIS.Model.BusConclusionType result;
            if (dataSet.Tables[0].Rows.Count > 0)
            {
                if (dataSet.Tables[0].Rows[0]["ID_ConclusionType"].ToString() != "")
                {
                    busConclusionType.ID_ConclusionType = int.Parse(dataSet.Tables[0].Rows[0]["ID_ConclusionType"].ToString());
                }
                busConclusionType.ConclusionTypeName = dataSet.Tables[0].Rows[0]["ConclusionTypeName"].ToString();
                busConclusionType.InputCode          = dataSet.Tables[0].Rows[0]["InputCode"].ToString();
                if (dataSet.Tables[0].Rows[0]["Is_Banned"].ToString() != "")
                {
                    if (dataSet.Tables[0].Rows[0]["Is_Banned"].ToString() == "1" || dataSet.Tables[0].Rows[0]["Is_Banned"].ToString().ToLower() == "true")
                    {
                        busConclusionType.Is_Banned = new bool?(true);
                    }
                    else
                    {
                        busConclusionType.Is_Banned = new bool?(false);
                    }
                }
                if (dataSet.Tables[0].Rows[0]["ID_BanOpr"].ToString() != "")
                {
                    busConclusionType.ID_BanOpr = new int?(int.Parse(dataSet.Tables[0].Rows[0]["ID_BanOpr"].ToString()));
                }
                busConclusionType.BanOperator = dataSet.Tables[0].Rows[0]["BanOperator"].ToString();
                if (dataSet.Tables[0].Rows[0]["BanDate"].ToString() != "")
                {
                    busConclusionType.BanDate = new DateTime?(DateTime.Parse(dataSet.Tables[0].Rows[0]["BanDate"].ToString()));
                }
                busConclusionType.BanDescribe = dataSet.Tables[0].Rows[0]["BanDescribe"].ToString();
                result = busConclusionType;
            }
            else
            {
                result = null;
            }
            return(result);
        }
Esempio n. 2
0
        public List <PEIS.Model.BusConclusionType> DataTableToList(DataTable dt)
        {
            List <PEIS.Model.BusConclusionType> list = new List <PEIS.Model.BusConclusionType>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    PEIS.Model.BusConclusionType busConclusionType = new PEIS.Model.BusConclusionType();
                    if (dt.Rows[i]["ID_ConclusionType"].ToString() != "")
                    {
                        busConclusionType.ID_ConclusionType = int.Parse(dt.Rows[i]["ID_ConclusionType"].ToString());
                    }
                    busConclusionType.ConclusionTypeName = dt.Rows[i]["ConclusionTypeName"].ToString();
                    busConclusionType.InputCode          = dt.Rows[i]["InputCode"].ToString();
                    if (dt.Rows[i]["Is_Banned"].ToString() != "")
                    {
                        if (dt.Rows[i]["Is_Banned"].ToString() == "1" || dt.Rows[i]["Is_Banned"].ToString().ToLower() == "true")
                        {
                            busConclusionType.Is_Banned = new bool?(true);
                        }
                        else
                        {
                            busConclusionType.Is_Banned = new bool?(false);
                        }
                    }
                    if (dt.Rows[i]["ID_BanOpr"].ToString() != "")
                    {
                        busConclusionType.ID_BanOpr = new int?(int.Parse(dt.Rows[i]["ID_BanOpr"].ToString()));
                    }
                    busConclusionType.BanOperator = dt.Rows[i]["BanOperator"].ToString();
                    if (dt.Rows[i]["BanDate"].ToString() != "")
                    {
                        busConclusionType.BanDate = new DateTime?(DateTime.Parse(dt.Rows[i]["BanDate"].ToString()));
                    }
                    busConclusionType.BanDescribe = dt.Rows[i]["BanDescribe"].ToString();
                    list.Add(busConclusionType);
                }
            }
            return(list);
        }
Esempio n. 3
0
        public int Add(PEIS.Model.BusConclusionType model)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("insert into BusConclusionType(");
            stringBuilder.Append("ConclusionTypeName,InputCode,Is_Banned,ID_BanOpr,BanOperator,BanDate,BanDescribe)");
            stringBuilder.Append(" values (");
            stringBuilder.Append("@ConclusionTypeName,@InputCode,@Is_Banned,@ID_BanOpr,@BanOperator,@BanDate,@BanDescribe)");
            stringBuilder.Append(";select @@IDENTITY");
            SqlParameter[] array = new SqlParameter[]
            {
                new SqlParameter("@ConclusionTypeName", SqlDbType.VarChar, 50),
                new SqlParameter("@InputCode", SqlDbType.VarChar, 10),
                new SqlParameter("@Is_Banned", SqlDbType.Bit, 1),
                new SqlParameter("@ID_BanOpr", SqlDbType.Int, 4),
                new SqlParameter("@BanOperator", SqlDbType.VarChar, 30),
                new SqlParameter("@BanDate", SqlDbType.DateTime),
                new SqlParameter("@BanDescribe", SqlDbType.VarChar, 100)
            };
            array[0].Value = model.ConclusionTypeName;
            array[1].Value = model.InputCode;
            array[2].Value = model.Is_Banned;
            array[3].Value = model.ID_BanOpr;
            array[4].Value = model.BanOperator;
            array[5].Value = model.BanDate;
            array[6].Value = model.BanDescribe;
            object single = DbHelperSQL.GetSingle(stringBuilder.ToString(), array);
            int    result;

            if (single == null)
            {
                result = 0;
            }
            else
            {
                result = Convert.ToInt32(single);
            }
            return(result);
        }
Esempio n. 4
0
        public bool Update(PEIS.Model.BusConclusionType model)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("update BusConclusionType set ");
            stringBuilder.Append("ConclusionTypeName=@ConclusionTypeName,");
            stringBuilder.Append("InputCode=@InputCode,");
            stringBuilder.Append("Is_Banned=@Is_Banned,");
            stringBuilder.Append("ID_BanOpr=@ID_BanOpr,");
            stringBuilder.Append("BanOperator=@BanOperator,");
            stringBuilder.Append("BanDate=@BanDate,");
            stringBuilder.Append("BanDescribe=@BanDescribe");
            stringBuilder.Append(" where ID_ConclusionType=@ID_ConclusionType");
            SqlParameter[] array = new SqlParameter[]
            {
                new SqlParameter("@ConclusionTypeName", SqlDbType.VarChar, 50),
                new SqlParameter("@InputCode", SqlDbType.VarChar, 10),
                new SqlParameter("@Is_Banned", SqlDbType.Bit, 1),
                new SqlParameter("@ID_BanOpr", SqlDbType.Int, 4),
                new SqlParameter("@BanOperator", SqlDbType.VarChar, 30),
                new SqlParameter("@BanDate", SqlDbType.DateTime),
                new SqlParameter("@BanDescribe", SqlDbType.VarChar, 100),
                new SqlParameter("@ID_ConclusionType", SqlDbType.Int, 4)
            };
            array[0].Value = model.ConclusionTypeName;
            array[1].Value = model.InputCode;
            array[2].Value = model.Is_Banned;
            array[3].Value = model.ID_BanOpr;
            array[4].Value = model.BanOperator;
            array[5].Value = model.BanDate;
            array[6].Value = model.BanDescribe;
            array[7].Value = model.ID_ConclusionType;
            int num = DbHelperSQL.ExecuteSql(stringBuilder.ToString(), array);

            return(num > 0);
        }
Esempio n. 5
0
 public int SaveConclusionType(PEIS.Model.BusConclusionType ConclusionTypeModel)
 {
     return(CommonConfig.dal.SaveConclusionType(ConclusionTypeModel));
 }
Esempio n. 6
0
 public bool Update(PEIS.Model.BusConclusionType model)
 {
     return(this.dal.Update(model));
 }
Esempio n. 7
0
 public int Add(PEIS.Model.BusConclusionType model)
 {
     return(this.dal.Add(model));
 }