private void PageBind(int id) { MessageSendModel message = MessageSendBLL.GetMessageSendById(id); this.txtBianhao.Text = message.Receive; this.content1.Value = message.Content; this.txtTitle.Text = message.InfoTitle; this.drop_LoginRole.SelectedValue = message.LoginRole; this.DropDownList1.Enabled = false; this.DropDownList2.Enabled = false; this.DropDownList1.SelectedValue = message.CountryCode; this.DropDownList2.SelectedValue = message.LanguageCode; //this.ChkLevel.Checked=(message.ConditionLevel != -1); this.ChkBonus.Checked = (message.ConditionBonusFrom != -1 && message.ConditionBonusTo != -1); this.ChkNet.Checked = (message.ConditionLeader != ""); this.BindDropLevel(); this.SetVisible(); //this.DropLevel.SelectedValue = message.ConditionLevel.ToString(); this.TxtBonusFrom.Text = message.ConditionBonusFrom.ToString(); this.TxtBonusTo.Text = message.ConditionBonusTo.ToString(); this.TxtLeader.Text = message.ConditionLeader.ToString(); this.DropRelation.SelectedValue = message.ConditionRelation.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 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; } }
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", "删除成功") + "!!!"); } } }
private void PageBind(int id) { MessageSendModel message = MessageSendBLL.GetMessageSendById(id); this.txtBianhao.Text = message.Receive; this.TextBox1.Text = message.Content; this.txtTitle.Text = message.InfoTitle; this.drop_LoginRole.SelectedItem.Value = message.LoginRole; this.DropDownList1.Enabled = false; this.DropDownList2.Enabled = false; this.DropDownList1.SelectedValue = message.CountryCode; this.DropDownList2.SelectedValue = message.LanguageCode; }
protected void givShowMessage_RowCommand(object sender, GridViewCommandEventArgs e) { string name = e.CommandName; int id = Convert.ToInt32(e.CommandArgument); if ("Del" == name) { if (MessageSendBLL.DelMessageDropbyID(id)) { ScriptHelper.SetAlert(Page, GetTran("000008", "删除成功") + "!!!"); //Pager page = Page.FindControl("Pager1") as Pager; //page.PageBind(0, 10, "MessageDrop", "ID,InfoTitle,LoginRole,Receive,Sender,Senddate", ViewState["where"].ToString(), "ID", "givShowMessage"); btnSeach_Click(null, null); } } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ///控制样式 e.Row.Attributes.Add("onmouseover", "bg=this.style.backgroundColor;this.style.backgroundColor='#FFFFCC'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=bg"); TableCell cc = (TableCell)e.Row.Controls[1]; if (cc.Text == "*") { cc.Text = "全体成员"; } if (cc.Text.IndexOf(",") > 0) { cc.Text = Session["Member"].ToString(); } Image LButton = (Image)e.Row.FindControl("Linkbutton2"); MessageSendBLL msb = new MessageSendBLL(); Label Hid = (Label)e.Row.FindControl("Label1"); Label lbyuedu = (Label)e.Row.FindControl("lbyuedu"); lbyuedu.Text = GetTran("000919", "未阅读"); if (msb.getReceive(int.Parse(Hid.Text)).ToString() == "*") { LButton.ImageUrl = "images/view-button3-.png"; LButton.Enabled = false; } else { LButton.Attributes.Add("onClick", "return confirm('" + GetTran("000995", "你确定要删除该条信息吗") + "?');"); LButton.ImageUrl = "images/view-button3.png"; } int isyuedu = msb.getReadType(Hid.Text.ToString()); if (isyuedu == 1) { lbyuedu.Text = GetTran("000994", "已阅读"); lbyuedu.Enabled = false; } } if (e.Row.RowType == DataControlRowType.Header) { Translations_More(); } }
protected void givShowMessage_RowCommand(object sender, GridViewCommandEventArgs e) { string name = e.CommandName; int id = Convert.ToInt32(e.CommandArgument); if (name == "Del") { if (MessageSendBLL.DelMessageSendById(id, Session["Company"].ToString(), 0)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("000008", "删除成功") + "!')</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("000009", "删除失败") + "!')</script>"); } } Pager page = Page.FindControl("Pager1") as Pager; string sb = ViewState["sb"].ToString(); page.PageBind(0, 10, "MessageSend", "ID,InfoTitle,LoginRole,Receive,Sender,Senddate", sb, "ID", "givShowMessage"); }
//发送系统邮件 public static bool SendSystemEmail(string sendnumber, string sendrole, string content, string recivenumber) { MessageSendModel messagesend = new MessageSendModel(); //邮件保存 messagesend.Content = content; messagesend.DropFlag = 0; messagesend.InfoTitle = "系统邮件"; messagesend.LoginRole = "2"; messagesend.ReadFlag = 0; messagesend.Sender = sendnumber; messagesend.SenderRole = "2"; messagesend.LanguageCode = "L001"; messagesend.CountryCode = "1"; messagesend.MessageType = 'm'; messagesend.Receive = recivenumber; messagesend.SetNoCondition(); bool bb = MessageSendBLL.Addsendaffiche(messagesend); HttpContext.Current.Session["EmailCount"] = AjaxClass.GetNewEmailCount( ); return(bb); }
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(); }
protected void btn_Save_Click(object sender, EventArgs e) { #region 验证用户输入 if (txtBianhao.Text.Trim() == "") { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(\"" + GetTran("001607", "请输入收件人编号") + "!!!\");</script>"); return; } if (txtTitle.Text.Trim() == "") { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001609", "请输入标题") + "!!!');</script>"); Literal1.Text = ""; return; } if (this.content1.Value.Trim().Length.Equals(0)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "请输入公告内容") + "!!!');</script>"); return; } if (this.content1.Value.Trim().Length > 4000) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("000863", "您输入的信息过长") + "!!!');</script>"); return; } double from = 0; double to = 0; if (this.ChkBonus.Checked) { if (string.IsNullOrEmpty(this.TxtBonusFrom.Text.Trim())) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(' 起始奖金不能为空!');</script>"); return; } if (string.IsNullOrEmpty(this.TxtBonusTo.Text.Trim())) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(' 未尾奖金不能为空!');</script>"); return; } try { from = Convert.ToDouble(this.TxtBonusFrom.Text.Trim()); to = Convert.ToDouble(this.TxtBonusTo.Text.Trim()); if (from <= 0) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(' 起始奖金不能为负数!');</script>"); return; } if (from <= 0) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(' 未尾奖金不能负数!');</script>"); return; } } catch { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "您输入的奖金区间无效") + "!!!');</script>"); return; } if (from >= to) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "您输入的奖金区间无效") + "!!!');</script>"); return; } } if (this.drop_LoginRole.SelectedValue.Equals("2") && this.ChkNet.Checked) { if (this.TxtLeader.Text.Trim().Length.Equals(0)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "请指定团队领导人编号") + "!!!');</script>"); return; } else { if (!MessageSendBLL.CheckNumber(2, this.TxtLeader.Text.Trim())) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "指定的团队领导人不存在") + "!!!');</script>"); return; } } } #endregion StringBuilder sb = new StringBuilder(); if (Request["Id"] != null) { int id = Convert.ToInt32(Request["Id"]); ChangeLogs cl = new ChangeLogs("MessageSend", "ltrim(rtrim(id))"); cl.AddRecord(id); ChangeLogs clsend = new ChangeLogs("MessageReceive", "ltrim(rtrim(messagesendid))"); clsend.AddRecord(id); BLL.other.Company.MessageReceiveBLL bll = new MessageReceiveBLL(); bll.delGongGao(id); cl.ModifiedIntoLogs(ChangeCategory.company19, Session["Company"].ToString(), ENUM_USERTYPE.objecttype10); clsend.ModifiedIntoLogs(ChangeCategory.company19, Session["Company"].ToString(), ENUM_USERTYPE.objecttype10); this.btn_Save.Text = GetTran("000259", "修改"); sb.Append(GetTran("001621", "公告修改")); } else { sb.Append(GetTran("001620", "公告发布")); } MessageSendModel messagesend = new MessageSendModel(); //messagesend.Content = TextBox1.Text.Trim(); messagesend.Content = this.content1.Value.Trim(); messagesend.DropFlag = 0; messagesend.InfoTitle = txtTitle.Text.Trim().Replace("<", "<").Replace(">", ">"); messagesend.LoginRole = drop_LoginRole.SelectedItem.Value; messagesend.ReadFlag = 0; messagesend.Sender = Session["Company"].ToString(); messagesend.SenderRole = "0"; messagesend.Receive = "*"; messagesend.CountryCode = this.DropDownList1.SelectedValue; messagesend.LanguageCode = this.DropDownList2.SelectedValue; //if (this.ChkLevel.Checked) //{ // messagesend.ConditionLevel = Convert.ToInt16(this.DropLevel.SelectedValue); //} //else //{ // messagesend.ConditionLevel = -1; //} if (this.ChkBonus.Checked) { messagesend.ConditionBonusFrom = Convert.ToDouble(this.TxtBonusFrom.Text.Trim()); messagesend.ConditionBonusTo = Convert.ToDouble(this.TxtBonusTo.Text.Trim()); } else { messagesend.ConditionBonusFrom = -1; messagesend.ConditionBonusTo = -1; } if (this.ChkNet.Checked) { messagesend.ConditionRelation = Convert.ToChar(this.DropRelation.SelectedValue); messagesend.ConditionLeader = this.TxtLeader.Text.Trim(); } else { messagesend.ConditionLeader = ""; messagesend.ConditionRelation = '0'; } messagesend.Qishu = CommonDataDAL.getMaxqishu(); messagesend.MessageType = 'a'; if (MessageSendBLL.Addsendaffiche(messagesend)) { BLL.other.Company.MessageReceiveBLL bll = new MessageReceiveBLL(); if (this.drop_LoginRole.SelectedValue == "1") { bll.UpdateStore(); } else if (this.drop_LoginRole.SelectedValue == "2") { bll.UpdateMember(); } sb.Append(GetTran("001600", "成功") + "!!!"); ScriptHelper.SetAlert(Page, sb.ToString()); } else { sb.Append(GetTran("001618", "失败")); ScriptHelper.SetAlert(Page, sb.ToString()); } txtTitle.Text = ""; TextBox1.Text = ""; content1.Value = ""; }
protected void btn_Save_Click(object sender, EventArgs e) { #region 验证用户输入 if (Request["type"] != "huifu" && txtBianhao.Text.Trim() == "" && this.RadioBianhao.Checked) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert(\"" + GetTran("001607", "请输入收件人编号") + "!!!\");</script>"); return; } if (txtTitle.Text.Trim() == "") { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001609", "请输入标题") + "!!!');</script>"); Literal1.Text = ""; return; } if (this.content1.Value.Trim().Length.Equals(0)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "请输入邮件内容") + "!!!');</script>"); return; } if (this.content1.Value.Trim().Length > 4000) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("000863", "您输入的信息过长") + "!!!');</script>"); return; } double from = 0; double to = 0; if (this.RadioRange.Checked && this.ChkBonus.Checked) { try { from = Convert.ToDouble(this.TxtBonusFrom.Text.Trim()); to = Convert.ToDouble(this.TxtBonusTo.Text.Trim()); } catch { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "您输入的奖金区间无效") + "!!!');</script>"); return; } if (from >= to) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "您输入的奖金区间无效") + "!!!');</script>"); return; } } if (this.drop_LoginRole.SelectedValue.Equals("2") && this.RadioRange.Checked && this.ChkNet.Checked) { if (this.TxtLeader.Text.Trim().Length.Equals(0)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "请指定团队首领编号") + "!!!');</script>"); return; } else { if (!MessageSendBLL.CheckNumber(2, this.TxtLeader.Text.Trim())) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("kwl", "指定的团队首领不存在") + "!!!');</script>"); return; } } } #endregion StringBuilder sb = new StringBuilder(); //if (Request["type"] != null) //{ if (Request["type"] == "huifu") { MessageSendModel messagesend = new MessageSendModel(); //邮件保存 messagesend.Content = this.content1.Value.Trim(); messagesend.DropFlag = 0; messagesend.InfoTitle = txtTitle.Text.Trim().Replace("<", "<").Replace(">", ">"); messagesend.LoginRole = drop_LoginRole.SelectedItem.Value; messagesend.ReadFlag = 0; messagesend.Sender = Session["Company"].ToString(); messagesend.SenderRole = "0"; messagesend.LanguageCode = this.DropDownList2.SelectedValue; messagesend.CountryCode = this.DropDownList1.SelectedValue; messagesend.MessageType = 'm'; messagesend.SetNoCondition(); int hfid; try { hfid = Convert.ToInt32(Request["hfid"]); if (hfid < 0) { return; } } catch (Exception) { return; } messagesend.ReplyFor = hfid; System.Data.SqlClient.SqlDataReader dr = DAL.DBHelper.ExecuteReader("select Sender,ClassID from MessageReceive where ID=@id", new System.Data.SqlClient.SqlParameter("@id", hfid), CommandType.Text); if (dr.Read()) { messagesend.Receive = dr["Sender"].ToString(); messagesend.MessageClassID = Convert.ToInt32(dr["ClassID"]); } else { ScriptHelper.SetAlert(Page, GetTran("001589", "对不起发件人不存在") + "!!!"); return; } if (MessageSendBLL.Addsendaffiche(messagesend)) { string href = "ManageMessage_Recive.aspx" + (Request["ClassID"] == null ? "" : "?ClassID=" + Request["ClassID"]); ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("001587", "邮件回复成功") + "!!!');location.href='" + href + "';</script>"); } else { ScriptHelper.SetAlert(Page, GetTran("001588", "邮件回复失败") + "!!!"); } } else//信息 { if (Request["Id"] != null) { int id = Convert.ToInt32(Request["Id"]); //还没改 MessageSendBLL.DelMessageSendById(id); sb.Append(GetTran("001590", "邮件修改")); } else { Response.Cache.SetExpires(DateTime.Now); Permissions.CheckManagePermission(EnumCompanyPermission.ManageMessage); sb.Append(GetTran("001592", "邮件发送")); } MessageSendModel messagesend = new MessageSendModel(); //邮件保存 messagesend.Content = this.content1.Value.Trim(); messagesend.DropFlag = 0; messagesend.InfoTitle = txtTitle.Text.Trim().Replace("<", "<").Replace(">", ">"); messagesend.LoginRole = drop_LoginRole.SelectedItem.Value; messagesend.ReadFlag = 0; messagesend.Sender = Session["Company"].ToString(); messagesend.SenderRole = "0"; messagesend.LanguageCode = this.DropDownList2.SelectedValue; messagesend.CountryCode = this.DropDownList1.SelectedValue; messagesend.Qishu = CommonDataDAL.getMaxqishu(); messagesend.MessageType = 'm'; messagesend.SetNoCondition(); if (this.RadioBianhao.Checked) //指定了编号 { if (txtBianhao.Text.Trim().Length > 0) { if (!txtBianhao.Text.Trim().Equals("*")) { //验证编号是否存在 string[] strArray = txtBianhao.Text.Trim().Split(new char[] { ',' }); foreach (string strNO in strArray) { if (strNO != "") { int id = Convert.ToInt32(drop_LoginRole.SelectedValue); //验证编号是否存在 if (!MessageSendBLL.CheckNumber(id, strNO)) { Response.Write("<script>alert('" + strNO + GetTran("001584", "不存在") + "');</script>"); return; } } } } } else { ScriptHelper.SetAlert(Page, GetTran("001594", "请输入收件人") + "!!!"); return; } messagesend.Receive = DisposeString.DisString(txtBianhao.Text.Trim()); } else //指定了Range { messagesend.Receive = "*"; //if (this.ChkLevel.Checked) //{ // messagesend.ConditionLevel = Convert.ToInt16(this.DropLevel.SelectedValue); //} if (this.ChkBonus.Checked) { messagesend.ConditionBonusFrom = Convert.ToDouble(this.TxtBonusFrom.Text.Trim()); messagesend.ConditionBonusTo = Convert.ToDouble(this.TxtBonusTo.Text.Trim()); } if (this.ChkNet.Checked) { messagesend.ConditionRelation = Convert.ToChar(this.DropRelation.SelectedValue); messagesend.ConditionLeader = this.TxtLeader.Text.Trim(); } } if (MessageSendBLL.Addsendaffiche(messagesend)) { sb.Append(GetTran("001600", "成功") + "!!!"); ScriptHelper.SetAlert(Page, sb.ToString()); } else { sb.Append(GetTran("001541", "失败") + "!!!"); ScriptHelper.SetAlert(Page, sb.ToString()); } } this.txtTitle.Text = ""; this.TextBox1.Text = ""; this.content1.Value = ""; }
protected void btnSave_Click(object sender, EventArgs e) { MessageSendBLL msb = new MessageSendBLL(); if (this.txtNumber.SelectedItem.Text.Trim() == "") { msg = "<Script language='javascript'>alert('" + GetTran("000848", "对不起,编号不能为空") + "!');</Script>"; ClientScript.RegisterStartupScript(this.GetType(), "", msg); return; } string sqlStr = ""; switch (drop_LoginRole.SelectedValue) { case "0": sqlStr = "Select count(0) From Manage where Number='" + this.txtNumber.SelectedValue.Trim() + "'"; break; case "1": sqlStr = "Select count(0) From MemberInfo where Number='" + this.txtNumber.SelectedValue.Trim() + "'"; break; case "2": sqlStr = "Select count(0) From StoreInfo where storeid='" + this.txtNumber.SelectedValue.Trim() + "'"; break; } if (msb.check(sqlStr) != 1) { msg = "<Script language='javascript'>alert('" + GetTran("000850", "对不起") + "," + drop_LoginRole.SelectedItem.Text + "" + GetTran("000854", "的编号错误") + "!');</Script>"; ClientScript.RegisterStartupScript(this.GetType(), "", msg); return; } //if (this.RadioListClass.SelectedValue.Equals("")) //{ // msg = "<script language='javascript'>alert('" + GetTran("007712", "请选择邮件分类") + "!!!');</script>"; // ClientScript.RegisterStartupScript(this.GetType(), "", msg); // return; //} if (this.txtTitle.Text.Trim() == "") { msg = "<Script language='javascript'>alert('" + GetTran("000859", "对不起,标题信息不能为空") + "!');</Script>"; ClientScript.RegisterStartupScript(this.GetType(), "", msg); return; } if (this.content1.Text.Trim().Length.Equals(0)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("007399", "请输入邮件内容") + "!!!');</script>"); return; } if (this.content1.Text.Trim().Length > 400) { msg = "<script language='javascript'>alert('" + GetTran("000863", "您输入的信息过长") + "!!!');</script>"; ClientScript.RegisterStartupScript(this.GetType(), "", msg); return; } //if (uppic.FileName!=null) //{ // string fullFileName = uppic.PostedFile.FileName; // //string fileName = fullFileName.Substring(fullFileName.LastIndexOf("\\") + 1);//图片名称 // string type = fullFileName.Substring(fullFileName.LastIndexOf(".") + 1).ToLower(); // if (type == "jpg" || type == "gif" || type == "bmp" || type == "png" || type == "jpeg") // { // HttpPostedFile upFile = uppic.PostedFile;//HttpPostedFile对象,用来读取上传图片的属性 // int fileLength = upFile.ContentLength;//记录文件的长度 // byte[] fileBytePicture = new byte[fileLength];//用图片的长度来初始化一个字节数组存储临时的图片文件 // Stream fileStream = upFile.InputStream;//建立文件流对象 // fileStream.Read(fileBytePicture, 0, fileLength); // //Insert into db, picture字段,image类型 // //在此要注意,SQL语句中插入DB不能像varchar()类型,用单引号引起来,这样的话会报错,要使用参数自行插入,eg: // //cmd.CommandText = @"INSERT INTO Category(Category,Picture)VALUES(@Category,@Picture)"; // //cmd.Parameters.AddWithValue("@Category", category);//string category //cmd.Parameters.AddWithValue("@Picture", picture);// byte[] picture // } //string filepath = uppic.PostedFile.FileName; //得到的是文件的完整路径,包括文件名,如:C:\Documents and Settings\Administrator\My Documents\My Pictures\20022775_m.jpg ////string filepath = FileUpload1.FileName; //得到上传的文件名20022775_m.jpg //string filename = filepath.Substring(filepath.LastIndexOf("\\") + 1);//20022775_m.jpg //serverpath = Server.MapPath("~/MemberMobile/images/") + filename;//取得文件在服务器上保存的位置C:\Inetpub\wwwroot\WebSite1\images\20022775_m.jpg //uppic.PostedFile.SaveAs(serverpath);//将上传的文件另存为 //} DateTime date = DateTime.Now; MessageSendModel msm = new MessageSendModel(); ///表示会员 msm.LoginRole = "0"; msm.Receive = BLL.CommonClass.CommonDataBLL.getManageID(1); msm.InfoTitle = this.txtTitle.Text.ToString().Replace("<", "<").Replace(">", ">"); msm.Content = this.content1.Text.Trim(); msm.Sender = Session["Member"].ToString(); msm.Senddate = date; msm.SenderRole = "2"; msm.MessageClassID = 0; msm.MessageType = 'm'; int i = 0; i = msb.MemberSendToManage(msm); if (i > 0) { msg = "<Script language='javascript'>alert('" + GetTran("007400", "邮件发送成功") + "!');</script>"; } else { msg = "<Script language='javascript'>alert('" + GetTran("007401", "邮件发送失败") + "!');</script>"; } ClientScript.RegisterStartupScript(this.GetType(), "", msg); btnCancle_Click(null, null); }
protected void btnSave_Click(object sender, EventArgs e) { MessageSendBLL msb = new MessageSendBLL(); if (this.txtNumber.SelectedItem.Text.Trim() == "") { msg = "<Script language='javascript'>alert('" + GetTran("000848", "对不起,编号不能为空") + "!');</Script>"; ClientScript.RegisterStartupScript(this.GetType(), "", msg); return; } string sqlStr = ""; switch (drop_LoginRole.SelectedValue) { case "0": sqlStr = "Select count(0) From Manage where Number='" + this.txtNumber.SelectedValue.Trim() + "'"; break; case "1": sqlStr = "Select count(0) From MemberInfo where Number='" + this.txtNumber.SelectedValue.Trim() + "'"; break; case "2": sqlStr = "Select count(0) From StoreInfo where storeid='" + this.txtNumber.SelectedValue.Trim() + "'"; break; } if (msb.check(sqlStr) != 1) { msg = "<Script language='javascript'>alert('" + GetTran("000850", "对不起") + "," + drop_LoginRole.SelectedItem.Text + "" + GetTran("000854", "的编号错误") + "!');</Script>"; ClientScript.RegisterStartupScript(this.GetType(), "", msg); return; } if (this.RadioListClass.SelectedValue.Equals("")) { msg = "<script language='javascript'>alert('" + GetTran("007712", "请选择邮件分类") + "!!!');</script>"; ClientScript.RegisterStartupScript(this.GetType(), "", msg); return; } if (this.txtTitle.Text.Trim() == "") { msg = "<Script language='javascript'>alert('" + GetTran("000859", "对不起,标题信息不能为空") + "!');</Script>"; ClientScript.RegisterStartupScript(this.GetType(), "", msg); return; } if (this.content1.Value.Trim().Length.Equals(0)) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + GetTran("007399", "请输入邮件内容") + "!!!');</script>"); return; } if (this.content1.Value.Trim().Length > 4000) { msg = "<script language='javascript'>alert('" + GetTran("000863", "您输入的信息过长") + "!!!');</script>"; ClientScript.RegisterStartupScript(this.GetType(), "", msg); return; } DateTime date = DateTime.Now; MessageSendModel msm = new MessageSendModel(); ///表示会员 msm.LoginRole = "0"; msm.Receive = BLL.CommonClass.CommonDataBLL.getManageID(1); msm.InfoTitle = this.txtTitle.Text.ToString().Replace("<", "<").Replace(">", ">"); msm.Content = this.content1.Value.Trim(); msm.Sender = Session["Member"].ToString(); msm.Senddate = date; msm.SenderRole = "2"; msm.MessageClassID = Convert.ToInt16(this.RadioListClass.SelectedValue); msm.MessageType = 'm'; int i = 0; i = msb.MemberSendToManage(msm); if (i > 0) { msg = "<Script language='javascript'>alert('" + GetTran("007400", "邮件发送成功") + "!');</script>"; } else { msg = "<Script language='javascript'>alert('" + GetTran("007401", "邮件发送失败") + "!');</script>"; } ClientScript.RegisterStartupScript(this.GetType(), "", msg); btnCancle_Click(null, null); }