private void Bind() { int totalRecords = 0; if (!string.IsNullOrEmpty(asId.Value)) { //查询条件 GetSearchItem(); ActivitySignUp bll = new ActivitySignUp(); rpData.DataSource = bll.GetListOW(pageIndex, pageSize, out totalRecords, sqlWhere, parms == null ? null : parms.ToArray()); rpData.DataBind(); } myDataAppend.Append("<div id=\"myDataForPage\" style=\"display:none;\">[{\"PageIndex\":\"" + pageIndex + "\",\"PageSize\":\"" + pageSize + "\",\"TotalRecord\":\"" + totalRecords + "\",\"QueryStr\":\"" + queryStr + "\"}]</div>"); }
public ActionResult EditActivitySignUp(int sqno) { ActivitySignUp model = db.activitySignUp.Where(x => x.sqno == sqno).FirstOrDefault(); if (model == null) { ViewBag.ErrorMessage = "找不到資料"; return(RedirectToAction("Index")); } else { ViewBag.roleList = DropDownListHelper.getRoleList(false); ViewBag.educationLevelList = DropDownListHelper.getEducationLevelList(false); ViewBag.industryTypeList = DropDownListHelper.getIndustryTypeList(false); ViewBag.cultureList = DropDownListHelper.getCultureList(true); ViewBag.willComeList = DropDownListHelper.getWillComeList(false); return(View(model)); } }
public DataTable CreateExcelData(string id) { DataTable ExcelData = new DataTable(); ExcelData.Columns.Add("活动标题", typeof(string)); ExcelData.Columns.Add("报名姓名", typeof(string)); ExcelData.Columns.Add("性别", typeof(string)); ExcelData.Columns.Add("联系方式", typeof(string)); ExcelData.Columns.Add("报名昵称", typeof(string)); ExcelData.Columns.Add("最后更新时间", typeof(string)); ParamsHelper parms = new ParamsHelper(); string sqlWhere = " AND asu.ActivityId = @ActivityId "; SqlParameter parm = new SqlParameter("@ActivityId", SqlDbType.UniqueIdentifier); parm.Value = Guid.Parse(id); parms.Add(parm); ActivitySignUp bll = new ActivitySignUp(); DataSet ds = bll.ExportExcel(sqlWhere, parms == null ? null : parms.ToArray()); if (ds == null) { return(null); } foreach (DataRow row in ds.Tables[0].Rows) { DataRow NewRow = ExcelData.NewRow(); NewRow["活动标题"] = row["Title"].ToString(); NewRow["报名姓名"] = row["UserName"].ToString(); NewRow["性别"] = row["Sex"].ToString(); NewRow["联系方式"] = row["MobilePhone"].ToString(); NewRow["报名昵称"] = row["Nickname"].ToString(); NewRow["最后更新时间"] = row["LastUpdatedDate"].ToString(); ExcelData.Rows.Add(NewRow); } return(ExcelData); }
public ActionResult EditActivitySignUp(ActivitySignUp model) { if (ModelState.IsValid) { db.Entry(model).State = EntityState.Modified; db.SaveChanges(); var result = new { success = true }; return(Json(result)); } else { var result = new { success = false, errorMessage = "資料有誤,請檢查並更正資料", ModelStateErrors = ModelState.Where(x => x.Value.Errors.Count > 0) .ToDictionary(k => k.Key, k => k.Value.Errors.Select(e => e.ErrorMessage).ToArray()) }; return(Json(result)); } }