public List <dynamic> SendEmail(EmailFormatDTO emailFormatDTO)
        {
            EmailTemplate  emailTemplate      = new EmailTemplate();
            List <dynamic> objGetOrderDetails = new List <dynamic>();
            List <dynamic> objDynamic         = new List <dynamic>();

            objGetOrderDetails = GetOrderDetails(SecurityHelper.Decrypt(emailFormatDTO.strOrderID, false));
            string AprEmail = string.Empty, AprName = string.Empty, SupportingEmail = string.Empty;

            emailFormatDTO.ReferenceNo = objGetOrderDetails[0][0].ReferenceNo;
            emailFormatDTO.Status      = objGetOrderDetails[0][0].StatusID;
            emailFormatDTO.FirstName   = objGetOrderDetails[0][0].FirstName;
            emailFormatDTO.LastName    = objGetOrderDetails[0][0].LastName;
            emailFormatDTO.CreatedBy   = objGetOrderDetails[0][0].UserName;
            emailFormatDTO.AddOffice   = objGetOrderDetails[0][0].Department;
            emailFormatDTO.UserId      = 0;
            List <OrderSupportingEmail> OrderSupportingEmail = objGetOrderDetails[11];

            for (int i = 0; i < OrderSupportingEmail.Count; i++)
            {
                if (OrderSupportingEmail.Count == 1)
                {
                    SupportingEmail = OrderSupportingEmail[i].email;
                }
                else
                {
                    SupportingEmail = SupportingEmail + "," + OrderSupportingEmail[i].email;
                }
            }
            if (OrderSupportingEmail.Count > 1)
            {
                SupportingEmail = SupportingEmail.Substring(1);
            }
            emailFormatDTO.To = SupportingEmail;
            emailTemplate.ContactInfo(emailFormatDTO);
            objDynamic.Add(0);
            return(objDynamic);
        }
        public List <dynamic> SaveConfirmOrder(SaveOrder SaveOrder)
        {
            List <dynamic> objDynamic = new List <dynamic>();

            Int64 intOrderID = 0, intCustomerID = 0, intUserID = 0, intConfirmOrderID = 0;

            try
            {
                if (!string.IsNullOrEmpty(SaveOrder.strorderID))
                {
                    intOrderID = Convert.ToInt64(SaveOrder.strorderID);
                }
                if (!string.IsNullOrEmpty(SaveOrder.strCustId))
                {
                    intCustomerID = Convert.ToInt64(SaveOrder.strCustId);
                }
                if (!string.IsNullOrEmpty(UserID))
                {
                    intUserID = Convert.ToInt64(UserID);
                }
                intConfirmOrderID = orddata.AddConfirmOrderDetail(intOrderID, intCustomerID, intUserID, SaveOrder.type);

                string strencOrderID = securityHelper.Encrypt(intConfirmOrderID.ToString(), false);
                objDynamic.Add(strencOrderID);
                objDynamic.Add(custOrderData.GetCustOrderDetailList(intConfirmOrderID));
                if (true)
                {
                }
                EmailTemplate  emailTemplate  = new EmailTemplate();
                EmailFormatDTO emailFormatDTO = GetEmailDetails(intConfirmOrderID.ToString(), string.Empty, string.Empty);
            }
            catch (Exception ex)
            {
            }
            return(objDynamic);
        }
        public EmailFormatDTO GetEmailDetails(String OrderID, String EmailID, String Status)
        {
            EmailFormatDTO emailFormatDTO     = new EmailFormatDTO();
            EmailTemplate  emailTemplate      = new EmailTemplate();
            List <dynamic> objGetOrderDetails = new List <dynamic>();

            try
            {
                objGetOrderDetails = orderApprovalData.GetOrderDetails(OrderID);
                string AprEmail = string.Empty, AprName = string.Empty, SupportingEmail = string.Empty;
                emailFormatDTO.ReferenceNo = objGetOrderDetails[0][0].ReferenceNo;
                emailFormatDTO.Status      = objGetOrderDetails[0][0].StatusID;
                emailFormatDTO.FirstName   = objGetOrderDetails[0][0].FirstName;
                emailFormatDTO.LastName    = objGetOrderDetails[0][0].LastName;
                emailFormatDTO.CreatedBy   = objGetOrderDetails[0][0].UserName;
                emailFormatDTO.AddOffice   = objGetOrderDetails[0][0].Department;
                emailFormatDTO.UserId      = Convert.ToInt64(UserID);
                emailFormatDTO.OrderId     = Convert.ToInt64(OrderID);
                List <ApproverDetails> ApproverDetails = objGetOrderDetails[1];
                for (int i = 0; i < ApproverDetails.Count; i++)
                {
                    if (!string.IsNullOrEmpty(ApproverDetails[i].AprEmail))
                    {
                        if (ApproverDetails.Count == 1)
                        {
                            AprEmail = ApproverDetails[i].AprEmail;
                            AprName  = ApproverDetails[i].AprName;
                        }
                        else
                        {
                            AprEmail = AprEmail + ";" + ApproverDetails[i].AprEmail;
                            AprName  = AprEmail + " And   " + ApproverDetails[i].AprName;
                        }
                    }
                }
                emailFormatDTO.ApprovedBy = AprName;

                if (objGetOrderDetails[11] != null)
                {
                    List <OrderSupportingEmail> OrderSupportingEmail = objGetOrderDetails[11];

                    for (int i = 0; i < OrderSupportingEmail.Count; i++)
                    {
                        if (OrderSupportingEmail.Count == 1)
                        {
                            SupportingEmail = OrderSupportingEmail[i].email;
                        }
                        else
                        {
                            SupportingEmail = SupportingEmail + "," + OrderSupportingEmail[i].email;
                        }
                    }
                    if (OrderSupportingEmail.Count > 1)
                    {
                        SupportingEmail = SupportingEmail.Substring(1);
                    }
                    //  emailFormatDTO.CC = SupportingEmail;
                }


                Int64 instatus = 0;
                if (!string.IsNullOrEmpty(Status))
                {
                    instatus = Convert.ToInt64(Status);
                }
                else
                {
                    instatus = emailFormatDTO.Status;
                }
                switch (instatus)
                {
                case 1:
                {
                    emailFormatDTO.To = objGetOrderDetails[0][0].UserName;
                    emailFormatDTO.CC = SupportingEmail;
                    emailTemplate.NewOrder(emailFormatDTO);
                    break;
                }

                case 2:
                {
                    emailFormatDTO.To = objGetOrderDetails[0][0].UserName;
                    emailFormatDTO.CC = SupportingEmail;
                    emailTemplate.QuoteRequired(emailFormatDTO);
                    break;
                }

                case 6:
                {
                    for (int i = 0; i < ApproverDetails.Count; i++)
                    {
                        if (!string.IsNullOrEmpty(ApproverDetails[i].AprEmail))
                        {
                            emailFormatDTO.EncOrderApproverNo = securityHelper.Encrypt(ApproverDetails[i].OAID.ToString(), true);

                            emailFormatDTO.EncOrderNo = securityHelper.Encrypt(OrderID, true);
                            emailTemplate.RequestsApproval(emailFormatDTO);
                        }
                    }


                    break;
                }

                case 8:
                {
                    emailFormatDTO.To = objGetOrderDetails[0][0].UserName;
                    emailFormatDTO.CC = SupportingEmail;
                    emailTemplate.RequestApproved(emailFormatDTO);
                    break;
                }

                case 9:
                {
                    emailFormatDTO.To = objGetOrderDetails[0][0].UserName;
                    emailFormatDTO.CC = SupportingEmail;
                    emailTemplate.RequestDenied(emailFormatDTO);
                    break;
                }

                case 10:
                {
                    emailFormatDTO.To = objGetOrderDetails[0][0].UserName;
                    emailTemplate.ReviewingOrder(emailFormatDTO);
                    break;
                }

                case 99:
                {
                    emailFormatDTO.To = EmailID;
                    emailTemplate.ShipOrderOrder(emailFormatDTO);
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                log.logErrorMessage("CustRequestData.GetEmailDetails");
                log.logErrorMessage(ex.StackTrace);
            }


            return(emailFormatDTO);
        }
        public EmailFormatDTO GetEmailDetails(String OrderID)
        {
            EmailFormatDTO emailFormatDTO     = new EmailFormatDTO();
            EmailTemplate  emailTemplate      = new EmailTemplate();
            List <dynamic> objGetOrderDetails = new List <dynamic>();

            objGetOrderDetails = GetOrderDetails(OrderID);
            string AprEmail = string.Empty, AprName = string.Empty, SupportingEmail = string.Empty;

            emailFormatDTO.ReferenceNo = objGetOrderDetails[0][0].ReferenceNo;
            emailFormatDTO.Status      = objGetOrderDetails[0][0].StatusID;
            emailFormatDTO.FirstName   = objGetOrderDetails[0][0].FirstName;
            emailFormatDTO.LastName    = objGetOrderDetails[0][0].LastName;
            emailFormatDTO.CreatedBy   = objGetOrderDetails[0][0].UserName;
            emailFormatDTO.AddOffice   = objGetOrderDetails[0][0].Department;
            emailFormatDTO.EncOrderNo  = SecurityHelper.Encrypt(OrderID, false);
            emailFormatDTO.OrderId     = Convert.ToInt64(OrderID);
            List <ApproverDetails> ApproverDetails = objGetOrderDetails[1];

            for (int i = 0; i < ApproverDetails.Count; i++)
            {
                if (!string.IsNullOrEmpty(ApproverDetails[i].AprEmail))
                {
                    if (ApproverDetails.Count == 1)
                    {
                        AprEmail = ApproverDetails[i].AprEmail;
                        AprName  = ApproverDetails[i].AprName;
                    }
                    else
                    {
                        AprEmail = AprEmail + "," + ApproverDetails[i].AprEmail;
                        AprName  = AprEmail + " And   " + ApproverDetails[i].AprName;
                    }
                }
            }
            emailFormatDTO.ApprovedBy = AprName;
            if (!string.IsNullOrEmpty(AprEmail))
            {
                emailFormatDTO.To = objGetOrderDetails[0][0].UserName + "," + AprEmail;
            }
            else
            {
                emailFormatDTO.To = objGetOrderDetails[0][0].UserName;
            }

            List <OrderSupportingEmail> OrderSupportingEmail = objGetOrderDetails[11];

            ;
            for (int i = 0; i < OrderSupportingEmail.Count; i++)
            {
                if (OrderSupportingEmail.Count == 1)
                {
                    SupportingEmail = OrderSupportingEmail[i].email;
                }
                else
                {
                    SupportingEmail = SupportingEmail + "," + OrderSupportingEmail[i].email;
                }
            }
            if (OrderSupportingEmail.Count > 1)
            {
                SupportingEmail = SupportingEmail.Substring(1);
            }
            //  emailFormatDTO.CC = SupportingEmail;
            switch (emailFormatDTO.Status)
            {
            case 1:
            {
                emailTemplate.NewOrder(emailFormatDTO);
                break;
            }

            case 2:
            {
                emailTemplate.QuoteRequired(emailFormatDTO);
                break;
            }

            case 6:
            {
                emailTemplate.RequestsApproval(emailFormatDTO);
                break;
            }

            case 8:
            {
                emailFormatDTO.To = objGetOrderDetails[0][0].UserName;
                emailFormatDTO.CC = SupportingEmail;
                emailTemplate.RequestApproved(emailFormatDTO);
                break;
            }

            case 9:
            {
                emailFormatDTO.To = objGetOrderDetails[0][0].UserName;
                emailFormatDTO.CC = SupportingEmail;
                emailTemplate.RequestDenied(emailFormatDTO);
                break;
            }
            }

            return(emailFormatDTO);
        }