protected void rep_ItemCommand(object source, RepeaterCommandEventArgs e) { MessageSendBLL msb = new MessageSendBLL(); MessageReciveModel mrm = new MessageReciveModel(); //GridViewRow row = (GridViewRow)((Image)e.CommandSource).NamingContainer; int type = Convert.ToInt32(e.CommandArgument); if (msb.getReceive(type).ToString() == "*") { msg = "<Script language='javascript'>alert('" + GetTran("001000", "无删除权限") + "!');</script>"; } else { /*int i = msb.getMessageReciveInfo(type); * if (i > 0) * { * msg = "<Script language='javascript'>alert('信息删除成功!');</script>"; * }*/ if (new MessageReceiveBLL().DelMessageReceive(type, Session["Member"].ToString(), 2)) { ScriptHelper.SetAlert(Page, GetTran("000008", "删除成功") + "!!!"); } else { ScriptHelper.SetAlert(Page, GetTran("000008", "删除成功") + "!!!"); } } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { MessageSendBLL msb = new MessageSendBLL(); MessageReciveModel mrm = new MessageReciveModel(); GridViewRow row = (GridViewRow)((Image)e.CommandSource).NamingContainer; int type = Convert.ToInt32((row.FindControl("HidID") as Label).Text); int MessagesendId = 0; int i = 0; switch (e.CommandName.Trim()) { case "del": /*MessagesendId = msb.getmessageID(type); * * i = msb.delSend(type, MessagesendId); * if (i > 0) * { * msg = "<script language='javascript'>alert('信息删除成功!');</script>"; * }*/ if (MessageSendBLL.DelMessageSendById(type, Session["Member"].ToString(), 2)) { msg = "<script language='javascript'>alert('" + GetTran("000008", "删除成功") + "!');</script>"; } else { msg = "<script language='javascript'>alert('" + GetTran("000009", "删除失败") + "!');</script>"; } break; default: break; } }
public int getMessageReciveInfo(int type) { int n = 0; int i = 0; string LoginRole2; string Recive2; string InfoTitle2; string SenderRole2; string Sender2; string Senddate2; int DropFlag2; int ReadFlag2; int MessagesendId; string StrSql = "SELECT * FROM MessageReceive WHERE id=" + type + ""; SqlDataReader reader = DBHelper.ExecuteReader(StrSql); MessageReciveModel message = new MessageReciveModel(); if (reader.Read()) { message.Messagesendid = Convert.ToInt32(reader["Messagesendid"]); message.LoginRole = reader["LoginRole"].ToString(); message.Recive = reader["Receive"].ToString(); message.SenderRole = reader["SenderRole"].ToString(); message.Sender = reader["sender"].ToString(); message.Senddate = Convert.ToDateTime(reader["Senddate"]); message.InfoTitle = reader["InfoTitle"].ToString(); } reader.Close(); MessagesendId = Convert.ToInt32(message.Messagesendid.ToString()); LoginRole2 = message.LoginRole.ToString(); Recive2 = message.Recive.ToString(); InfoTitle2 = message.InfoTitle.ToString();; SenderRole2 = message.SenderRole.ToString();; Sender2 = message.Sender.ToString();; Senddate2 = message.Senddate.ToString();; DropFlag2 = Convert.ToInt32(message.DropFlag); ReadFlag2 = Convert.ToInt32(message.ReadFlag); string sqlstr_temple = @"insert into MessageDrop (MessagesendId,LoginRole,Receive,InfoTitle,SenderRole,Sender,Senddate,DropFlag,ReadFlag,tabel) values (" + MessagesendId + ",'" + LoginRole2 + "','" + Recive2 + "','" + InfoTitle2 + "','" + SenderRole2 + "','" + Sender2 + "','" + Senddate2 + "',1,1,2)"; n = DBHelper.ExecuteNonQuery(sqlstr_temple); if (n > 0) { i = DBHelper.ExecuteNonQuery("delete from MessageReceive WHERE id=" + type + " "); { if (i > 0) { return(i); } else { return(0); } } } else { return(0); } }
public static MessageReciveModel getMessageRecive(int id) { string sql = "Update MESSAGERECEIVE set ReadFlag=1 where id=" + id; DBHelper.ExecuteNonQuery(sql); SqlDataReader reader = DBHelper.ExecuteReader("select messagesendId,LoginRole,Receive,SenderRole,Sender,SendDate,InfoTitle from messagereceive where id=" + id); MessageReciveModel message = new MessageReciveModel(); if (reader.Read()) { message.Messagesendid = Convert.ToInt32(reader["Messagesendid"]); message.LoginRole = reader["LoginRole"].ToString(); message.Recive = reader["Receive"].ToString(); message.SenderRole = reader["SenderRole"].ToString(); message.Sender = reader["sender"].ToString(); message.Senddate = Convert.ToDateTime(reader["Senddate"]); message.InfoTitle = reader["InfoTitle"].ToString(); } reader.Close(); return(message); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { MessageSendBLL msb = new MessageSendBLL(); MessageReciveModel mrm = new MessageReciveModel(); GridViewRow row = (GridViewRow)((Image)e.CommandSource).NamingContainer; int type = Convert.ToInt32((row.FindControl("Label1") as Label).Text); switch (e.CommandName.Trim()) { case "del": if (msb.getReceive(type).ToString() == "*") { msg = "<Script language='javascript'>alert('" + GetTran("001000", "无删除权限") + "!');</script>"; } else { /*int i = msb.getMessageReciveInfo(type); * if (i > 0) * { * msg = "<Script language='javascript'>alert('信息删除成功!');</script>"; * }*/ if (new MessageReceiveBLL().DelMessageReceive(type, Session["Member"].ToString(), 2)) { ScriptHelper.SetAlert(Page, GetTran("000008", "删除成功") + "!!!"); } else { ScriptHelper.SetAlert(Page, GetTran("000008", "删除成功") + "!!!"); } } break; default: break; } GetShopList(ViewState["classid"].ToString()); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { MessageSendBLL msb = new MessageSendBLL(); MessageReciveModel mrm = new MessageReciveModel(); GridViewRow row = (GridViewRow)((Image)e.CommandSource).NamingContainer; int ID = Convert.ToInt32((row.FindControl("HidID") as Label).Text); int i = 0; switch (e.CommandName.Trim()) { case "del": i = msb.delMessageDrop(ID); if (i > 0) { msg = "<script language='javascript'>alert('" + GetTran("000008", "删除成功") + "!');</script>"; } break; default: break; } GetShopList(); }