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

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    PEIS.Model.DictExamPlace busExamPlace = new PEIS.Model.DictExamPlace();
                    if (dt.Rows[i]["ExamPlaceID"].ToString() != "")
                    {
                        busExamPlace.ExamPlaceID = int.Parse(dt.Rows[i]["ExamPlaceID"].ToString());
                    }
                    busExamPlace.ExamPlaceName = dt.Rows[i]["ExamPlaceName"].ToString();
                    if (dt.Rows[i]["Is_Default"].ToString() != "")
                    {
                        if (dt.Rows[i]["Is_Default"].ToString() == "1" || dt.Rows[i]["Is_Default"].ToString().ToLower() == "true")
                        {
                            busExamPlace.Default = true;
                        }
                        else
                        {
                            busExamPlace.Default = false;
                        }
                    }
                    busExamPlace.InputCode = dt.Rows[i]["InputCode"].ToString();
                    list.Add(busExamPlace);
                }
            }
            return(list);
        }
示例#2
0
        public int Add(PEIS.Model.DictExamPlace model)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("insert into DictExamPlace(");
            stringBuilder.Append("ExamPlaceName,Is_Default,InputCode)");
            stringBuilder.Append(" values (");
            stringBuilder.Append("@ExamPlaceName,@Is_Default,@InputCode)");
            stringBuilder.Append(";select @@IDENTITY");
            SqlParameter[] array = new SqlParameter[]
            {
                new SqlParameter("@ExamPlaceName", SqlDbType.VarChar, 50),
                new SqlParameter("@Is_Default", SqlDbType.Bit, 1),
                new SqlParameter("@InputCode", SqlDbType.VarChar, 10)
            };
            array[0].Value = model.ExamPlaceName;
            array[1].Value = model.Default;
            array[2].Value = model.InputCode;
            object single = DbHelperSQL.GetSingle(stringBuilder.ToString(), array);
            int    result;

            if (single == null)
            {
                result = 0;
            }
            else
            {
                result = Convert.ToInt32(single);
            }
            return(result);
        }
示例#3
0
 protected void GetEditExamPlaceInfo(int ExamPlaceID, ref VelocityContext vltContext)
 {
     if (ExamPlaceID > 0)
     {
         PEIS.Model.DictExamPlace model = PEIS.BLL.DictExamPlace.Instance.GetModel(ExamPlaceID);
         if (null != model)
         {
             vltContext.Put("ExamPlaceID", model.ExamPlaceID);
             vltContext.Put("ExamPlaceName", model.ExamPlaceName);
             vltContext.Put("InputCode", model.InputCode);
             vltContext.Put("Default", model.Default);
         }
     }
 }
示例#4
0
        public PEIS.Model.DictExamPlace GetModel(int ExamPlaceID)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select  top 1 ExamPlaceID,ExamPlaceName,Is_Default,InputCode from DictExamPlace ");
            stringBuilder.Append(" where ExamPlaceID=@ExamPlaceID");
            SqlParameter[] array = new SqlParameter[]
            {
                new SqlParameter("@ExamPlaceID", SqlDbType.Int, 4)
            };
            array[0].Value = ExamPlaceID;
            PEIS.Model.DictExamPlace busExamPlace = new PEIS.Model.DictExamPlace();
            DataSet dataSet = DbHelperSQL.Query(stringBuilder.ToString(), array);

            PEIS.Model.DictExamPlace result;
            if (dataSet.Tables[0].Rows.Count > 0)
            {
                if (dataSet.Tables[0].Rows[0]["ExamPlaceID"].ToString() != "")
                {
                    busExamPlace.ExamPlaceID = int.Parse(dataSet.Tables[0].Rows[0]["ExamPlaceID"].ToString());
                }
                busExamPlace.ExamPlaceName = dataSet.Tables[0].Rows[0]["ExamPlaceName"].ToString();
                if (dataSet.Tables[0].Rows[0]["Default"].ToString() != "")
                {
                    if (dataSet.Tables[0].Rows[0]["Default"].ToString() == "1" || dataSet.Tables[0].Rows[0]["Default"].ToString().ToLower() == "true")
                    {
                        busExamPlace.Default = true;
                    }
                    else
                    {
                        busExamPlace.Default = false;
                    }
                }
                busExamPlace.InputCode = dataSet.Tables[0].Rows[0]["InputCode"].ToString();
                result = busExamPlace;
            }
            else
            {
                result = null;
            }
            return(result);
        }
示例#5
0
        public bool Update(PEIS.Model.DictExamPlace model)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("update DictExamPlace set ");
            stringBuilder.Append("ExamPlaceName=@ExamPlaceName,");
            stringBuilder.Append("Default=@Default,");
            stringBuilder.Append("InputCode=@InputCode");
            stringBuilder.Append(" where ExamPlaceID=@ExamPlaceID");
            SqlParameter[] array = new SqlParameter[]
            {
                new SqlParameter("@ExamPlaceName", SqlDbType.VarChar, 50),
                new SqlParameter("@Default", SqlDbType.Bit, 1),
                new SqlParameter("@InputCode", SqlDbType.VarChar, 10),
                new SqlParameter("@ExamPlaceID", SqlDbType.Int, 4)
            };
            array[0].Value = model.ExamPlaceName;
            array[1].Value = model.Default;
            array[2].Value = model.InputCode;
            array[3].Value = model.ExamPlaceID;
            int num = DbHelperSQL.ExecuteSql(stringBuilder.ToString(), array);

            return(num > 0);
        }
示例#6
0
 public int SaveExamPlace(PEIS.Model.DictExamPlace ExamPlaceModel)
 {
     return(CommonConfig.dal.SaveExamPlace(ExamPlaceModel));
 }
示例#7
0
 public bool Update(PEIS.Model.DictExamPlace model)
 {
     return(this.dal.Update(model));
 }
示例#8
0
 public int Add(PEIS.Model.DictExamPlace model)
 {
     return(this.dal.Add(model));
 }