/// <summary> /// 增加一条数据 /// </summary> public int Add(ZhongLi.Model.ServerUser_Message model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@SerMesID", SqlDbType.Int, 4), new SqlParameter("@SerUserID", SqlDbType.Int, 4), new SqlParameter("@MesType", SqlDbType.Int, 4), new SqlParameter("@DataID", SqlDbType.Int, 4), new SqlParameter("@MesCon", SqlDbType.NVarChar, 200), new SqlParameter("@SendTime", SqlDbType.DateTime), new SqlParameter("@IsRead", SqlDbType.Bit, 1), new SqlParameter("@ReadTime", SqlDbType.DateTime), new SqlParameter("@Colvalue", SqlDbType.NVarChar, 50), new SqlParameter("@TargetID", SqlDbType.Int, 4) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.SerUserID; parameters[2].Value = model.MesType; parameters[3].Value = model.DataID; parameters[4].Value = model.MesCon; parameters[5].Value = model.SendTime; parameters[6].Value = model.IsRead; parameters[7].Value = model.ReadTime; parameters[8].Value = model.Colvalue; parameters[9].Value = model.TargetID; DbHelperSQL.RunProcedure("ServerUser_Message_ADD", parameters, out rowsAffected); return((int)parameters[0].Value); }
protected void btnSerImg_Click(object sender, EventArgs e) { if (Request.QueryString["SerUserID"] != null) { int SerUserID = Convert.ToInt32(Request.QueryString["SerUserID"]); ZhongLi.Model.ServerUser user = bll.GetModel(SerUserID); user.Flag = 2; bll.Update(user); //添加消息表 ZhongLi.Model.ServerUser_Message msg = new ZhongLi.Model.ServerUser_Message(); msg.MesCon = "您的身份认证通过啦"; msg.SendTime = DateTime.Now; msg.SerUserID = SerUserID; msg.MesType = 0; new ZhongLi.BLL.ServerUser_Message().Add(msg); //推送通知 JPushApiExample.ALERT = "您的身份认证通过啦"; JPushApiExample.MSG_CONTENT = "您的身份认证通过啦"; PushPayload pushsms = JPushApiExample.PushObject_ios_audienceMore_messageWithExtras("s" + SerUserID, "SerAuto"); JPushApiExample.push(pushsms); webHelper.addLog("通过了职业介绍人“" + user.RealName + "”的职能身份认证"); Page.ClientScript.RegisterStartupScript(Page.GetType(), "set", "<script>window.onload=showmsgclose('职业介绍人职业身份认证','认证成功!','Auth.aspx?SerUserID=" + user.SerUserID + "',1)</script>"); } }
/// <summary> /// 得到一个对象实体 /// </summary> public ZhongLi.Model.ServerUser_Message DataRowToModel(DataRow row) { ZhongLi.Model.ServerUser_Message model = new ZhongLi.Model.ServerUser_Message(); if (row != null) { if (row["SerMesID"] != null && row["SerMesID"].ToString() != "") { model.SerMesID = int.Parse(row["SerMesID"].ToString()); } if (row["SerUserID"] != null && row["SerUserID"].ToString() != "") { model.SerUserID = int.Parse(row["SerUserID"].ToString()); } if (row["MesType"] != null && row["MesType"].ToString() != "") { model.MesType = int.Parse(row["MesType"].ToString()); } if (row["DataID"] != null && row["DataID"].ToString() != "") { model.DataID = int.Parse(row["DataID"].ToString()); } if (row["MesCon"] != null) { model.MesCon = row["MesCon"].ToString(); } if (row["SendTime"] != null && row["SendTime"].ToString() != "") { model.SendTime = DateTime.Parse(row["SendTime"].ToString()); } if (row["IsRead"] != null && row["IsRead"].ToString() != "") { if ((row["IsRead"].ToString() == "1") || (row["IsRead"].ToString().ToLower() == "true")) { model.IsRead = true; } else { model.IsRead = false; } } if (row["ReadTime"] != null && row["ReadTime"].ToString() != "") { model.ReadTime = DateTime.Parse(row["ReadTime"].ToString()); } if (row["Colvalue"] != null) { model.Colvalue = row["Colvalue"].ToString(); } if (row["TargetID"] != null && row["TargetID"].ToString() != "") { model.TargetID = int.Parse(row["TargetID"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public ZhongLi.Model.ServerUser_Message GetModel(int SerMesID) { SqlParameter[] parameters = { new SqlParameter("@SerMesID", SqlDbType.Int, 4) }; parameters[0].Value = SerMesID; ZhongLi.Model.ServerUser_Message model = new ZhongLi.Model.ServerUser_Message(); DataSet ds = DbHelperSQL.RunProcedure("ServerUser_Message_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(ZhongLi.Model.ServerUser_Message model) { int rowsAffected = 0; SqlParameter[] parameters = { new SqlParameter("@SerMesID", SqlDbType.Int, 4), new SqlParameter("@SerUserID", SqlDbType.Int, 4), new SqlParameter("@MesType", SqlDbType.Int, 4), new SqlParameter("@DataID", SqlDbType.Int, 4), new SqlParameter("@MesCon", SqlDbType.NVarChar, 200), new SqlParameter("@SendTime", SqlDbType.DateTime), new SqlParameter("@IsRead", SqlDbType.Bit, 1), new SqlParameter("@ReadTime", SqlDbType.DateTime), new SqlParameter("@Colvalue", SqlDbType.NVarChar, 50), new SqlParameter("@TargetID", SqlDbType.Int, 4) }; parameters[0].Value = model.SerMesID; parameters[1].Value = model.SerUserID; parameters[2].Value = model.MesType; parameters[3].Value = model.DataID; parameters[4].Value = model.MesCon; parameters[5].Value = model.SendTime; parameters[6].Value = model.IsRead; parameters[7].Value = model.ReadTime; parameters[8].Value = model.Colvalue; parameters[9].Value = model.TargetID; DbHelperSQL.RunProcedure("ServerUser_Message_Update", parameters, out rowsAffected); if (rowsAffected > 0) { return(true); } else { return(false); } }