Пример #1
0
 //
 public dynamic GetModel(int Id)
 {
     try
     {
         dynamic       model  = null;
         StringBuilder strSql = new StringBuilder();
         strSql.Append(" select Id,TypeIndicatorName,Editor,CreateDate from T_UploadTypeIndicator ");
         strSql.Append(" where Id=@Id");
         SqlParameter[] parameters =
         {
             new SqlParameter("@Id", SqlDbType.Int, 4)
         };
         parameters[0].Value = Id;
         using (dynamic read = DbHelperSQL.ExecuteReader(strSql.ToString(), parameters))
         {
             model = new UploadTypeIndicator();
             if (read.Read())
             {
                 try { model.Id = int.Parse(read["Id"].ToString()); }
                 catch { }
                 model.TypeIndicatorName = read["TypeIndicatorName"].ToString();
                 model.Editor            = read["Editor"].ToString();
                 try { model.CreateDate = DateTime.Parse(read["CreateDate"].ToString()); }
                 catch { }
             }
             read.Dispose();
         }
         return(model);
     }
     catch { throw; }
 }
Пример #2
0
        private dynamic GetModels(HttpContext context)
        {
            dynamic model = new UploadTypeIndicator();

            model.TypeIndicatorName = context.Request.Form["TypeIndicatorName"];
            model.Editor            = adminUser.AdminName;
            try { model.Id = int.Parse(context.Request.Form["Id"].ToString()); }
            catch { model.Id = 0; }
            return(model);
        }
Пример #3
0
 //
 public bool Update(UploadTypeIndicator model)
 {
     try
     {
         StringBuilder strSql = new StringBuilder();
         strSql.Append("update T_UploadTypeIndicator set ");
         strSql.Append("TypeIndicatorName=@TypeIndicatorName,");
         strSql.Append("Editor=@Editor,");
         strSql.Append("CreateDate=@CreateDate");
         strSql.Append(" where Id=@Id");
         if (DbHelperSQL.ExecuteSql(strSql.ToString(), GetSqlParameter(model)) > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch { throw; }
 }
Пример #4
0
        //
        public bool Create(UploadTypeIndicator model)
        {
            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into T_UploadTypeIndicator(");
                strSql.Append("TypeIndicatorName,Editor,CreateDate)");
                strSql.Append(" values (");
                strSql.Append("@TypeIndicatorName,@Editor,@CreateDate)");

                if (DbHelperSQL.ExecuteSql(strSql.ToString(), GetSqlParameter(model)) > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch { throw; }
        }