Beispiel #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public tabExperienceEduModel GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * ");
            strSql.Append("  from tabExperienceEdu ");
            strSql.Append(" where id=SQL2012id");
            SqlParameter[] parameters =
            {
                new SqlParameter("SQL2012id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;


            tabExperienceEduModel model = new tabExperienceEduModel();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(ModelHandler <tabExperienceEduModel> .FillModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(tabExperienceEduModel model)
 {
     return(dal.Update(model));
 }
Beispiel #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(tabExperienceEduModel model)
 {
     return(dal.Add(model));
 }
Beispiel #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(tabExperienceEduModel model, List <string> ChangedFields)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tabExperienceEdu set ");

            strSql.Append(" SchoolName = SQL2012SchoolName , ");
            strSql.Append(" ProfessionalName = SQL2012ProfessionalName , ");
            strSql.Append(" EduBeginDate = SQL2012EduBeginDate , ");
            strSql.Append(" EduEndDate = SQL2012EduEndDate , ");
            strSql.Append(" GetEdu = SQL2012GetEdu , ");
            strSql.Append(" IsTZ = SQL2012IsTZ , ");
            strSql.Append(" Is211 = SQL2012Is211 , ");
            strSql.Append(" IsVal = SQL2012IsVal , ");
            strSql.Append(" AddonInfo = SQL2012AddonInfo , ");
            strSql.Append(" AppID = SQL2012AppID , ");
            strSql.Append(" Version = SQL2012Version , ");
            strSql.Append(" RandomNo = SQL2012RandomNo , ");
            strSql.Append(" ParentID = SQL2012ParentID , ");
            strSql.Append(" Remark = SQL2012Remark , ");
            strSql.Append(" LableText = SQL2012LableText , ");
            strSql.Append(" ExJson = SQL2012ExJson , ");
            strSql.Append(" Status = SQL2012Status , ");
            strSql.Append(" OrderNo = SQL2012OrderNo , ");
            strSql.Append(" CreateDate = SQL2012CreateDate , ");
            strSql.Append(" ModifyDate = SQL2012ModifyDate , ");
            strSql.Append(" CreateUser = SQL2012CreateUser , ");
            strSql.Append(" ModifyUser = SQL2012ModifyUser  ");
            strSql.Append(" where id=SQL2012id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("SQL2012SchoolName",       SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012ProfessionalName", SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012EduBeginDate",     SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012EduEndDate",       SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012GetEdu",           SqlDbType.Int,        4),
                new SqlParameter("SQL2012IsTZ",             SqlDbType.Bit,        1),
                new SqlParameter("SQL2012Is211",            SqlDbType.Bit,        1),
                new SqlParameter("SQL2012IsVal",            SqlDbType.Bit,        1),
                new SqlParameter("SQL2012AddonInfo",        SqlDbType.NVarChar,  -1),
                new SqlParameter("SQL2012id",               SqlDbType.Int,        4),
                new SqlParameter("SQL2012AppID",            SqlDbType.NVarChar, 100),
                new SqlParameter("SQL2012Version",          SqlDbType.NVarChar, 100),
                new SqlParameter("SQL2012RandomNo",         SqlDbType.NVarChar, 200),
                new SqlParameter("SQL2012ParentID",         SqlDbType.Int,        4),
                new SqlParameter("SQL2012Remark",           SqlDbType.NVarChar,  -1),
                new SqlParameter("SQL2012LableText",        SqlDbType.NVarChar,  -1),
                new SqlParameter("SQL2012ExJson",           SqlDbType.NVarChar,  -1),
                new SqlParameter("SQL2012Status",           SqlDbType.NVarChar,  -1),
                new SqlParameter("SQL2012OrderNo",          SqlDbType.Int,        4),
                new SqlParameter("SQL2012CreateDate",       SqlDbType.NVarChar, 200),
                new SqlParameter("SQL2012ModifyDate",       SqlDbType.NVarChar, 200),
                new SqlParameter("SQL2012CreateUser",       SqlDbType.Int,        4),
                new SqlParameter("SQL2012ModifyUser",       SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.SchoolName;
            parameters[1].Value  = model.ProfessionalName;
            parameters[2].Value  = model.EduBeginDate;
            parameters[3].Value  = model.EduEndDate;
            parameters[4].Value  = model.GetEdu;
            parameters[5].Value  = model.IsTZ;
            parameters[6].Value  = model.Is211;
            parameters[7].Value  = model.IsVal;
            parameters[8].Value  = model.AddonInfo;
            parameters[9].Value  = model.id;
            parameters[10].Value = model.AppID;
            parameters[11].Value = model.Version;
            parameters[12].Value = model.RandomNo;
            parameters[13].Value = model.ParentID;
            parameters[14].Value = model.Remark;
            parameters[15].Value = model.LableText;
            parameters[16].Value = model.ExJson;
            parameters[17].Value = model.Status;
            parameters[18].Value = model.OrderNo;
            parameters[19].Value = model.CreateDate;
            parameters[20].Value = model.ModifyDate;
            parameters[21].Value = model.CreateUser;
            parameters[22].Value = model.ModifyUser;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(tabExperienceEduModel model)
        {
            model.Version    = model.Version.IsNotNullOrEmpty()? model.Version: "1";
            model.RandomNo   = model.RandomNo.IsNotNullOrEmpty()? model.RandomNo: Guid.NewGuid().ToString("N");
            model.Status     = model.Status.IsNotNullOrEmpty()? model.Status: "1";
            model.OrderNo    = model.OrderNo > 0? model.OrderNo: 1;
            model.CreateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            model.ModifyDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tabExperienceEdu(");
            strSql.Append("SchoolName,ProfessionalName,EduBeginDate,EduEndDate,GetEdu,IsTZ,Is211,IsVal,AddonInfo,AppID,Version,RandomNo,ParentID,Remark,LableText,ExJson,Status,OrderNo,CreateDate,ModifyDate,CreateUser,ModifyUser");
            strSql.Append(") values (");
            strSql.Append("SQL2012SchoolName,SQL2012ProfessionalName,SQL2012EduBeginDate,SQL2012EduEndDate,SQL2012GetEdu,SQL2012IsTZ,SQL2012Is211,SQL2012IsVal,SQL2012AddonInfo,SQL2012AppID,SQL2012Version,SQL2012RandomNo,SQL2012ParentID,SQL2012Remark,SQL2012LableText,SQL2012ExJson,SQL2012Status,SQL2012OrderNo,SQL2012CreateDate,SQL2012ModifyDate,SQL2012CreateUser,SQL2012ModifyUser");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("SQL2012SchoolName",       SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012ProfessionalName", SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012EduBeginDate",     SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012EduEndDate",       SqlDbType.NVarChar,  50),
                new SqlParameter("SQL2012GetEdu",           SqlDbType.Int,        4),
                new SqlParameter("SQL2012IsTZ",             SqlDbType.Bit,        1),
                new SqlParameter("SQL2012Is211",            SqlDbType.Bit,        1),
                new SqlParameter("SQL2012IsVal",            SqlDbType.Bit,        1),
                new SqlParameter("SQL2012AddonInfo",        SqlDbType.NVarChar,  -1),
                new SqlParameter("SQL2012AppID",            SqlDbType.NVarChar, 100),
                new SqlParameter("SQL2012Version",          SqlDbType.NVarChar, 100),
                new SqlParameter("SQL2012RandomNo",         SqlDbType.NVarChar, 200),
                new SqlParameter("SQL2012ParentID",         SqlDbType.Int,        4),
                new SqlParameter("SQL2012Remark",           SqlDbType.NVarChar,  -1),
                new SqlParameter("SQL2012LableText",        SqlDbType.NVarChar,  -1),
                new SqlParameter("SQL2012ExJson",           SqlDbType.NVarChar,  -1),
                new SqlParameter("SQL2012Status",           SqlDbType.NVarChar,  -1),
                new SqlParameter("SQL2012OrderNo",          SqlDbType.Int,        4),
                new SqlParameter("SQL2012CreateDate",       SqlDbType.NVarChar, 200),
                new SqlParameter("SQL2012ModifyDate",       SqlDbType.NVarChar, 200),
                new SqlParameter("SQL2012CreateUser",       SqlDbType.Int,        4),
                new SqlParameter("SQL2012ModifyUser",       SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.SchoolName;
            parameters[1].Value  = model.ProfessionalName;
            parameters[2].Value  = model.EduBeginDate;
            parameters[3].Value  = model.EduEndDate;
            parameters[4].Value  = model.GetEdu;
            parameters[5].Value  = model.IsTZ;
            parameters[6].Value  = model.Is211;
            parameters[7].Value  = model.IsVal;
            parameters[8].Value  = model.AddonInfo;
            parameters[9].Value  = model.AppID;
            parameters[10].Value = model.Version;
            parameters[11].Value = model.RandomNo;
            parameters[12].Value = model.ParentID;
            parameters[13].Value = model.Remark;
            parameters[14].Value = model.LableText;
            parameters[15].Value = model.ExJson;
            parameters[16].Value = model.Status;
            parameters[17].Value = model.OrderNo;
            parameters[18].Value = model.CreateDate;
            parameters[19].Value = model.ModifyDate;
            parameters[20].Value = model.CreateUser;
            parameters[21].Value = model.ModifyUser;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }