Beispiel #1
0
        public int Add(PEIS.Model.DictExamType model)
        {
            StringBuilder stringBuilder = new StringBuilder();

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

            if (single == null)
            {
                result = 0;
            }
            else
            {
                result = Convert.ToInt32(single);
            }
            return(result);
        }
Beispiel #2
0
        public PEIS.Model.DictExamType GetModel(int ExamTypeID)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select  top 1 ExamTypeID,ExamTypeName,InputCode,Is_Document from DictExamType ");
            stringBuilder.Append(" where ExamTypeID=@ExamTypeID");
            SqlParameter[] array = new SqlParameter[]
            {
                new SqlParameter("@ExamTypeID", SqlDbType.Int, 4)
            };
            array[0].Value = ExamTypeID;
            PEIS.Model.DictExamType dictExamType = new PEIS.Model.DictExamType();
            DataSet dataSet = DbHelperSQL.Query(stringBuilder.ToString(), array);

            PEIS.Model.DictExamType result;
            if (dataSet.Tables[0].Rows.Count > 0)
            {
                if (dataSet.Tables[0].Rows[0]["ExamTypeID"].ToString() != "")
                {
                    dictExamType.ExamTypeID = int.Parse(dataSet.Tables[0].Rows[0]["ExamTypeID"].ToString());
                }
                dictExamType.ExamTypeName = dataSet.Tables[0].Rows[0]["ExamTypeName"].ToString();
                dictExamType.InputCode    = dataSet.Tables[0].Rows[0]["InputCode"].ToString();
                if (dataSet.Tables[0].Rows[0]["DocumentID"].ToString() != "")
                {
                    dictExamType.DocumentID = new int?(int.Parse(dataSet.Tables[0].Rows[0]["DocumentID"].ToString()));
                }
                result = dictExamType;
            }
            else
            {
                result = null;
            }
            return(result);
        }
Beispiel #3
0
 protected void GetEditExamTypeInfo(int ExamTypeID, ref VelocityContext vltContext)
 {
     if (ExamTypeID > 0)
     {
         PEIS.Model.DictExamType model = PEIS.BLL.DictExamType.Instance.GetModel(ExamTypeID);
         if (null != model)
         {
             vltContext.Put("ExamTypeID", model.ExamTypeID);
             vltContext.Put("ExamTypeName", model.ExamTypeName);
             vltContext.Put("DocumentID", model.DocumentID);
             vltContext.Put("InputCode", model.InputCode);
         }
     }
 }
Beispiel #4
0
        public List <PEIS.Model.DictExamType> DataTableToList(DataTable dt)
        {
            List <PEIS.Model.DictExamType> list = new List <PEIS.Model.DictExamType>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    PEIS.Model.DictExamType examType = new PEIS.Model.DictExamType();
                    if (dt.Rows[i]["ExamTypeID"].ToString() != "")
                    {
                        examType.ExamTypeID = int.Parse(dt.Rows[i]["ExamTypeID"].ToString());
                    }
                    examType.ExamTypeName = dt.Rows[i]["ExamTypeName"].ToString();
                    examType.InputCode    = dt.Rows[i]["InputCode"].ToString();
                    list.Add(examType);
                }
            }
            return(list);
        }
Beispiel #5
0
        public bool Update(PEIS.Model.DictExamType model)
        {
            StringBuilder stringBuilder = new StringBuilder();

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

            return(num > 0);
        }
Beispiel #6
0
 public bool Update(PEIS.Model.DictExamType model)
 {
     return(this.dal.Update(model));
 }
Beispiel #7
0
 public int Add(PEIS.Model.DictExamType model)
 {
     return(this.dal.Add(model));
 }
Beispiel #8
0
 public int SaveDictExamType(PEIS.Model.DictExamType DictExamTypeModel)
 {
     return(CommonConfig.dal.SaveDictExamType(DictExamTypeModel));
 }