public void SendEmail(BO.Order order) { BO.Person client = Conversions.CastingToBOPerson(dal.RecievePerson(order.GuestRequest.ClientID)); string EmailAddress = client.MailAddress; MailMessage email = new MailMessage(); email.To.Add(EmailAddress); email.From = new MailAddress("*****@*****.**"); email.Subject = "הזמנה"; email.IsBodyHtml = true; string htmlbody = File.ReadAllText("html1.txt", Encoding.UTF8); email.BodyEncoding = Encoding.Unicode; email.Body = string.Format(htmlbody, order.Key, order.HostingUnit.HostingUnitName, order.HostingUnit.ToString(), client.MailAddress, order.HostingUnit.ImageLink1, order.HostingUnit.ImageLink2, order.HostingUnit.ImageLink3); SmtpClient smtp = new SmtpClient(); smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "rede24@@"); smtp.EnableSsl = true; smtp.Host = "smtp.gmail.com"; try { smtp.Send(email); } catch (Exception exp) { throw exp; } }
/// <summary> /// add client to system /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void bt_GuestRegist_Click(object sender, RoutedEventArgs e) { BO.Person person = new BO.Person { FirstName = tbFirstName.Text, LastName = tbLastName.Text }; if (tbId.Text.Length == 0) { MessageBox.Show("אחד השדות או יותר חסרים:"); return; } if (tbId.Text.Length > 0) { person.Id = int.Parse(tbId.Text); } person.Password = tbPassword1.Password; person.Phone = tbPhone.Text; person.Status = BO.PersonStatus.ACTIVE; try { bl.GetPerson(person.Id); MessageBox.Show("המשתמש קיים במערכת "); ClearTextBox(); GuestLogBorder.Visibility = Visibility.Hidden; } catch (Exception) { bl.AddPerson(person); MessageBox.Show("נרשמת בהצלחה למערכת"); ClearTextBox(); GuestLogBorder.Visibility = Visibility.Hidden; } }
public static DO.Person Conv_BO_To_DO(BO.Person item) { DO.Person temp = new DO.Person(); temp.Id = item.Id; temp.Email = item.Email; temp.FirstName = item.FirstName; temp.LastName = item.LastName; temp.IdType = (DO.IdType)item.IdType; temp.Password = item.Password; temp.Phone = item.Phone; temp.Status = (DO.PersonStatus)item.Status; temp.Address = item.Address; return(temp); }
public static DO.Person CastingToDOPerson(BO.Person bPerson) { DO.Person person = new DO.Person(); person.Id = bPerson.Id; person.IdType = (DO.ID)bPerson.IdType; person.Status = (DO.Status)bPerson.Status; person.Password = bPerson.Password; person.FirstName = bPerson.FirstName; person.LastName = bPerson.LastName; person.PhoneNumber = bPerson.PhoneNumber; person.MailAddress = bPerson.MailAddress; person.UserType = bPerson.UserType; return(person); }
public static BO.Person CastingToBOPerson(DO.Person person) { BO.Person bPerson = new BO.Person(); bPerson.Id = person.Id; bPerson.IdType = (BO.ID)person.IdType; bPerson.Status = (BO.Status)person.Status; bPerson.Password = person.Password; bPerson.FirstName = person.FirstName; bPerson.LastName = person.LastName; bPerson.PhoneNumber = person.PhoneNumber; bPerson.MailAddress = person.MailAddress; bPerson.UserType = person.UserType; return(bPerson); }
public void UpdatePerson(BO.Person person) { dal.UpdatePerson(Conversions.CastingToDOPerson(person)); }
public void AddPerson(BO.Person person) { dal.AddPerson(Conversions.CastingToDOPerson(person)); }