VIEW
<table id="table_list" width="720" class="tb2" cellpadding="0" cellspacing="0"> <tr > <td class="dh strong" width="40"><input type="checkbox" ></td> <td class="dh strong" width="100">搬出省市</td> <td class="dh strong" width="100">搬入省市</td> <td class="dh strong" width="50">联系人</td> <td class="dh strong" width="80">联系电话</td> <td class="dh strong" width="80">发布日期</td> @* <td class="dh strong" width="80">信息竞价</td>*@ <td class="dh strong" width="50">搬家状态</td> <td class="dh strong" width="50">操作</td> <td class="dh strong" width="30">查看</td> <td class="dh strong" width="30">修改</td> <td class="dh strong" width="50">删除</td> </tr> @foreach (var item in Model) { <tr id="tr_list1" data="@item.Id" data1="@item.Type"> <td width="40"><input type="checkbox" ></td> <td>@item.StartArea</td> <td>@item.EndArea</td> <td>@item.LinkName</td> <td style="line-height:15px;">@item.LinkPhone<br>@item.LinkMobile</td> <td>@String.Format("{0:yyyy-MM-dd}", item.AddDate)</td> @* <td><input type="button" class="btn2"></td>*@ <td >@((item.Type) == true ? "已搬" : "未搬")</td> <td><input type="button" value="@((item.Type) == true ? "确认未搬" : "确认已搬")" class="btnUpdateMoved" ></td> <td><a href="/MoveHouseInfo/@item.Id"><img src="/images/find.png" width="19" height="19"></a></td> <td><a href="/Member/PublishMoveHouseInfo/?type=get&[email protected]"><img src="/images/xg.png" width="16" height="16"></a></td> <td><a href="javascript:void" class="del"><img src="/images/del.png" width="19" height="19"></a></td> </tr> } </table>
<script type="text/javascript"> $(function () { $(".btnUpdateMoved").click(function () { var $parent = $(this).parent().parent(); var _id = $parent.attr("data"); var _type = $parent.attr("data1"); $.post("/Member/UpdateType/", { id: _id, type: _type }, function (json) { if (json.code == 0) { //成功 location = location; return true; } else { //失败 alert(json.msg); return false; } }); $parent.each(function () { $parent.find("td:eq(6)").each(function () { if ($(this).html() == "已搬") { $(this).html("未搬"); } else { $(this).html("已搬"); } }); }); }); $(".del").click(function () { if (confirm("确实要删除此记录?")) { var $this = $(this).parent().parent(); var _id = $this.attr("data"); $.post("/Member/DelMoveHouseInfo/", { id: _id }, function (json) { if (json.code == 0) { //成功 $this.remove(); return true; } else { //失败 alert(json.msg); return false; } }); } }); }); </script>
Control
//修改专线状态 public JsonResult UpdateSpecial(int id, bool special) { special = special == true ? false : true; if (Models.DAL.ExpressLine.UpdateSpecial(id, special) > 0) { return Json(new { code = 0, msg = "" }); } else { return Json(new { code = 1, msg = "修改失败" }); } }
SQLServerDAL
#region 修改快递线路状态 /// <summary> ///根据自动编号、快递线路状态修改快递线路信息 /// </summary> /// <param name="Id">自动编号</param> /// <param name="IsSpecial">是否专线</param> /// <returns></returns> public int UpdateSpecial(int Id, bool IsSpecial) { string str = string.Format("update ExpressLine set IsSpecial={0} where Id={1}", Convert.ToInt32(IsSpecial), Id); return DBUtility.SqlHelper.ExecuteNonQuery(ConnString.conn, CommandType.Text, str, null); } #endregion
【盟友88物通网——物流专线管理】jquery循环Reaper某一列的值
时间: 2024-10-01 06:01:45