示例#1
0
 public ActionResult Collect(FormCollection form)
 {
     string Url = C.APP + "/Survey/Finish?Thankyou";
     try
     {
         foreach (var f in form.AllKeys)
         {
             string value = Request.Form[f];
             if (!string.IsNullOrEmpty(value))
             {
                 if (Regex.IsMatch(value, @"^\d+$") && value.Length < 10)
                 {
                     var p = new SurveyRecordsInt();
                     p.ItemID = Convert.ToInt32(f);
                     p.ItemValue = Convert.ToInt32(value);
                     DAL.Update.Survey(p);
                 }
                 else
                 {
                     var p = new SurveyRecordsText();
                     p.ItemID = Convert.ToInt32(f);
                     p.ItemValue = value;
                     DAL.Update.Survey(p);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         log.Warn("{0},{1}", ex.Message, ex.StackTrace);
         Url = C.APP + "/Survey/Finish?Thankyou_";
     }
     Response.Redirect(Url);
     return Content(string.Empty);
 }
示例#2
0
文件: Update.cs 项目: Xiaoyuyexi/LMS
        public static R Survey(SurveyRecordsInt p)
        {
            var m = new R();
            try
            {
                SqlParameter[] param =
                {
                    new SqlParameter("@UserID",p.UserID),
                    new SqlParameter("@ItemID",p.ItemID),
                    new SqlParameter("@ItemValue",p.ItemValue)
                   
                };

                var r = SqlHelper.ExecuteNonQuery(C.conn, CommandType.StoredProcedure, "Update_SurveyRecordsInt", param);
                m.Code = 0;
                m.Message = "success";

            }
            catch (Exception ex)
            {
                m.Code = 300;
                m.Message = ex.Message;
                log.Fatal(ex.Message);
                log.FatalException(ex.Message, ex);
            }
            return m;
        }