Exemplo n.º 1
0
        public M_Papers_System GetSelectByM_Ps(M_Papers_System mps)
        {
            string sql = "SELECT [id],[p_name],[p_type] FROM [ZL_Papers_System] WHERE 1=1";

            if (mps != null)  //判断条件是否为空
            {
                if (mps.Id > 0)
                {
                    sql += " AND [id]=" + mps.Id;
                }
                if (!string.IsNullOrEmpty(mps.p_name))
                {
                    sql += " AND [p_name]='" + mps.p_name + "'";
                }
                if (mps.p_type > 0)
                {
                    sql += " AND [p_type]=" + mps.p_type;
                }
            }
            DataSet ds = SqlHelper.ExecuteDataSet(CommandType.Text, sql);
            List <M_Papers_System> mpss = GetSelByDataset(ds);

            if (mpss != null && mpss.Count > 0)
            {
                return(mpss[0]);
            }
            else
            {
                return(new M_Papers_System());
            }
        }
Exemplo n.º 2
0
        public int GetInsert(M_Papers_System mps)
        {
            string sql = "INSERT INTO [ZL_Papers_System]([p_name],[p_type])VALUES(@p_name,@p_type);SELECT @@IDENTITY";

            SqlParameter[] para = new SqlParameter[] {
                new SqlParameter("@p_name", mps.p_name),
                new SqlParameter("@p_type", mps.p_type)
            };
            return(DataConvert.CLng(SqlHelper.ExecuteScalar(CommandType.Text, sql, para)));
        }
Exemplo n.º 3
0
 /// <summary>
 /// 根据条件查询系统试卷信息
 /// </summary>
 /// <param name="mps"></param>
 /// <returns></returns>
 ///
 private List <M_Papers_System> GetSelByDataset(DataSet ds)
 {
     if (ds != null && ds.Tables[0].Rows.Count > 0)
     {
         List <M_Papers_System> mpss = new List <M_Papers_System>();
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             M_Papers_System mps = new M_Papers_System();
             mps.Id     = DataConverter.CLng(dr["Id"]);
             mps.p_name = dr["p_name"].ToString();
             mps.p_type = DataConverter.CLng(dr["p_type"]);
             mpss.Add(mps);
         }
         return(mpss);
     }
     return(new List <M_Papers_System>());
 }
Exemplo n.º 4
0
 public int insert(M_Papers_System model)
 {
     return(DBCenter.Insert(model));
 }
Exemplo n.º 5
0
 public bool GetUpdate(M_Papers_System model)
 {
     return(DBCenter.UpdateByID(model, model.Id));
 }
Exemplo n.º 6
0
 public int insert(M_Papers_System model)
 {
     return(Sql.insert(strTableName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model)));
 }
Exemplo n.º 7
0
 public bool GetUpdate(M_Papers_System model)
 {
     return(Sql.UpdateByIDs(strTableName, PK, model.Id.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters()));
 }