public static string ComposeMailSignature(EmailClient mailSettings) { return(ComposeMailSignature(mailSettings.AddSignature)); }
protected void btnComing_Click(object sender, EventArgs e) { string eventID = Request.QueryString["ev"]; int G_ID = Convert.ToInt32(Session["ID"]); EventServiceClient event_client = new EventServiceClient(); //Update event RSVP table bool isRecorded = event_client.RecordRSVP(eventID, Convert.ToString(G_ID), "Confirmed"); //Retreive event info EventModel newEvent = new EventModel(); EventModel updatedEvent = new EventModel(); newEvent = event_client.findByEventID(eventID); string ticket_Type = Convert.ToString(Session["TYPE"]); //Create BarCode TicketServiceClient tsc = new TicketServiceClient(); EventTicket ticket = new EventTicket(); if (ticket_Type.ToLower().Contains("early bird") && newEvent.EB_Quantity > 0) { ticket = tsc.getEBTicket(Convert.ToString(eventID)); newEvent.EB_Quantity = newEvent.EB_Quantity - 1; updatedEvent = event_client.updateEvent(newEvent, eventID); } else if (ticket_Type.ToLower().Contains("regular") && newEvent.Reg_Quantity > 0) { ticket = tsc.getRegularTicket(Convert.ToString(eventID)); newEvent.Reg_Quantity = newEvent.Reg_Quantity - 1; updatedEvent = event_client.updateEvent(newEvent, eventID); } else if (ticket_Type.ToLower().Contains("vip") && newEvent.VIP_Quantity > 0) { ticket = tsc.getVIPTicket(Convert.ToString(eventID)); newEvent.VIP_Quantity = newEvent.VIP_Quantity - 1; updatedEvent = event_client.updateEvent(newEvent, eventID); } else if (ticket_Type.ToLower().Contains("vvip") && newEvent.VVIP_Quantity > 0) { ticket = tsc.getVVIPTicket(Convert.ToString(eventID)); newEvent.VVIP_Quantity = newEvent.VVIP_Quantity - 1; updatedEvent = event_client.updateEvent(newEvent, eventID); } //Check if tickets sstill available if (ticket != null) { //Purchase ticket ticket._GuestID = G_ID; int ticketID = tsc.PurchaseTicket(ticket); if (ticketID != 0) //successfull transaction { QRCodeImage img = new QRCodeImage(); img = GenerateCode(ticket, 1, Convert.ToString(G_ID), ticketID, eventID); //Send Barcode to guest EmailClient emails = new EmailClient(); //Find guest details string Name = Convert.ToString(Session["Name"]); string Surname = Convert.ToString(Session["Surname"]); string Email = Convert.ToString(Session["Email"]); emails.sendMsg_TicketPurchased(Name, Email, newEvent, img, ticket); Response.Redirect("EventDetails.aspx?ev=" + eventID); } } }
private void RegisterControlsEvents() { passTextBox.TextChanged += (sender, args) => capsLockAlertLabel.Text = IsKeyLocked(Keys.CapsLock) ? "The Caps Lock Key is ON!" : string.Empty; messagesListView.Click += (sender, args) => { int selectedIndex = ((ListView)sender).SelectedItems[0].Index; MessageDTO dto = _messageDTOs[selectedIndex]; pop3FromTextBox.Text = dto.FromEmail; pop3SenderFullNameTextBox.Text = dto.SenderInfoFullName; pop3SubjectTextBox.Text = dto.Subject; pop3BodyRichTextBox.Text = dto.BodyPlainText; }; deleteEmailButton.Click += (sender, args) => { Task.Run(() => { var mailAgentClient = new EmailClient(pop3LoginTextBox.Text, pop3PassTextBox.Text); string messageUID = default(string); if (messagesListView.InvokeRequired) { messagesListView.Invoke((MethodInvoker)(() => { if (messagesListView.Items.Count == 0) { return; } messageUID = messagesListView .Items[messagesListView.SelectedIndices[0]] .SubItems[2] .Text; })); } else { if (messagesListView.Items.Count == 0) { return; } messageUID = messagesListView .Items[messagesListView.SelectedIndices[0]] .SubItems[2] .Text; } mailAgentClient.DeleteMessageById(messageUID); if (messagesListView.Items.Count > 0) { messagesListView.Items.RemoveAt(messagesListView.SelectedIndices[0]); } }); }; attachImageButton.Click += (sender, args) => { using (OpenFileDialog openFileDialog = new OpenFileDialog()) { openFileDialog.Filter = Resources.ImageExtensionsFilter; _imagePath = openFileDialog.ShowDialog() == DialogResult.OK ? openFileDialog.FileName : string.Empty; } }; sendButton.Click += (sender, args) => { MessageDomainModel messageModel = new MessageDomainModel { FromEmail = fromTextBox.Text, ToEmail = toTextBox.Text, Subject = subjectTextBox.Text, BodyHtmlText = containsHtmlCheckBox.Checked ? bodyRichTextBox.Text : string.Empty, BodyPlainText = containsHtmlCheckBox.Checked ? Uglify.HtmlToText(bodyRichTextBox.Text).Code : bodyRichTextBox.Text, SenderInfoFullName = senderFullNameTextBox.Text, RecipientInfoFullName = recipientFullNameTextBox.Text, ImagePath = _imagePath }; _imagePath = default(string); var mailAgentClient = new EmailClient(loginTextBox.Text, passTextBox.Text); try { Task.Run(() => mailAgentClient.Send(messageModel)); } catch (Exception e) { Debug.WriteLine(e); MessageBox.Show("Some errors occurred while sending your message. Sorry about that."); } }; authenticationButton.Click += (sender, args) => { Task.Run(() => { var mailAgentClient = new EmailClient(pop3LoginTextBox.Text, pop3PassTextBox.Text); _messageDTOs = mailAgentClient.GetAllMessages(); if (messagesListView.InvokeRequired) { messagesListView.Invoke((MethodInvoker)(() => { messagesListView.BeginUpdate(); messagesListView.Items.Clear(); for (int i = 0; i < _messageDTOs.Count; i++) { var item = new ListViewItem($"{i + 1}"); item.SubItems.Add(_messageDTOs[i].Subject); item.SubItems.Add(_messageDTOs[i].Id); messagesListView.Items.Add(item); } messagesListView.EndUpdate(); })); } else { messagesListView.BeginUpdate(); messagesListView.Items.Clear(); for (int i = 0; i < _messageDTOs.Count; i++) { var item = new ListViewItem($"{i + 1}"); item.SubItems.Add(_messageDTOs[i].Subject); item.SubItems.Add(_messageDTOs[i].Id); messagesListView.Items.Add(item); } messagesListView.EndUpdate(); } }); }; viewAttachmentButton.Click += (sender, args) => { Task.Run(() => { var mailAgentClient = new EmailClient(pop3LoginTextBox.Text, pop3PassTextBox.Text); int selectedIndex = default(int); string messageUID = default(string); if (messagesListView.InvokeRequired) { messagesListView.Invoke((MethodInvoker)(() => { selectedIndex = messagesListView.SelectedItems[0].Index; messageUID = messagesListView .Items[selectedIndex] .SubItems[2] .Text; })); } else { selectedIndex = messagesListView.SelectedItems[0].Index; messageUID = messagesListView .Items[selectedIndex] .SubItems[2] .Text; } try { string imagePath = mailAgentClient.GetImageAttachmentByMessageUID(messageUID); Process.Start(imagePath); } catch (Exception) { MessageBox.Show("There is no attachment"); } }); }; }
/// <summary> /// 通知 /// </summary> /// <param name="dbContext">数据库上下文</param> /// <param name="meeting">会议</param> /// <param name="type">通知类型</param> private void Notify(MissionskyOAEntities dbContext, MeetingCalendarModel meeting, MeetingNotificationType type) { if (dbContext == null || meeting == null || type == MeetingNotificationType.None) { Log.Error(string.Format("会议通知失败, 通知类型: {0}。", type)); throw new InvalidOperationException(string.Format("会议通知失败, 通知类型: {0}。", type)); } //参会者 IList <string> participants = new List <string>(); dbContext.MeetingParticipants.Where(it => it.MeetingCalendarId == meeting.Id).ToList().ForEach(it => { participants.Add(it.User.Email); //参会者 var model = new NotificationModel() { Target = it.User.Email, CreatedUserId = 0, //MessageType = NotificationType.PushMessage, MessageType = NotificationType.Email, Title = "会议开始结束通知", MessagePrams = "test", Scope = NotificationScope.User, CreatedTime = DateTime.Now, TargetUserIds = new List <int> { it.User.Id } }; if (type == MeetingNotificationType.StartNotification) { var startDate = Convert.ToDateTime(meeting.StartDate.ToShortDateString() + " " + meeting.StartTime.ToString()); model.BusinessType = BusinessType.NotifyMeetingStart; model.MessageContent = string.Format("由{0}主持的会议{1}将于{2}开始。", meeting.Host, meeting.Title, startDate); } else { var endDate = Convert.ToDateTime(meeting.EndDate.ToShortDateString() + " " + meeting.EndTime.ToString()); model.BusinessType = BusinessType.NotifyMeetingEnd; model.MessageContent = string.Format("由{0}主持的会议{1}将于{2}结束。", meeting.Host, meeting.Title, endDate); } NotificationService.Add(model, Global.IsProduction); //消息推送 }); //添加通知历史 NotificationHistory.Add(new MeetingNotificationModel() { Meeting = meeting.Id, NotifiedTime = DateTime.Now, Type = type }); #region 发送邮件 //会议纪要连接 string meetingSummaryURL = string.Format(Global.MeetingSummaryURL, meeting.Id); //邮件内容 string title = (type == MeetingNotificationType.StartNotification ? "[OA]会议开始通知" : "[OA]会议结束通知"); string body = string.Format("会议主题:{0}\r\n会议议程:{1}\r\n会议纪要:{2}", meeting.Title, meeting.MeetingContext, meetingSummaryURL); EmailClient.Send(participants, null, title, body); //发送邮件 #endregion }
public EmailSender(AppConfig appConfig) { _emailClient = new EmailClient(new Uri(appConfig.EmailService)); }
public bool Add(NotificationModel model, bool isProduction = false) { using (var dbContext = new MissionskyOAEntities()) { var entity = model.ToEntity(); entity.CreatedTime = DateTime.Now; dbContext.Notifications.Add(entity); dbContext.SaveChanges(); if (model.TargetUserIds != null && model.TargetUserIds.Count > 0) { foreach (var userId in model.TargetUserIds) { NotificationTargetUser nUser = new NotificationTargetUser() { Notification = entity, NotificationId = entity.Id, TargetUserId = userId }; dbContext.NotificationTargetUsers.Add(nUser); } dbContext.SaveChanges(); } try { string title = "通知"; switch (model.BusinessType) { case BusinessType.Approving: title = "审批通知"; break; case BusinessType.BookMeetingRoomSuccessAnnounce: title = "预定会议室成功"; break; case BusinessType.CacnelMeetingRoomSuccessAnnounce: title = "取消会议室预定成功"; break; case BusinessType.ExpressMessage: title = "快递消息"; break; default: break; } if (model.MessageType == NotificationType.Email) { EmailClient.Send(new List <string>() { model.Target }, null, string.IsNullOrEmpty(model.Title) ? title : model.Title, model.MessageContent); } else if (model.MessageType == NotificationType.SMessage) { //短信服务暂时没有 return(true); } else { JPushClient client = new JPushClient(JPushExtensions.app_key, JPushExtensions.master_secret); string parameters = "{\"businessType\":" + ((int)model.BusinessType).ToString() + ",\"notificationId\":" + entity.Id + "}"; if (model.BusinessType == BusinessType.AdministrationEventAnnounce) { title = string.IsNullOrEmpty(model.Title) ? "公告" : model.Title; PushPayload payload = JPushExtensions.PushBroadcast(null, title, model.MessageContent, parameters, isProduction); JPushExtensions.SendPush(payload, client); } else if (model.BusinessType == BusinessType.AssetInventory) { title = string.IsNullOrEmpty(model.Title) ? "资产盘点公告" : model.Title; PushPayload payload = JPushExtensions.PushBroadcast(null, title, model.MessageContent, parameters, isProduction); JPushExtensions.SendPush(payload, client); } else { if (!string.IsNullOrEmpty(model.Target)) { string target = model.Target; // 2. 检查邮箱的格式 if (!String.IsNullOrEmpty(model.Target) && model.Target.IsEmail()) { target = model.Target.ToLower().Split('@')[0].Replace(".", ""); } if (model.Scope == NotificationScope.UserGroup) { PushPayload payload = JPushExtensions.PushBroadcast(new string[] { target }, title, model.MessageContent, parameters, isProduction); JPushExtensions.SendPush(payload, client); } else { PushPayload payload = JPushExtensions.PushObject_android_and_ios(new string[] { target }, title, model.MessageContent, parameters, isProduction); JPushExtensions.SendPush(payload, client); } } } } } catch (Exception ex) { Console.WriteLine(ex.InnerException != null ? ex.InnerException.Message : ex.Message); return(true); } } return(true); }
/// <summary> /// Odstranenie clena alebo podskupiny zo skupiny /// </summary> private void BtnDelete_Click(object paSender, RoutedEventArgs paE) { try { if (DgSwitch) { if (PravoZmeny) { Skupina dataRowView = (Skupina)((Button)paE.Source).DataContext; string tMenoOdchod = dataRowView.Meno; foreach (Skupina polozka in _podskupiny) { if (polozka.Meno == tMenoOdchod) { _podskupiny.Remove(polozka); _aktSkupina.Podskupiny.Remove(polozka.Meno); // Email notifikacia Pouzivatel odosielatel = ((MainWindow)Owner).Logika.GetPouzivatel(_aktSkupina.VeduciSkupiny); Pouzivatel adresat = ((MainWindow)Owner).Logika.GetPouzivatel(polozka.VeduciSkupiny); EmailClient notifikacia = new EmailClient(adresat.Email, "NOTIFIKACIA KANGO", "<b> Vaša skupina bola práve odstránená zo skupiny.</b><br>" + "Meno skupiny: <b>" + _aktSkupina.Meno + "</b><br>" + "Typ: <b>" + _aktSkupina.Typ.ToString() + "</b><br>", ((MainWindow)Owner).Nastavenia, odosielatel); notifikacia.PoslatEmail(); break; } } VypisPodskupin(); NaplnPodskupin(); DelPravo(); MessageBox.Show("Zo skupiny odišla podskupina: " + tMenoOdchod); BoloPridanie = true; } else { MessageBox.Show("Nemáte právo editácie."); } } else { if (PravoZmeny) { Pouzivatel dataRowView = (Pouzivatel)((Button)paE.Source).DataContext; string tMenoOdchod = dataRowView.Meno; foreach (Pouzivatel polozka in _clenovia) { if (polozka.Meno == tMenoOdchod) { _clenovia.Remove(polozka); _aktSkupina.Clenovia.Remove(polozka.Meno); Pouzivatel uzivatelOdchod = ((MainWindow)Owner).Logika.GetPouzivatel(polozka.Meno); uzivatelOdchod.Skupiny.Remove(_nMeno); // Email notifikacia Pouzivatel adresat = ((MainWindow)Owner).Logika.GetPouzivatel(_aktSkupina.VeduciSkupiny); EmailClient notifikacia = new EmailClient(polozka.Email, "NOTIFIKACIA KANGO", "<b> Práve ste boli odstránený zo skupiny.</b><br>" + "Meno skupiny: <b>" + _aktSkupina.Meno + "</b><br>" + "Typ: <b>" + _aktSkupina.Typ.ToString() + "</b><br>", ((MainWindow)Owner).Nastavenia, adresat); notifikacia.PoslatEmail(); break; } } VypisClenov(); NaplnClenov(); DelPravo(); MessageBox.Show("Zo skupiny odišiel člen: " + tMenoOdchod); BoloPridanie = true; } else { MessageBox.Show("Nemáte právo editácie."); } } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
/// <summary> /// 发邮件 返回1则发送成功 /// </summary> /// <param name="securityCode"></param> /// <param name="EtoAddress"></param> private int SendEmail(string securityCode, string[] EtoAddress) { var emailModel = new UserMessageEmailService().QueryByID(1);//查询出来要发送的邮件内容 string content = emailModel.Content.Replace("{code}", securityCode); var emailClient = new EmailClient(); if (emailClient.EmailSend(EtoAddress, emailModel.Title, content, "1") == "1") { return 1; } return -1; }
internal static bool SendEmail(string addressFrom, string addressTo, string mailSubject, string mailBody, string filePath) { return(EmailClient.Send(addressFrom, addressTo, mailSubject, mailBody, filePath)); }
public void Notify(string notification) { EmailClient.Send(notification); }
public void Init() { _emailClient = new EmailClient("site", "user", "password", "https://secure.eloqua.com/API/REST/1.0/"); }
public GrantVacationController(ILogger <GrantVacationController> logger) { _logger = logger; this.databaseClient = new DatabaseClient("ACCESS_TOKEN"); this.emailClient = new EmailClient("username", "password"); }
public Task SendAsync(IdentityMessage message) { return(EmailClient.SendAsync(message.Destination, message.Subject, message.Body)); }
public WeatherTracker() { _emailClient = new EmailClient(); _phone = new Phone(); }
private void DoValidate() { RedisServer redis = new RedisServer(ConfigurationManager.Get("redisHost"), 6379, ConfigurationManager.Get("redisPassword")); string key = "locker-validate-" + Name; try { if (SpiderContext.Validations == null) { return; } var validations = SpiderContext.Validations.GetValidations(); if (validations != null && validations.Count > 0) { foreach (var validation in validations) { validation.CheckArguments(); } } if (redis != null) { while (!redis.LockTake(key, "0", TimeSpan.FromMinutes(10))) { Thread.Sleep(1000); } } var lockerValue = redis?.HashGet(ValidateStatusName, Name); bool needInitStartRequest = lockerValue != "validate finished"; if (needInitStartRequest) { Logger.Info("开始数据验证 ..."); if (validations != null && validations.Count > 0) { MailBodyBuilder builder = new MailBodyBuilder(Name, SpiderContext.Validations.Corporation); foreach (var validation in validations) { builder.AddValidateResult(validation.Validate()); } string mailBody = builder.Build(); using (EmailClient client = new EmailClient(SpiderContext.Validations.EmailSmtpServer, SpiderContext.Validations.EmailUser, SpiderContext.Validations.EmailPassword, SpiderContext.Validations.EmailSmtpPort)) { client.SendMail(new EmaillMessage($"{Name} " + "validation report", mailBody, SpiderContext.Validations.EmailTo) { IsHtml = true }); } } } else { Logger.Info("有其他线程执行了数据验证."); } if (needInitStartRequest) { redis?.HashSet(ValidateStatusName, Name, "validate finished"); } } catch (Exception e) { Logger.Error(e.Message, e); } finally { redis?.LockRelease(key, 0); } }
/// <summary> /// Zobrazenie detailov o skupine /// </summary> private void BtnDetailGroup_OnClick(object paSender, RoutedEventArgs paE) { try { Skupina dataRowView = (Skupina)((Button)paE.Source).DataContext; string tMeno = dataRowView.Meno; FTyp tTyp = dataRowView.Typ; string tVeduci = dataRowView.VeduciSkupiny; // EDIT Skupina tSkupina = Logika.GetSkupina(tMeno); HashSet <Skupina> tPodskupiny = Logika.GetPodskupiny(tMeno); List <Pouzivatel> tPodUzivatelia = Logika.GetPodPouzivatelov(tMeno); bool povolenie = false; if (PrihlasenyStav) { povolenie = (PrihlasenyMeno == tVeduci || Logika.GetPouzivatel(PrihlasenyMeno).Typ == FTyp.Administrátor) ? true : false; } DetailGroup editovanie = new DetailGroup(povolenie, tSkupina.Meno, tSkupina, tPodUzivatelia, tPodskupiny, this) { WindowStartupLocation = WindowStartupLocation.CenterOwner }; editovanie.ShowDialog(); if (editovanie.BoloPridanie) { PotrebaUlozit = true; } if (PrihlasenyStav && editovanie.BolaZmena) { dataRowView.Meno = tSkupina.Meno; dataRowView.Typ = tSkupina.Typ; dataRowView.VeduciSkupiny = tSkupina.VeduciSkupiny; dataRowView.Poznamka = tSkupina.Poznamka; // Email notifikacia Pouzivatel konkretny = Logika.GetPouzivatel(tSkupina.VeduciSkupiny); EmailClient notifikacia = new EmailClient(konkretny.Email, "NOTIFIKACIA KANGO", "<b> Práve ste editovali údaje skupiny. <br></b>" + "Údaje skupiny sú:<br>" + "Meno: <b>" + tSkupina.Meno + "</b><br>" + "Typ: <b>" + tSkupina.Typ.ToString() + "</b><br>" + "Poznámka: <b>" + tSkupina.Poznamka + "</b><br>" + "Podskupiny: <b>" + tSkupina.GetPodskupiny() + "</b><br>" + "Členovia: <b>" + tSkupina.GetClenov() + "</b><br>", Nastavenia); notifikacia.PoslatEmail(); if (tSkupina.Meno != tMeno) { foreach (Pouzivatel polozka in Logika.GetPouzivatalia()) { if (polozka.Skupiny.Contains(tMeno)) { polozka.Skupiny.Remove(tMeno); polozka.Skupiny.Add(tSkupina.Meno); } } } MessageBox.Show("Editovali ste skupinu : " + tMeno, "Oznámenie", MessageBoxButton.OK, MessageBoxImage.Information); PotrebaUlozit = true; VypisSkupiny(); } editovanie.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
protected void btnSave_Click1(object sender, EventArgs e) { int numTicket = Convert.ToInt32(txtQtys.Text); // event's ticket quantity //edit ticket by ticket id --create new ticket with ticket eventID = Request.QueryString["E_ID"]; EventTicket EB_tickets = new EventTicket(); EventTicket REG_tickets = new EventTicket(); EventTicket VIP_tickets = new EventTicket(); EventTicket VVIP_tickets = new EventTicket(); TicketServiceClient tsc = new TicketServiceClient(); EventModel currentEvent = new EventModel(); EventServiceClient esc = new EventServiceClient(); currentEvent = esc.findByEventID(eventID); EventModel newEvent = new EventModel(); //event to be updated //validate ticket selected EB_TicketID = Request.QueryString["EBT_ID"]; if (EB_TicketID == null) { RG_TicketID = Request.QueryString["RBT_ID"]; if (RG_TicketID == null) { VIP_TicketID = Request.QueryString["VT_ID"]; if (VIP_TicketID == null) { VVIP_TicketID = Request.QueryString["VVT_ID"]; if (VVIP_TicketID == null) { //free event } else //get vvip ticket info by ticket id { int currentNumTicket = currentEvent.VVIP_Quantity; if (currentNumTicket >= numTicket) { for (int i = 0; i < numTicket; i++) { VVIP_tickets = tsc.getVIPTicket(eventID); VVIP_tickets._GuestID = Convert.ToInt32(LoggedID); VVIP_tickets.numTicket = numTicket; int purchased_Ticket_ID; // int purchasedTicektID = 0; purchased_Ticket_ID = tsc.PurchaseTicket(VVIP_tickets); if (purchased_Ticket_ID != 0) { purchased_Ticket_ID = Convert.ToInt32(purchased_Ticket_ID); //QR Code QRCodeImage qrCode = new QRCodeImage(); qrCode = GenerateCode(VVIP_tickets, numTicket, LoggedID, purchased_Ticket_ID, eventID); //decrement ticket quantity in main event table currentEvent.VVIP_Quantity = currentNumTicket - numTicket; newEvent = esc.updateEvent(currentEvent, eventID); EmailClient emails = new EmailClient(); //guest, newEvent, EventTicket, EventServiceClient EventClient = new EventServiceClient(); EventModel items = EventClient.findByEventID(eventID); emails.sendMsg_TicketPurchased(Name, Email, items, qrCode, VVIP_tickets); } } Response.Redirect("EventDetails.aspx?ev=" + eventID); } } } else //get vip ticket info by ticket id { int currentNumTicket = currentEvent.VIP_Quantity; if (currentNumTicket >= numTicket) { for (int i = 0; i < numTicket; i++) { VIP_tickets = tsc.getVIPTicket(eventID); VIP_tickets._GuestID = Convert.ToInt32(LoggedID); VIP_tickets.numTicket = numTicket; int purchased_Ticket_ID; // int purchasedTicektID = 0; purchased_Ticket_ID = tsc.PurchaseTicket(VIP_tickets); if (purchased_Ticket_ID != 0) { purchased_Ticket_ID = Convert.ToInt32(purchased_Ticket_ID); //QR Code QRCodeImage qrCode = new QRCodeImage(); qrCode = GenerateCode(VIP_tickets, numTicket, LoggedID, purchased_Ticket_ID, eventID); //decrement ticket quantity in main event table currentEvent.VIP_Quantity = currentNumTicket - numTicket; newEvent = esc.updateEvent(currentEvent, eventID); EmailClient emails = new EmailClient(); //guest, newEvent, EventTicket, EventServiceClient EventClient = new EventServiceClient(); EventModel items = EventClient.findByEventID(eventID); emails.sendMsg_TicketPurchased(Name, Email, items, qrCode, VIP_tickets); } } Response.Redirect("EventDetails.aspx?ev=" + eventID); } } } else //get regular ticket info by ticket id { int currentNumTicket = currentEvent.Reg_Quantity; if (currentNumTicket >= numTicket) { for (int i = 0; i < numTicket; i++) { REG_tickets = tsc.getRegularTicket(eventID); REG_tickets._GuestID = Convert.ToInt32(LoggedID); REG_tickets.numTicket = numTicket; int purchased_Ticket_ID = 0; // int purchasedTicektID = 0; purchased_Ticket_ID = tsc.PurchaseTicket(REG_tickets); if (purchased_Ticket_ID != 0) { //QR Code QRCodeImage qrCode = new QRCodeImage(); qrCode = GenerateCode(REG_tickets, numTicket, LoggedID, purchased_Ticket_ID, eventID); //decrement ticket quantity in main event table currentEvent.Reg_Quantity = currentNumTicket - numTicket; newEvent = esc.updateEvent(currentEvent, eventID); EmailClient emails = new EmailClient(); //guest, newEvent, EventTicket, EventServiceClient EventClient = new EventServiceClient(); EventModel items = EventClient.findByEventID(eventID); emails.sendMsg_TicketPurchased(Name, Email, items, qrCode, REG_tickets); } } Response.Redirect("EventDetails.aspx?ev=" + eventID); } } } else //get early bird ticket info by ticket id { int currentNumTicket = currentEvent.EB_Quantity; if (currentNumTicket >= numTicket) { for (int i = 0; i < numTicket; i++) { EB_tickets = tsc.getEBTicket(eventID); EB_tickets._GuestID = Convert.ToInt32(LoggedID); EB_tickets.numTicket = numTicket; int purchased_Ticket_ID; // int purchasedTicektID = 0; purchased_Ticket_ID = tsc.PurchaseTicket(EB_tickets); if (purchased_Ticket_ID != 0) { purchased_Ticket_ID = Convert.ToInt32(purchased_Ticket_ID); //QR Code QRCodeImage qrCode = new QRCodeImage(); qrCode = GenerateCode(EB_tickets, numTicket, LoggedID, purchased_Ticket_ID, eventID); //decrement ticket quantity in main event table FileUploadClient fuc = new FileUploadClient(); currentEvent.EB_Quantity = currentNumTicket - numTicket; newEvent = esc.updateEvent(currentEvent, eventID); EmailClient emails = new EmailClient(); //guest, newEvent, EventTicket, EventServiceClient EventClient = new EventServiceClient(); EventModel items = EventClient.findByEventID(eventID); emails.sendMsg_TicketPurchased(Name, Email, items, qrCode, EB_tickets); } } Response.Redirect("EventDetails.aspx?ev=" + eventID); } else { //sold out } } }
/// <summary> /// Zobrazenie detailov o používateľovi /// </summary> private void BtnDetailUser_OnClick(object paSender, RoutedEventArgs paE) { try { Pouzivatel dataRowView = (Pouzivatel)((Button)paE.Source).DataContext; string tMeno = dataRowView.Meno; Pouzivatel konkretny = Logika.GetPouzivatel(tMeno); HashSet <Skupina> zaclenenie = null; if (konkretny.Skupiny.Count != 0) { zaclenenie = Logika.GetZaclenenie(tMeno); } bool povolenie = false; if (PrihlasenyStav) { povolenie = (PrihlasenyMeno == tMeno || Logika.GetPouzivatel(PrihlasenyMeno).Typ == FTyp.Administrátor) ? true : false; } DetailUser editovanie = new DetailUser(povolenie, konkretny, zaclenenie) { WindowStartupLocation = WindowStartupLocation.CenterOwner }; editovanie.ShowDialog(); if (PrihlasenyStav && editovanie.BolaZmena) { dataRowView.Meno = konkretny.Meno; dataRowView.Typ = konkretny.Typ; dataRowView.Email = konkretny.Email; dataRowView.Telefon = konkretny.Telefon; dataRowView.Aktivny = konkretny.Aktivny; // Email notifikacia EmailClient notifikacia = new EmailClient(konkretny.Email, "NOTIFIKACIA KANGO", "<b> Práve ste editovali osobné údaje. <br></b>" + "Vaše osobné údaje sú:<br>" + "Meno: <b>" + konkretny.Meno + "</b><br>" + "Email: <b>" + konkretny.Email + "</b><br>" + "Telefón: <b>" + konkretny.Telefon + "</b><br>" + "Poznámka: <b>" + konkretny.Poznamka + "</b><br>", Nastavenia); notifikacia.PoslatEmail(); if (konkretny.Meno != tMeno) { foreach (Skupina polozka in Logika.GetSkupiny()) { if (konkretny.Skupiny.Contains(polozka.Meno)) { polozka.Clenovia.Remove(tMeno); polozka.Clenovia.Add(konkretny.Meno); } if (polozka.VeduciSkupiny == tMeno) { polozka.VeduciSkupiny = konkretny.Meno; } } } MessageBox.Show("Editovali ste používateľa : " + tMeno, "Oznámenie", MessageBoxButton.OK, MessageBoxImage.Information); PotrebaUlozit = true; VypisPouzivatelia(); } editovanie.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
public PurchaseController(EmailClient emailClient, sendesContext sendesContext) { _sendesContext = sendesContext; _emailClient = emailClient; }
void ProgramSetup() { AppSoftware = GameObject.Find("Applications"); QA = GameObject.Find("QA"); HackingSoftware = GameObject.Find("Hacking"); SysSoftware = GameObject.Find("System"); Computer = GameObject.Find("Computer"); Other = GameObject.Find("Other"); Missions = GameObject.Find("Missions"); qa = QA.GetComponent <BugReport>(); //mb = GetComponent<MissionBrow>(); sl = Computer.GetComponent <SiteList>(); wsv = Computer.GetComponent <WebSecViewer>(); //Hacking Software pro = HackingSoftware.GetComponent <Progtive>(); trace = HackingSoftware.GetComponent <Tracer>(); ds = HackingSoftware.GetComponent <DirSearch>(); dc = HackingSoftware.GetComponent <DicCrk>(); passcrk = HackingSoftware.GetComponent <PasswordCracker>(); //System Sofware dsk = SysSoftware.GetComponent <Desktop>(); com = SysSoftware.GetComponent <Computer>(); ss = SysSoftware.GetComponent <ScreenSaver>(); sp = SysSoftware.GetComponent <SystemPanel>(); am = SysSoftware.GetComponent <AppMenu>(); tasks = SysSoftware.GetComponent <TaskViewer>(); clk = SysSoftware.GetComponent <Clock>(); cmd = SysSoftware.GetComponent <CLI>(); cmd2 = SysSoftware.GetComponent <CLIV2>(); os = SysSoftware.GetComponent <OS>(); dm = SysSoftware.GetComponent <DiskMan>(); mouse = SysSoftware.GetComponent <Mouse>(); fp = SysSoftware.GetComponent <FileExplorer>(); dem = SysSoftware.GetComponent <DeviceManager>(); vc = SysSoftware.GetComponent <VolumeController>(); //Application Softwate // port = AppSoftware.GetComponent<Portfolio>(); tr = AppSoftware.GetComponent <TextReader>(); sm = AppSoftware.GetComponent <SystemMap>(); al = AppSoftware.GetComponent <AccLog>(); note = AppSoftware.GetComponent <Notepad>(); notev2 = AppSoftware.GetComponent <Notepadv2>(); cc = AppSoftware.GetComponent <EmailClient>(); tv = AppSoftware.GetComponent <TreeView>(); nv = AppSoftware.GetComponent <NotificationViewer>(); pv = AppSoftware.GetComponent <PlanViewer>(); //calendar = AppSoftware.GetComponent<Calendar>(); calendarv2 = AppSoftware.GetComponent <CalendarV2>(); eventview = AppSoftware.GetComponent <EventViewer>(); exchangeview = AppSoftware.GetComponent <ExchangeViewer>(); // Application Browsers ib = AppSoftware.GetComponent <InternetBrowser>(); eib = AppSoftware.GetComponent <NetViewer>(); fib = AppSoftware.GetComponent <Firefox>(); rv = AppSoftware.GetComponent <RemoteView>(); cal = AppSoftware.GetComponent <Calculator>(); mp = AppSoftware.GetComponent <MusicPlayer>(); // Prompts ip = Prompts.GetComponent <InstallPrompt>(); pp = Prompts.GetComponent <PurchasePrompt>(); ep = Prompts.GetComponent <ErrorProm>(); sdp = Prompts.GetComponent <ShutdownProm>(); rp = Prompts.GetComponent <RezPrompt>(); // shareprompt = Prompts.GetComponent<SharePrompt>(); notiprompt = Prompts.GetComponent <NotfiPrompt>(); //OTHER vmd = Other.GetComponent <VMDesigner>(); // Computer ct = Computer.GetComponent <CustomTheme>(); //Missions misgen = Missions.GetComponent <MissionGen>(); }
private void NotifyBeteg(IdopontIDBeteg idopontadatok, string megjegyzes) { Console.WriteLine(); // TODO WCF meghívása, formázott email küldése var fromName = recepciosViewModel.SessionUser.Name; var toName = idopontadatok.Nev; var fromAddress = "*****@*****.**"; var toAddress = "*****@*****.**"; string subject = "Értesítés időpontról"; string body = "Tisztelt "+ idopontadatok.Nev + "!\nÖnnek foglalt időpontja van kórházunkban: " + idopontadatok.Datum + "\nKezelőorvos neve: " + idopontadatok.OrvosNev + "\n"+ megjegyzes +"\n\nKöszönjük, hogy minket választott!\t Tisztelettel: "+ recepciosViewModel.SessionUser.Name; EmailClient client = new EmailClient(); client.EmailKuldes(fromAddress, fromName, toAddress, toName, subject, body); }
public void Notify(string notification) { EmailClient.Send(notification, ToAddresses, BccAddresses, MessageBody, Subject); }
public NotificationService(ILogService log, EmailClient email, ICertificateService certificateService) { _log = log; _certificateService = certificateService; _email = email; }
//Method that queues some message on Azure Queue (in order to be sent by email later) by calling an Azure Function public static async Task <HttpResponseMessage> QueuesEmailMessage(string functionEndpoint, HttpMethod method, EmailClient clientemail) { var httpclient = new HttpClient(); var request = new HttpRequestMessage(method, functionEndpoint); var json = JsonConvert.SerializeObject(clientemail, Formatting.Indented); request.Content = new StringContent(json, Encoding.UTF8, "application/json"); var responseSend = await httpclient.SendAsync(request); var responseStr = await responseSend.Content.ReadAsStringAsync(); var responseObj = JsonConvert.DeserializeObject <HttpResponseMessage>(responseStr); if (responseSend.IsSuccessStatusCode || responseObj.IsSuccessStatusCode) { return(new HttpResponseMessage(HttpStatusCode.OK)); } else { return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } }
public ActionResult CheckoutSubmit(Order order) { int orderID = orderFactory.Insert(order); order.ID = orderID; foreach (List <Product> cartListItem in cart.GetShoppingCart()) { OrderCollection orderCollection = new OrderCollection(); orderCollection.OrderID = orderID; orderCollection.ProductID = cartListItem[0].ID; orderCollection.Amount = cartListItem.Count; orderCollectionFactory.Insert(orderCollection); } OrderStatus orderStatus = new OrderStatus(); orderStatus.OrderID = orderID; orderStatus.Date = DateTime.Today.ToShortDateString(); orderStatus.StatusID = 1; orderStatusFactory.Insert(orderStatus); #region Email EmailClient emailClient = new EmailClient("smtp.gmail.com", 587, "*****@*****.**", "FedeAbe2000", true); //emailClient.SendEmail(order.Email); //emailClient.SendNotification(order.Fullname, order.Email, Request.PhysicalApplicationPath + @"\EmailTemplates\Notification.html"); //List<Product> productsInOrder = new List<Product>(); //for (int i = 0; i < cart.GetShoppingCart().Count; i++) //{ // productsInOrder.Add(productFactory.Get(cart.GetShoppingCart()[i][0].ID)); //} //List<ProductVM> products = new List<ProductVM>(); //foreach (Product item in productsInOrder) //{ // ProductVM productVM = new ProductVM(); // productVM.Product = item; // productVM.Images = imageFactory.GetBy("ProductID", item.ID); // productVM.Category = categoryFactory.Get(item.CategoryID); // products.Add(productVM); //} List <ProductAmountVM> products = new List <ProductAmountVM>(); foreach (List <Product> item in cart.GetShoppingCart()) { ProductVM productVM = new ProductVM(); productVM.Product = item[0]; productVM.Images = imageFactory.GetBy("ProductID", item[0].ID); productVM.Category = categoryFactory.Get(item[0].CategoryID); ProductAmountVM pavm = new ProductAmountVM() { ProductVM = productVM, Amount = item.Count }; products.Add(pavm); } emailClient.SendInvoice(order, products); #endregion return(RedirectToAction("OrderConfirmation")); }
public static EmailClient CreateEmailClient(int ID, string name, string emailAddress) { EmailClient emailClient = new EmailClient(); emailClient.ID = ID; emailClient.Name = name; emailClient.EmailAddress = emailAddress; return emailClient; }
public void SendEmailToMultipleRecipients() { EmailClient client = CreateEmailClient(); #region Snippet:Azure_Communication_Email_Send_Multiple_Recipients // Create the email content var emailContent = new EmailContent("This is the subject"); emailContent.PlainText = "This is the body"; // Create the To list var toRecipients = new List <EmailAddress> { new EmailAddress( //@@ email: "<recipient email address>" //@@ displayName: "<recipient displayname>" /*@@*/ email: TestEnvironment.ToEmailAddress, /*@@*/ displayName: "Customer Name"), new EmailAddress( //@@ email: "<recipient email address>" //@@ displayName: "<recipient displayname>" /*@@*/ email: TestEnvironment.ToEmailAddress, /*@@*/ displayName: "Customer Name") }; // Create the CC list var ccRecipients = new List <EmailAddress> { new EmailAddress( //@@ email: "<recipient email address>" //@@ displayName: "<recipient displayname>" /*@@*/ email: TestEnvironment.ToEmailAddress, /*@@*/ displayName: "Customer Name"), new EmailAddress( //@@ email: "<recipient email address>" //@@ displayName: "<recipient displayname>" /*@@*/ email: TestEnvironment.ToEmailAddress, /*@@*/ displayName: "Customer Name") }; // Create the BCC list var bccRecipients = new List <EmailAddress> { new EmailAddress( //@@ email: "<recipient email address>" //@@ displayName: "<recipient displayname>" /*@@*/ email: TestEnvironment.ToEmailAddress, /*@@*/ displayName: "Customer Name"), new EmailAddress( //@@ email: "<recipient email address>" //@@ displayName: "<recipient displayname>" /*@@*/ email: TestEnvironment.ToEmailAddress, /*@@*/ displayName: "Customer Name") }; var emailRecipients = new EmailRecipients(toRecipients, ccRecipients, bccRecipients); // Create the EmailMessage var emailMessage = new EmailMessage( //@@ sender: "<Send email address>" // The email address of the domain registered with the Communication Services resource /*@@*/ sender: TestEnvironment.AzureManagedFromEmailAddress, emailContent, emailRecipients); SendEmailResult sendResult = client.Send(emailMessage); Console.WriteLine($"Email id: {sendResult.MessageId}"); #endregion Snippet:Azure_Communication_Email_Send_Multiple_Recipients Console.WriteLine(sendResult.MessageId); Assert.False(string.IsNullOrEmpty(sendResult.MessageId)); }
public void AddToEmailClients(EmailClient emailClient) { base.AddObject("EmailClients", emailClient); }
static EmailClient DeserializeJson(string serializedObj) { EmailClient deserializedEmailClient = JsonConvert.DeserializeObject <EmailClient>(serializedObj); return(deserializedEmailClient); }
private async Task GenerateNewsletterAsync() { var appSettings = _configuration.Get <AppSettings>(); _logger.LogInformation("Generating newsletter."); const string title = "Weekly Reddit"; var redditOptions = new RedditOptions { Username = appSettings.Reddit.Username, Password = appSettings.Reddit.Password, ClientId = appSettings.Reddit.ClientId, ClientSecret = appSettings.Reddit.ClientSecret }; _logger.LogInformation("Fetching content..."); using var redditClient = await RedditClient.CreateAsync(redditOptions); var trendings = await redditClient.GetTrendings(); var subreddits = await redditClient.GetSubredditsTopPosts(); var subredditBatches = subreddits.Batch(25).ToList(); for (int i = 0; i < subredditBatches.Count; i++) { var subredditBatch = subredditBatches[i]; var countString = subredditBatches.Count < 2 ? string.Empty : $"({i + 1}/{subredditBatches.Count}) "; _logger.LogInformation($"Generating email {countString}..."); var html = DataFormatter.GenerateHtml(new FormatterOptions { Subreddits = subredditBatch, Title = title, IssueDate = DateTime.Today, Trendings = i == 0 ? trendings : Enumerable.Empty <RedditPost>() }); var emailOptions = new EmailOptions { Password = appSettings.SmtpSettings.Password, Username = appSettings.SmtpSettings.Username, SmtpServer = appSettings.SmtpSettings.Server, SmtpPort = appSettings.SmtpSettings.Port }; _logger.LogInformation($"Sending email {countString}..."); using var emailClient = new EmailClient(emailOptions); await emailClient.SendAsync(new EmailContent { Content = html, Subject = $"{title} for {redditOptions.Username} {countString}// {DateTime.Today.ToLongDateString()}", FromName = title, FromAddress = appSettings.EmailSettings.FromAddress, To = appSettings.EmailSettings.ToAddress }); await Task.Delay(TimeSpan.FromSeconds(1)); // Prevent emails from arriving out of order. } _logger.LogInformation("Newsletter sent!"); }
// Use this for initialization void Start() { System = GameObject.Find("System"); Applications = GameObject.Find("Applications"); Hacking = GameObject.Find("Hacking"); Other = GameObject.Find("Other"); Computer = GameObject.Find("Computer"); Prompts = GameObject.Find("Prompts"); WindowHandel = GameObject.Find("WindowHandel"); QA = GameObject.Find("QA"); winman = WindowHandel.GetComponent <WindowManager>(); history = Computer.GetComponent <SiteList>(); websecviewer = Computer.GetComponent <WebSecViewer>(); qa = QA.GetComponent <BugReport>(); //DESKTOP ENVIROMENT customtheme = Computer.GetComponent <CustomTheme>(); startmenu = System.GetComponent <AppMenu>(); rezprompt = Prompts.GetComponent <RezPrompt>(); desktop = System.GetComponent <Desktop>(); vc = System.GetComponent <VolumeController>(); //HACKING SOFTWARE pro = Hacking.GetComponent <Progtive>(); trace = Hacking.GetComponent <Tracer>(); dirsearch = Hacking.GetComponent <DirSearch>(); dicCrk = Hacking.GetComponent <DicCrk>(); passwordcracker = Hacking.GetComponent <PasswordCracker>(); dirsearch = Hacking.GetComponent <DirSearch>(); //STOCK SYSTEMS // port = Applications.GetComponent<Portfolio>(); // shareprompt = Prompts.GetComponent<SharePrompt>(); //OTHER PROMPTS purchaseprompt = Prompts.GetComponent <PurchasePrompt>(); //SYSTEM PROMPTS errorprompt = Prompts.GetComponent <ErrorProm>(); shutdownprompt = Prompts.GetComponent <ShutdownProm>(); installprompt = Prompts.GetComponent <InstallPrompt>(); //SYSTEM SOFTWARE sysclock = System.GetComponent <Clock>(); cli = System.GetComponent <CLI>(); cliv2 = System.GetComponent <CLIV2>(); os = System.GetComponent <OS>(); systempanel = System.GetComponent <SystemPanel>(); tasks = System.GetComponent <TaskViewer>(); com = System.GetComponent <Computer>(); diskman = System.GetComponent <DiskMan>(); vv = System.GetComponent <VersionViewer>(); fp = System.GetComponent <FileExplorer>(); SRM = System.GetComponent <SystemResourceManager>(); boot = System.GetComponent <Boot>(); deviceman = System.GetComponent <DeviceManager>(); executor = System.GetComponent <Executor>(); gatewayviewer = System.GetComponent <GatewayViewer>(); //LEGAL APPLICATIONS email = Applications.GetComponent <EmailClient>(); caluclator = Applications.GetComponent <Calculator>(); notepad = Applications.GetComponent <Notepad>(); notepadv2 = Applications.GetComponent <Notepadv2>(); accountlogs = Applications.GetComponent <AccLog>(); mp = Applications.GetComponent <MusicPlayer>(); treeview = Applications.GetComponent <TreeView>(); nv = Applications.GetComponent <NotificationViewer>(); pv = Applications.GetComponent <PlanViewer>(); calendar = Applications.GetComponent <Calendar>(); calendarv2 = Applications.GetComponent <CalendarV2>(); eventview = Applications.GetComponent <EventViewer>(); exchangeviewer = Applications.GetComponent <ExchangeViewer>(); //INTERNET BROWSERS internetbrowser = Applications.GetComponent <InternetBrowser>(); edgebrowser = Applications.GetComponent <NetViewer>(); firefoxbrowser = Applications.GetComponent <Firefox>(); //APPLICATIONS systemMap = Applications.GetComponent <SystemMap>(); textreader = Applications.GetComponent <TextReader>(); //BROWSER STUFF history = Computer.GetComponent <SiteList>(); //OTHER CONNECTION DEVICE rv = Applications.GetComponent <RemoteView>(); vmd = Other.GetComponent <VMDesigner>(); }
public void Init() { _emailClient = new EmailClient("site", "user", "password", "https://secure.eloqua.com/API/REST/1.0/"); }
public void Send_An_Email_using_AWS_SES() { EmailClient.SendEmail("*****@*****.**", "Jubin Jose", "*****@*****.**", "<aws-smtp-username>", "<aws-smtp-password>", "AWS Test", "<b>Hello</b>"); }
string ImportData(FileUpload flInfo, int EventID, EventModel _event) { string path = ""; string response = ""; bool isValidGuestColumn = false; bool isValidStaffColumn = false; bool isValidProductColumn = false; int startColumn; int startRow; ExcelWorksheet GuestworkSheet; ExcelWorksheet StaffworkSheet; ExcelWorksheet ProductworkSheet; int count = 0; if (flInfo.HasFile) { try { string filename = Path.GetFileName(flInfo.FileName); string serverLocation = "~/temp/" + "/" + filename; string SaveLoc = Server.MapPath(serverLocation); flInfo.SaveAs(SaveLoc); path = Server.MapPath("/") + "\\temp\\" + filename; var package = new ExcelPackage(new System.IO.FileInfo(path)); //// package.Workbook.Worksheets["TABNAME"].View.TabSelected = true; startColumn = 1; //where the file in the class excel start startRow = 2; GuestworkSheet = package.Workbook.Worksheets[1]; //read sheet one StaffworkSheet = package.Workbook.Worksheets[2]; //read sheet two ProductworkSheet = package.Workbook.Worksheets[3]; isValidGuestColumn = ValidateGuestColumns(GuestworkSheet); isValidStaffColumn = ValidateStaffColumns(StaffworkSheet); isValidProductColumn = ValidateProductColumns(ProductworkSheet); // isValidColumn = true; } catch { response = "Failed"; return(response); } //check staff sheet object data = null; if (isValidStaffColumn == true && isValidGuestColumn == true && isValidProductColumn == true) { do { data = StaffworkSheet.Cells[startRow, startColumn].Value; //column Number if (data == null) { continue; } //read column class name object Name = StaffworkSheet.Cells[startRow, startColumn].Value; object Email = StaffworkSheet.Cells[startRow, startColumn + 1].Value; object Occupation = StaffworkSheet.Cells[startRow, startColumn + 2].Value; StaffModel _staff = new StaffModel(); _staff.NAME = Name.ToString(); _staff.EMAIL = Email.ToString(); _staff.Occupation = Occupation.ToString(); _staff.PASS = "******"; _staff.EventID = EventID; //import db Eventrix_Client.Registration reg = new Eventrix_Client.Registration(); response = reg.RegisterStaff(_staff); if (response.Contains("successfully")) { count++; //====================-----------Send Email TO Staff-----------------=====================================// //=========================================================================================================// } startRow++; } while (data != null); data = null; startColumn = 1; //where the file in the class excel start startRow = 2; do { data = GuestworkSheet.Cells[startRow, startColumn].Value; //column Number if (data == null) { continue; } object Name = GuestworkSheet.Cells[startRow, startColumn].Value; object Surname = GuestworkSheet.Cells[startRow, startColumn + 1].Value; object Email = GuestworkSheet.Cells[startRow, startColumn + 2].Value; object Tyicket_Type = GuestworkSheet.Cells[startRow, startColumn + 3].Value; GuestModel _guest = new GuestModel(); _guest.NAME = Name.ToString(); _guest.SURNAME = Surname.ToString(); _guest.EMAIL = Email.ToString(); _guest.PASS = "******"; _guest.TYPE = Tyicket_Type.ToString(); Eventrix_Client.Registration reg = new Eventrix_Client.Registration(); int G_ID = reg.RegisterGuest(_guest); //Generate OTP string pass = genCode(Convert.ToString(G_ID)); //HashPass GuestModel gWithPass = new GuestModel(); gWithPass.PASS = pass; response = reg.InsertOTP(gWithPass, Convert.ToString(G_ID)); // response = reg.RegisterGuest(_guest); if (G_ID != -1) { count++; //====================-----------Send Invitation Email-----------------=====================================// EmailClient email = new EmailClient(); email.sendMsgInvite(_guest, _event, pass, EventID); //=========================================================================================================// } startRow++; } while (data != null); //upload product details data = null; startColumn = 1; //where the file in the class excel start startRow = 2; do { data = ProductworkSheet.Cells[startRow, startColumn].Value; //column Number if (data == null) { continue; } object Name = ProductworkSheet.Cells[startRow, startColumn].Value; object Description = ProductworkSheet.Cells[startRow, startColumn + 1].Value; object Quantity = ProductworkSheet.Cells[startRow, startColumn + 2].Value; object Price = ProductworkSheet.Cells[startRow, startColumn + 3].Value; EventProduct _product = new EventProduct(); _product._Name = Name.ToString(); // _product._Desc = Description.ToString(); _product._Quantity = Convert.ToInt32(Quantity.ToString()); _product.ProdRemaining = Convert.ToInt32(Quantity.ToString()); _product._Price = Convert.ToInt32(Price.ToString()); _product.EventID = EventID; ProductServiceClient psv = new ProductServiceClient(); string isProductUpdated = psv.createProduct(_product); if (isProductUpdated.Contains("success")) { count++; } startRow++; } while (data != null); //check record if (count == (GuestworkSheet.Dimension.Rows - 1) + (StaffworkSheet.Dimension.Rows - 1) + (ProductworkSheet.Dimension.Rows - 1)) { response = "success: All Records uploaded"; } else { response = "success: Not All Records uploaded"; } } else { response += " Failed to upload Exceel: Check columns"; } } else { response = "Failed: File not found"; } return(response); }