示例#1
0
        public ActionResult StockCardDetail(string stockCardID, string id)
        {
            StockCradDetails scDetails = sc.createStockCardDetail(id);

            sc.createDisbursementTransaction(stockCardID, id);
            //  List<StockCradDetails> scDisTran = sc.showDisbursementTransaction(stockCardID, id);

            sc.createSupplierTransaction(stockCardID, id);
            List <IncomingCode> incomingTran = sc.showSupplierTransaction(stockCardID);
            int balance      = sc.getLatestBalance(stockCardID, id);
            int reorderLevel = sc.getReorderLevel(id);

            if (balance <= reorderLevel)
            {
                Users  u                   = ds.GetUserInfo((int)Session["UserID"]);
                string EmailID             = u.EmailID;
                SendEmailNotification send = new SendEmailNotification();

                String EmailSubject = "Reorder level low at ItemID#" + id;
                String EmailBody    = "<p> Dear SuSu,</p>";
                EmailBody += "<p>Your reorder level is low in ItemID" + id + ". For your reference.</p>";
                EmailBody += "<p>Thank you<br/>Logic University Staionery Store</p>";
                EmailBody += "<p> Please do not reply to this email it is auto-generated.</p>";
                send.SendEmailHTML("*****@*****.**", EmailSubject, EmailBody);
            }
            ViewBag.stockCardDetail = scDetails;
            // ViewBag.scDisbursementTran = scDisTran;
            ViewBag.incomingTran = incomingTran;
            return(View());
        }
示例#2
0
        public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow)
        {
            Logger.Instance.WriteMethodEntry();

            try
            {
                // Create a new instance of the SendEmailNotification activity and assign
                // dependenty property values based on inputs to standard activity controls
                SendEmailNotification wfa = new SendEmailNotification
                {
                    ActivityDisplayName        = this.activityDisplayName.Value,
                    Advanced                   = this.advanced.Value,
                    ActivityExecutionCondition = this.activityExecutionCondition.Value,
                    EmailTemplate              = this.emailTemplate.Value,
                    To  = this.to.Value,
                    CC  = this.cc.Value,
                    Bcc = this.bcc.Value,
                    SuppressException = this.suppressException.Value,
                };

                return(wfa);
            }
            catch (Exception e)
            {
                Logger.Instance.ReportError(e);
                throw;
            }
            finally
            {
                Logger.Instance.WriteMethodExit();
            }
        }
示例#3
0
        public ActionResult SubmitDiscrepency(RequisitionDetails Dp)
        {
            String ItemID      = Dp.ItemID;
            string StockcardID = getstockcardID(ItemID);
            string DisStatus   = "PendingForApproval";

            using (SqlConnection conn = new SqlConnection(DataLink.connectionString))
            {
                conn.Open();
                string     cmdtext = @"insert into Discrepancy (DisbursementID,StockCardID,DiscrepancyQty,Reason,DiscrepancyStatus,ItemID) values ('" + Dp.DisbursementID + "','" + StockcardID + "'," + Dp.DeliveredQty + ",'" + Dp.Reason + "','" + DisStatus + "','" + ItemID + "')";
                SqlCommand cmd     = new SqlCommand(cmdtext, conn);
                cmd.ExecuteNonQuery();
            }

            Users  u             = ds.GetUserInfo((int)Session["UserID"]);
            string EmailID       = u.EmailID;
            int    DiscrepancyId = GetDiscrepancyID();

            SendEmailNotification send = new SendEmailNotification();

            String EmailSubject = "Request Submitted DiscrepancyID#" + DiscrepancyId;
            String EmailBody    = "<p> Dear KyiPhyu,</p>";

            EmailBody += "<p>Your order is ready to deliver with Discrepancy ID" + DiscrepancyId + " for your reference.</p>";
            EmailBody += "<p>Thank you<br/>Logic University Staionery Store</p>";
            EmailBody += "<p> Please do not reply to this email it is auto-generated.</p>";

            send.SendEmailHTML("*****@*****.**", EmailSubject, EmailBody);

            return(RedirectToAction("DisbursementList"));
        }
示例#4
0
        /// <summary>
        /// This method initializes activity UI controls to their default values.
        /// </summary>
        /// <param name="activity">An instance of the current workflow activity. This provides a way to extract the values of the properties to display in the UI.</param>
        public override void LoadActivitySettings(Activity activity)
        {
            Logger.Instance.WriteMethodEntry();

            try
            {
                // Cast the supplied activity as a SendEmailNotification activity
                SendEmailNotification wfa = activity as SendEmailNotification;
                if (wfa == null)
                {
                    return;
                }

                // Set form control values based on the activity's dependency properties
                this.activityDisplayName.Value        = wfa.ActivityDisplayName;
                this.advanced.Value                   = wfa.Advanced;
                this.activityExecutionCondition.Value = wfa.ActivityExecutionCondition;
                this.emailTemplate.Value              = wfa.EmailTemplate;
                this.to.Value  = wfa.To;
                this.cc.Value  = wfa.CC;
                this.bcc.Value = wfa.Bcc;
                this.suppressException.Value = wfa.SuppressException;
            }
            catch (Exception e)
            {
                Logger.Instance.ReportError(e);
                throw;
            }
            finally
            {
                Logger.Instance.WriteMethodExit();
            }
        }
        public Task Handle(SendUserOrderCreatedEmailNotification notification, CancellationToken cancellationToken)
        {
            var sendEmailNotification = new SendEmailNotification
            {
                ToEmail    = notification.ToEmail,
                ToName     = notification.ToName,
                TemplateId = sendGridOptions.OrderCreatedUserTemplateId
            };

            return(mediator.Publish(sendEmailNotification));
        }
示例#6
0
        public ActionResult SaveRepresentative(int UserID)
        {
            Users DepRepInfo = Data_Users.GetDepRepInfo((string)Session["DeptID"]);

            int prev_DepRep = DepRepInfo.UserID;

            int Confirm = Data_Users.AssignRepresentative(UserID);

            if (Confirm != 0)
            {
                Data_Users.RemoveRepresentative(prev_DepRep);
            }

            //Email Alert to Department Staff and clerk for Assign Representative.
            SendEmailNotification sen = new SendEmailNotification();

            // Deparmentrep Info = Data_User.RequestInfo(ID);

            int empID = UserID;  //Email to staff who have assigned as Department Representative

            Users userInfo  = Data_Users.GetInfoByUserID(empID);
            Users ClerkInfo = Data_Users.GetStoreClerkInfo(userInfo.DeptID_FK);

            Department department = Data_Department.GetDepartmentInfoByID(userInfo.DeptID_FK);

            String Useremail = userInfo.EmailID;

            String EmailSubject = " Change for  department representative";
            String EmailBody    = "<p> Dear " + userInfo.Username + ",</p>";

            EmailBody += "<p>You have been assigned as Department Representative for " + department.Departmentname + ".";
            EmailBody += "<p>Thank you<br/>Logic University Staionery Store</p>";
            EmailBody += "<p> Please do not reply to this email it is auto-generated.</p>";

            sen.SendEmailHTML(Useremail, EmailSubject, EmailBody);


            //Send email to Store Clerk for changing Department representative

            String EmailSubject1 = "Change for  department representative";
            //String EmailBody = "<p>Dear Yee Mon , </p>";
            String EmailBody1 = "<p> Dear " + ClerkInfo.Username + ",</p>";

            EmailBody1 += "<p>I am " + userInfo.Username + " currently the  Department Representative for " + department.Departmentname + ". We are pleased to say that we have changed new assign representative for <b>  " + department.Departmentname + "</b>. The new representative is  <b>" + ClerkInfo.Username + ".</p>";
            EmailBody1 += "<p>Thank you<br/>Logic University Staionery Store</p>";
            EmailBody1 += "<p> Please do not reply to this email it is auto-generated.</p>";

            sen.SendEmailHTML(ClerkInfo.EmailID, EmailSubject1, EmailBody1);

            return(RedirectToAction("Assginrepresentative"));
        }
        public async Task <string?> SendAsync(SendEmailNotification notificationDto)
        {
            // валидация данных

            // генерация отчета по соответствующим параметрам

            // формирование объекта для отправки

            // проверка политик, выбор провайдера, ретрай, ...

            await Task.Delay(1);

            return(notificationDto.Recipients.FirstOrDefault()?.Recipient.ToString());
        }
示例#8
0
        public ActionResult SubmitRequisition(List <WishList> wishListofusers)                    //triggreed when Request is submitted
        {
            using (SqlConnection conn = new SqlConnection(DataLink.connectionString))
            {
                conn.Open();
                string     cmdtext = @"insert into RequisitionList (statusOfRequest,DateOfSubmission,DeptID_FK,UserID_FK) values ('PendingforApproval'" + ",'" + DateTime.Today.ToString("yyyy-MM-dd") + "','" + (String)Session["DeptID"] + "','" + (int)Session["UserID"] + "')";
                SqlCommand cmd     = new SqlCommand(cmdtext, conn);
                cmd.ExecuteNonQuery();
            }

            int requestID = getRequisitionID();

            Debug.WriteLine(requestID);

            foreach (WishList wt in wishListofusers)
            {
                //int Temp =  wt.ItemID.Length;

                /*Debug.WriteLine(wt.ItemID);
                 * Debug.WriteLine(wt.ItemName);
                 * Debug.WriteLine(wt.UOM);
                 * Debug.WriteLine(wt.RequiredQuantity);*/

                using (SqlConnection conn = new SqlConnection(DataLink.connectionString))
                {
                    conn.Open();
                    string     cmdtext = @"insert into RequisitionDetail (RequisitionID,ItemID,RequisitionQuantity) values ('" + requestID + "','" + wt.ItemID + "','" + wt.RequiredQuantity + "')";
                    SqlCommand cmd     = new SqlCommand(cmdtext, conn);
                    cmd.ExecuteNonQuery();
                }
            }
            clearWishList((int)Session["UserID"]);

            //Email Alert to users fpr placing order.
            SendEmailNotification sen = new SendEmailNotification();
            Users      userInfo       = Data_Users.GetInfoByUserID((int)Session["UserID"]);
            Department department     = Data_Department.GetDepartmentInfoByID(userInfo.DeptID_FK);
            String     Useremail      = userInfo.EmailID;
            String     EmailSubject   = "Request Submitted RequisitionID#" + requestID;
            String     EmailBody      = "<p> Dear " + userInfo.Username + ",</p>";

            EmailBody += "<p>Your order has been succesfully submitted here is the OrderID " + requestID + " for your reference. Currently, it is been pending for approval from your " + department.DepartmentHead + ".</br> We will notify you once it approved.</p>";
            EmailBody += "<p>Thank you<br/>Logic University Staionery Store</p>";
            EmailBody += "<p> Please do not reply to this email it is auto-generated.</p>";

            sen.SendEmailHTML(Useremail, EmailSubject, EmailBody);

            return(RedirectToAction("MyRequisitions"));
        }
示例#9
0
        private async Task SendAsyncInternal(EmailMessage message, string emailType, bool enableNotification)
        {
            if (enableNotification)
            {
                var notification = new SendEmailNotification(message.ToNotificationEmail(_globalSettings.Smtp?.From), emailType);
                await _eventAggregator.PublishAsync(notification);

                // if a handler handled sending the email then don't continue.
                if (notification.IsHandled)
                {
                    _logger.LogDebug("The email sending for {Subject} was handled by a notification handler", notification.Message.Subject);
                    return;
                }
            }

            if (_globalSettings.IsSmtpServerConfigured == false)
            {
                _logger.LogDebug("Could not send email for {Subject}. It was not handled by a notification handler and there is no SMTP configured.", message.Subject);
                return;
            }

            using var client = new SmtpClient();

            await client.ConnectAsync(_globalSettings.Smtp.Host,
                                      _globalSettings.Smtp.Port,
                                      (MailKit.Security.SecureSocketOptions)(int) _globalSettings.Smtp.SecureSocketOptions);

            if (!(_globalSettings.Smtp.Username is null && _globalSettings.Smtp.Password is null))
            {
                await client.AuthenticateAsync(_globalSettings.Smtp.Username, _globalSettings.Smtp.Password);
            }

            var mailMessage = message.ToMimeMessage(_globalSettings.Smtp.From);

            if (_globalSettings.Smtp.DeliveryMethod == SmtpDeliveryMethod.Network)
            {
                await client.SendAsync(mailMessage);
            }
            else
            {
                client.Send(mailMessage);
            }

            await client.DisconnectAsync(true);
        }
示例#10
0
        //send Manger to notify when Discrepancy> 250
        //by supervisor
        public ActionResult sendMail()
        {
            Users  u             = ds.GetUserInfo((int)Session["UserID"]);
            string EmailID       = u.EmailID;
            int    discrepancyID = GetDiscrepancyID();

            SendEmailNotification send = new SendEmailNotification();

            String EmailSubject = "Request Submitted DiscrepancyID#" + discrepancyID;
            String EmailBody    = "<p> Dear KyiPhyu,</p>";

            EmailBody += "<p>Your item has discrepancy in Discrepancy ID" + discrepancyID + " for your reference.</p>";
            EmailBody += "<p>Thank you<br/>Logic University Staionery Store</p>";
            EmailBody += "<p> Please do not reply to this email it is auto-generated.</p>";

            send.SendEmailHTML("*****@*****.**", EmailSubject, EmailBody);
            return(RedirectToAction("UpdateAdjustmentStatus", "Adjustment"));
        }
示例#11
0
        public ActionResult sendRejectMailSup()
        {
            Users  u             = ds.GetUserInfo((int)Session["UserID"]);
            string EmailID       = u.EmailID;
            int    discrepancyID = GetDiscrepancyID();

            SendEmailNotification send = new SendEmailNotification();

            String EmailSubject = "Rejected DiscrepancyID#" + discrepancyID;
            String EmailBody    = "<p> Dear SuSu,</p>";

            EmailBody += "<p>Your Discrepancy ID" + discrepancyID + " has been rejected by supervisor.</p>";
            EmailBody += "<p>Thank you<br/>Logic University Staionery Store</p>";
            EmailBody += "<p> Please do not reply to this email it is auto-generated.</p>";

            send.SendEmailHTML("*****@*****.**", EmailSubject, EmailBody);
            return(RedirectToAction("UpdateAdjustmentStatus", "Adjustment"));
        }
示例#12
0
        public Task Handle(SendSupplierInvitationEmailNotification notification, CancellationToken cancellationToken)
        {
            var supplierSignUpUrl = string.Format(clientOptions.SupplierSignUpUrl, clientOptions.BaseUrl, notification.InvitationToken);

            var templateData = new SupplierInvitationEmailTemplateData
            {
                SignUpUrl = supplierSignUpUrl
            };

            var sendEmailNotification = new SendEmailNotification
            {
                ToEmail      = notification.ToEmail,
                ToName       = notification.ToName,
                TemplateId   = sendGridOptions.SupplierInvitationTemplateId,
                TemplateData = templateData
            };

            return(mediator.Publish(sendEmailNotification));
        }
示例#13
0
        public ActionResult RejectRequest(int ID, string Comments)
        {
            Data_CancelRequest DC = new Data_CancelRequest();

            if (Comments.Length == 0)
            {
                DC.RejectRequest(ID);
            }

            else
            {
                DC.RejectRequestwithComments(ID, Comments);
            }


            //return RedirectToAction("ApproveRequisition");

            //Email Alert to users for Reject request.
            SendEmailNotification sen = new SendEmailNotification();
            //  Users userInfo = Data_Users.GetInfoByUserID((int)Session["UserID"]);
            RequisitionList requestInfo = Data_CancelRequest.RequestInfo(ID);

            int empID = (int)requestInfo.UserID_FK;

            Users userInfo = Data_Users.GetInfoByUserID(empID);

            Department department = Data_Department.GetDepartmentInfoByID(userInfo.DeptID_FK);

            String Useremail = userInfo.EmailID;


            String EmailSubject = "Request Rejected for RequisitionID#" + ID;
            String EmailBody    = "<p> Dear " + userInfo.Username + ",</p>";

            EmailBody += "<p>Your request " + ID + " has been Rejected by the the your Department Head " + department.DepartmentHead + ". For more details please login into your Account or Please contact your Department Head.";
            EmailBody += "<p>Thank you<br/>Logic University Staionery Store</p>";
            EmailBody += "<p> Please do not reply to this email it is auto-generated.</p>";

            sen.SendEmailHTML(Useremail, EmailSubject, EmailBody);

            return(RedirectToAction("ApproveRequisition"));
        }
示例#14
0
        public ActionResult RemoveDelegation(Delegations Dg)  //this method triggers when the "ADD" button is pressed for the item.
        {
            int IsUnAllocated;

            //Debug.WriteLine(s.ItemID);
            using (SqlConnection conn = new SqlConnection(DataLink.connectionString))
            {
                conn.Open();
                string     cmdtext = @"UPDATE Delegation SET DelegationStatus ='UnAllocated' where DelegationID = '" + Dg.DelegationID + "'";
                SqlCommand cmd     = new SqlCommand(cmdtext, conn);
                IsUnAllocated = cmd.ExecuteNonQuery();
            }

            if (IsUnAllocated != 0)
            {
                using (SqlConnection conn = new SqlConnection(DataLink.connectionString))
                {
                    conn.Open();
                    string     cmdtext = @"UPDATE Users SET role ='DepStaff' where Username = '******'";
                    SqlCommand cmd     = new SqlCommand(cmdtext, conn);
                    cmd.ExecuteNonQuery();
                }
            }
            //Email Alert to department staff who has been remove for Delegation

            Users user = Data_Users.GetUserInfo(Dg.Username);
            SendEmailNotification sen        = new SendEmailNotification();
            Department            department = Data_Department.GetDepartmentInfoByID(user.DeptID_FK);

            String Useremail = user.EmailID;

            String EmailSubject = "Removed from Delegation";
            String EmailBody    = "<p> Dear " + user.Username + ",</p>";

            EmailBody += "<p>You have been removed from InterimHead for " + department.Departmentname + ".";
            EmailBody += "<p>Thank you<br/>Logic University Staionery Store</p>";
            EmailBody += "<p> Please do not reply to this email it is auto-generated.</p>";

            sen.SendEmailHTML(Useremail, EmailSubject, EmailBody);

            return(RedirectToAction("ViewDelegations"));
        }
示例#15
0
        public ActionResult CancelOrder(int ID)
        {
            Data_CancelRequest DC = new Data_CancelRequest();

            DC.CancelRequest(ID);

            SendEmailNotification sen = new SendEmailNotification();
            Users      userInfo       = Data_Users.GetInfoByUserID((int)Session["UserID"]);
            Department department     = Data_Department.GetDepartmentInfoByID(userInfo.DeptID_FK);
            String     Useremail      = userInfo.EmailID;
            String     EmailSubject   = "Cancellation of ReuestID#" + ID;
            String     EmailBody      = "<p> Dear " + userInfo.Username + ",</p>";

            EmailBody += "<p>We would like to inform you that your Request for stationery with RequisitionID " + ID + " has been cancelled by you .</p>";
            EmailBody += "<p>Thank you<br/>Logic University Staionery Store</p>";
            EmailBody += "<p> Please do not reply to this email it is auto-generated.</p>";

            sen.SendEmailHTML(Useremail, EmailSubject, EmailBody);
            return(RedirectToAction("MyRequisitions"));
        }
        public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow)
        {
            Logger.Instance.WriteMethodEntry();

            try
            {
                // Create a new instance of the SendEmailNotification activity and assign
                // dependenty property values based on inputs to standard activity controls
                SendEmailNotification wfa = new SendEmailNotification
                {
                    ActivityDisplayName        = this.activityDisplayName.Value,
                    QueryResources             = this.queryResources.Value,
                    Advanced                   = this.advanced.Value,
                    ActivityExecutionCondition = this.activityExecutionCondition.Value,
                    Iteration                  = this.iteration.Value,
                    EmailTemplate              = this.emailTemplate.Value,
                    To  = this.to.Value,
                    CC  = this.cc.Value,
                    Bcc = this.bcc.Value,
                    SuppressException = this.suppressException.Value,
                };

                // Convert the definition listings (web controls) to hash tables which can be serialized to the XOML workflow definition
                // A hash table is used due to issues with deserialization of lists and other structured data
                DefinitionsConverter queriesConverter = new DefinitionsConverter(this.queries.DefinitionListings);
                DefinitionsConverter workflowDataVariablesConverter = new DefinitionsConverter(this.workflowDataVariables.DefinitionListings);
                wfa.QueriesTable = queriesConverter.DefinitionsTable;
                wfa.WorkflowDataVariablesTable = workflowDataVariablesConverter.DefinitionsTable;

                return(wfa);
            }
            catch (Exception e)
            {
                Logger.Instance.ReportError(e);
                throw;
            }
            finally
            {
                Logger.Instance.WriteMethodExit();
            }
        }
示例#17
0
        public ActionResult SaveDelegation(Delegations d)
        {
            int   IsAllocated;
            Users user = Data_Users.GetInfoByUserID(d.UserID);

            using (SqlConnection conn = new SqlConnection(DataLink.connectionString))
            {
                conn.Open();
                string     cmdtext = @"insert into Delegation (DeptID,UserID,StartDate,EndDate,Username,DelegationStatus) values ('" + user.DeptID_FK + "','" + user.UserID + "','" + d.StartDate + "','" + d.EndDate + "','" + user.Username + "','Allocated')";
                SqlCommand cmd     = new SqlCommand(cmdtext, conn);
                IsAllocated = cmd.ExecuteNonQuery();
            }

            if (IsAllocated != 0)
            {
                using (SqlConnection conn = new SqlConnection(DataLink.connectionString))
                {
                    conn.Open();
                    string     cmdtext = @"UPDATE Users SET role ='InterimHead' where UserID = '" + d.UserID + "'";
                    SqlCommand cmd     = new SqlCommand(cmdtext, conn);
                    IsAllocated = cmd.ExecuteNonQuery();
                }
            }
            //Email Alert to department staff who has been assigned for Delegation
            SendEmailNotification sen        = new SendEmailNotification();
            Department            department = Data_Department.GetDepartmentInfoByID(user.DeptID_FK);

            String Useremail = user.EmailID;

            String EmailSubject = "Delegated As InterimHead";
            String EmailBody    = "<p> Dear " + user.Username + ",</p>";

            EmailBody += "<p>You have been delegated as InterimHead for " + department.Departmentname + " from " + d.StartDate + " to " + d.EndDate + ".";
            EmailBody += "<p>Thank you<br/>Logic University Staionery Store</p>";
            EmailBody += "<p> Please do not reply to this email it is auto-generated.</p>";

            sen.SendEmailHTML(Useremail, EmailSubject, EmailBody);

            return(Redirect("ViewDelegations"));
        }
示例#18
0
        public ActionResult validateOTP(RequisitionDetails rd)
        {
            string OTP = ds.validateOTP(rd);

            RequisitionDetails    userData = ds.getUserDataByDisbID(rd.DisbursementID);
            SendEmailNotification send     = new SendEmailNotification();

            String EmailSubject = "Request Submitted DisbursementID#" + userData.DisbursementID;
            String EmailBody    = "<p> Dear " + userData.UserName + ",</p>";

            EmailBody += "<p>Your order is ready to deliver with Disbursement ID <b>" + userData.DisbursementID + "</b> for your reference.</p>";
            EmailBody += "<p>Collection Point will be <b>" + userData.CollectionPoint + "</b></p>";
            EmailBody += "<p>" + "OTP for loging into your account is here. <b> " + OTP + " </b>." +
                         " Please tell this OTP to verify your identity. " + " </p>";
            EmailBody += "<p>Thank you<br/>Logic University Staionery Store</p>";
            EmailBody += "<p> Please do not reply to this email it is auto-generated.</p>";
            send.SendEmailHTML(userData.EmailID, EmailSubject, EmailBody);


            int id = rd.DisbursementID;

            return(RedirectToAction("ViewDisbursementDetail/" + id));
        }
示例#19
0
        public Result <Success, Failure> Handle(SendEmailNotification input)
        {
            var messagetext        = string.Empty;
            var notificationStatus = NotificationStatus.Sent;

            foreach (var recipient in input.Recipients)
            {
                // новое уведомление в статуса New
                var notification = new Notification(
                    clienId: recipient.ClientId,
                    initiatorId: Guid.Empty,
                    communicationProviderId: Guid.Empty,
                    documentId: input.Body.DocumentId,
                    interactionId: input.InteractionId,
                    messageText: messagetext,
                    status: notificationStatus,
                    type: NotificationType.Email);

                // отправка уведомления
                _smsNotificationProvider.Send(notification);
            }

            return(new Result <Success, Failure>(new Success()));
        }
示例#20
0
        public ActionResult UpdateCP(string DepartmentID, string Collectionpoint)
        {
            bool res = Data_Department.UpdateCollectionPoint(DepartmentID, Collectionpoint);


            SendEmailNotification sen = new SendEmailNotification();

            Users userInfo = Data_Users.GetInfoByUserID((int)Session["UserID"]);

            Department department = Data_Department.GetDepartmentInfoByID(userInfo.DeptID_FK);

            Users ClerkInfo = Data_Users.GetStoreClerkInfo(userInfo.DeptID_FK);

            String EmailSubject = "Change Collection Point for " + department.Departmentname;
            String EmailBody    = "<p> Dear " + ClerkInfo.Username + ",</p>";

            EmailBody += "<p>I am " + userInfo.Username + " currently the  Department Representative for " + department.Departmentname + ". We are pleased to say that Collection point for <b>  " + department.Departmentname + "</b> is amended . The updatest collection point is  <b>" + Collectionpoint + ".</p>";
            EmailBody += "<p>Thank you<br/>Logic University Staionery Store</p>";
            EmailBody += "<p> Please do not reply to this email it is auto-generated.</p>";

            sen.SendEmailHTML(ClerkInfo.EmailID, EmailSubject, EmailBody);

            return(RedirectToAction("CollectionPoint"));
        }
示例#21
0
        private async Task SendAsyncInternal(EmailMessage message, string emailType, bool enableNotification)
        {
            if (enableNotification)
            {
                var notification = new SendEmailNotification(message.ToNotificationEmail(_globalSettings.Smtp?.From), emailType);
                await _eventAggregator.PublishAsync(notification);

                // if a handler handled sending the email then don't continue.
                if (notification.IsHandled)
                {
                    _logger.LogDebug("The email sending for {Subject} was handled by a notification handler", notification.Message.Subject);
                    return;
                }
            }

            if (!_globalSettings.IsSmtpServerConfigured && !_globalSettings.IsPickupDirectoryLocationConfigured)
            {
                _logger.LogDebug("Could not send email for {Subject}. It was not handled by a notification handler and there is no SMTP configured.", message.Subject);
                return;
            }

            if (_globalSettings.IsPickupDirectoryLocationConfigured && !string.IsNullOrWhiteSpace(_globalSettings.Smtp?.From))
            {
                // The following code snippet is the recommended way to handle PickupDirectoryLocation.
                // See more https://github.com/jstedfast/MailKit/blob/master/FAQ.md#q-how-can-i-send-email-to-a-specifiedpickupdirectory
                do
                {
                    var    path = Path.Combine(_globalSettings.Smtp?.PickupDirectoryLocation, Guid.NewGuid() + ".eml");
                    Stream stream;

                    try
                    {
                        stream = File.Open(path, FileMode.CreateNew);
                    }
                    catch (IOException)
                    {
                        if (File.Exists(path))
                        {
                            continue;
                        }
                        throw;
                    }

                    try {
                        using (stream)
                        {
                            using var filtered = new FilteredStream(stream);
                            filtered.Add(new SmtpDataFilter());

                            FormatOptions options = FormatOptions.Default.Clone();
                            options.NewLineFormat = NewLineFormat.Dos;

                            await message.ToMimeMessage(_globalSettings.Smtp?.From).WriteToAsync(options, filtered);

                            filtered.Flush();
                            return;
                        }
                    } catch {
                        File.Delete(path);
                        throw;
                    }
                } while (true);
            }

            using var client = new SmtpClient();

            await client.ConnectAsync(_globalSettings.Smtp.Host,
                                      _globalSettings.Smtp.Port,
                                      (MailKit.Security.SecureSocketOptions)(int) _globalSettings.Smtp.SecureSocketOptions);

            if (!string.IsNullOrWhiteSpace(_globalSettings.Smtp.Username) && !string.IsNullOrWhiteSpace(_globalSettings.Smtp.Password))
            {
                await client.AuthenticateAsync(_globalSettings.Smtp.Username, _globalSettings.Smtp.Password);
            }

            var mailMessage = message.ToMimeMessage(_globalSettings.Smtp.From);

            if (_globalSettings.Smtp.DeliveryMethod == SmtpDeliveryMethod.Network)
            {
                await client.SendAsync(mailMessage);
            }
            else
            {
                client.Send(mailMessage);
            }

            await client.DisconnectAsync(true);
        }
示例#22
0
        public string Serialise()
        {
            string recipientsXml = "";

            if (this.ToRecipients != null)
            {
                foreach (Guid id in this.ToRecipients)
                {
                    recipientsXml += ("<d:guid>" + id.ToString() + "</d:guid>");
                }
            }

            string ccRecipientsXml = "";

            if (this.CCRecipients != null)
            {
                foreach (Guid id in this.CCRecipients)
                {
                    ccRecipientsXml += ("<d:guid>" + id.ToString() + "</d:guid>");
                }
            }

            // Convert the fetchxml to a query expression
            return(String.Format("<request i:type=\"b:BulkDeleteRequest\" xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\" xmlns:b=\"http://schemas.microsoft.com/crm/2011/Contracts\">"
                                 + "        <a:Parameters xmlns:c=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">"
                                 + "          <a:KeyValuePairOfstringanyType>"
                                 + "            <c:key>QuerySet</c:key>"
                                 + "            <c:value i:type=\"a:ArrayOfQueryExpression\">"
                                 + "              <a:QueryExpression>"
                                 + QuerySet
                                 + "              </a:QueryExpression>"
                                 + "            </c:value>"
                                 + "          </a:KeyValuePairOfstringanyType>"
                                 + "          <a:KeyValuePairOfstringanyType>"
                                 + "            <c:key>JobName</c:key>"
                                 + "            <c:value i:type=\"d:string\" xmlns:d=\"http://www.w3.org/2001/XMLSchema\">" + JobName + "</c:value>"
                                 + "          </a:KeyValuePairOfstringanyType>"
                                 + "          <a:KeyValuePairOfstringanyType>"
                                 + "            <c:key>SendEmailNotification</c:key>"
                                 + "            <c:value i:type=\"d:boolean\" xmlns:d=\"http://www.w3.org/2001/XMLSchema\">" + SendEmailNotification.ToString() + "</c:value>"
                                 + "          </a:KeyValuePairOfstringanyType>"
                                 + "          <a:KeyValuePairOfstringanyType>"
                                 + "            <c:key>ToRecipients</c:key>"
                                 + "            <c:value i:type=\"d:ArrayOfguid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">"
                                 + recipientsXml
                                 + "            </c:value>"
                                 + "          </a:KeyValuePairOfstringanyType>"
                                 + "          <a:KeyValuePairOfstringanyType>"
                                 + "            <c:key>CCRecipients</c:key>"
                                 + "            <c:value i:type=\"d:ArrayOfguid\" xmlns:d=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">"
                                 + ccRecipientsXml
                                 + "            </c:value>"
                                 + "          </a:KeyValuePairOfstringanyType>"
                                 + "          <a:KeyValuePairOfstringanyType>"
                                 + "            <c:key>RecurrencePattern</c:key>"
                                 + "            <c:value i:type=\"d:string\" xmlns:d=\"http://www.w3.org/2001/XMLSchema\" >" + RecurrencePattern + "</c:value>"
                                 + "          </a:KeyValuePairOfstringanyType>"
                                 + "          <a:KeyValuePairOfstringanyType>"
                                 + "            <c:key>StartDateTime</c:key>"
                                 + "            <c:value i:type=\"d:dateTime\" xmlns:d=\"http://www.w3.org/2001/XMLSchema\">" + DateTimeEx.ToXrmStringUTC(DateTimeEx.LocalTimeToUTCFromSettings(StartDateTime, OrganizationServiceProxy.GetUserSettings())) + "</c:value>"
                                 + "          </a:KeyValuePairOfstringanyType>"
                                 + "        </a:Parameters>"
                                 + "        <a:RequestId i:nil=\"true\" />"
                                 + "        <a:RequestName>BulkDelete</a:RequestName>"
                                 + "      </request>"));
        }