private void repositoryItemHyperLinkEdit1_Click(object sender, EventArgs e) { if (this.bindingSource1.Current != null) { Model.Information mode = this.bindingSource1.Current as Model.Information; try { string sql = "insert into InformationState values(NEWID(),GETDATE(),'" + BL.V.ActiveOperator.EmployeeId + "','" + mode.InformationId + "',1)"; BL.V.BeginTransaction(); this.informationStateManager.UpdateSql(sql); BL.V.CommitTransaction(); } catch (Exception ex) { BL.V.RollbackTransaction(); MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK); return; } } this.informationList = informationManager.SelectByEmployee(BL.V.ActiveOperator.EmployeeId, this.invoiceType); this.bindingSource1.DataSource = this.informationList; int a = this.bindingSource1.Position; this.gridView1.MoveFirst(); this.gridView1.FocusedRowHandle = a; }
/// <summary> /// Update a Information. /// </summary> public void Update(Model.Information information) { // // todo: add other logic here. // accessor.Update(information); }
/// <summary> /// Insert a Information. /// </summary> public void Insert(Model.Information information) { // // todo:add other logic here // accessor.Insert(information); }
/// <summary> /// 邮箱验证码发送 /// </summary> /// <param name="email">邮箱</param> /// <param name="context">由ashx传过来保存验证码的值</param> /// <returns></returns> public bool SendCode(string email, string number) { modelInformation = bll.ExGetModel("21b95a0f90138767b0fd324e6be3457b"); string[] SpiltEmail = email.Split('@'); try { MailMessage mailMsg = new MailMessage(); //两个类,别混了,要引入System.Net这个Assembly mailMsg.From = new MailAddress(modelInformation.FromAccton + modelInformation.EailSuffix); //源邮件地址 mailMsg.To.Add(new MailAddress(email)); //目的邮件地址。可以有多个收件人 mailMsg.Subject = "系统提示!!!"; //发送邮件的标题 mailMsg.SubjectEncoding = Encoding.UTF8; StringBuilder sb = new StringBuilder(); sb.Append("二十分钟会失效,请尽快使用"); sb.Append("验证码:" + number); mailMsg.Body = sb.ToString(); //发送邮件的内容 mailMsg.BodyEncoding = Encoding.UTF8; mailMsg.IsBodyHtml = false; //是否发送网页到邮箱 mailMsg.Priority = MailPriority.High; SmtpClient client = new SmtpClient(); client.Host = "smtp." + SpiltEmail[1]; //smtp.163.com,smtp.qq.com,smpt.126.com client.Port = 587; client.Credentials = new NetworkCredential(modelInformation.FromAccton, modelInformation.Credentials); //特别注意qq密码需要到邮箱中去账户中去弄授权码 client.DeliveryMethod = SmtpDeliveryMethod.Network; //设置优先级 client.EnableSsl = true; //是否安全传输 client.Send(mailMsg); return(true); } catch (Exception) { return(false); } }
public void Update(Model.Information e) { this.Update<Model.Information>(e); }
public void Insert(Model.Information e) { this.Insert<Model.Information>(e); }