public ActionResult Activity_Check(f_activity model) { string sql = string.Format("update f_activity t set t.state=1,t.result='{0}',t.suggest='{1}' where t.id={2}", model.result, model.suggest, model.id); int count = DbHelperMySQL.ExecuteSql(sql); return(Json(Result.AutoResult(count), JsonRequestBehavior.AllowGet)); }
public ActionResult Activity_Add(f_activity model, List <int> ids) { string sql = string.Format("insert into f_activity(name,number,abilityid,teamid,time,state,del) values('{0}','{1}',{2},{3},'{4}',0,0);SELECT @@IDENTITY", model.name, model.number, model.abilityid, model.teamid, model.time); int activityid = Convert.ToInt32(DbHelperMySQL.GetSingle(sql)); int result = 0; foreach (var item in ids) { sql = string.Format("insert into f_activity_poor(activityid,poorid,profit) values({0},{1},0)", activityid, item); int count = DbHelperMySQL.ExecuteSql(sql); result += count; } return(Json(Result.AutoResult(result == ids.Count ? 1 : 0), JsonRequestBehavior.AllowGet)); }
public ActionResult Activity_Edit(f_activity model, List <int> ids) { string sql = string.Format("update f_activity t set name='{0}',number='{1}',abilityid={2},teamid={3},time='{4}' where t.id={5}", model.name, model.number, model.abilityid, model.teamid, model.time, model.id); int count = DbHelperMySQL.ExecuteSql(sql); sql = string.Format("delete from f_activity_poor where activityid={0}", model.id); count = DbHelperMySQL.ExecuteSql(sql); int result = 0; foreach (var item in ids) { sql = string.Format("insert into f_activity_poor(activityid,poorid,profit) values({0},{1},0)", model.id, item); count = DbHelperMySQL.ExecuteSql(sql); result += count; } return(Json(Result.AutoResult(result == ids.Count ? 1 : 0), JsonRequestBehavior.AllowGet)); }