示例#1
0
        public IHttpActionResult PutAdminContact(int id, AdminContact adminContact)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != adminContact.ID)
            {
                return(BadRequest());
            }

            db.Entry(adminContact).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AdminContactExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            AdminContact adminContact = db.AdminContacts.Find(id);

            db.AdminContacts.Remove(adminContact);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            AdminContact adminContact = await db.AdminContacts.FindAsync(id);

            db.AdminContacts.Remove(adminContact);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,Email,Titile,Message")] AdminContact adminContact)
 {
     if (ModelState.IsValid)
     {
         db.Entry(adminContact).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(adminContact));
 }
示例#5
0
        public IHttpActionResult GetAdminContact(int id)
        {
            AdminContact adminContact = db.AdminContacts.Find(id);

            if (adminContact == null)
            {
                return(NotFound());
            }

            return(Ok(adminContact));
        }
        public async Task <ActionResult> Create([Bind(Include = "ID,Email,Title,Message")] AdminContact adminContact)
        {
            if (ModelState.IsValid)
            {
                db.AdminContacts.Add(adminContact);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(adminContact));
        }
        public ActionResult Create([Bind(Include = "ID,Email,Titile,Message")] AdminContact adminContact)
        {
            if (ModelState.IsValid)
            {
                ViewBag.msg1 = "Your message has been delivered!";
                db.AdminContacts.Add(adminContact);
                db.SaveChanges();
                return(View());
            }

            return(View(adminContact));
        }
示例#8
0
        public IHttpActionResult PostAdminContact(AdminContact adminContact)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.AdminContacts.Add(adminContact);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = adminContact.ID }, adminContact));
        }
        // GET: AdminContacts/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AdminContact adminContact = await db.AdminContacts.FindAsync(id);

            if (adminContact == null)
            {
                return(HttpNotFound());
            }
            return(View(adminContact));
        }
示例#10
0
        // GET: AdminContacts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AdminContact adminContact = db.AdminContacts.Find(id);

            if (adminContact == null)
            {
                return(HttpNotFound());
            }
            return(View(adminContact));
        }
示例#11
0
        public IHttpActionResult DeleteAdminContact(int id)
        {
            AdminContact adminContact = db.AdminContacts.Find(id);

            if (adminContact == null)
            {
                return(NotFound());
            }

            db.AdminContacts.Remove(adminContact);
            db.SaveChanges();

            return(Ok(adminContact));
        }
示例#12
0
        private static void ParseRecievedOrder(out Dictionary<string, string> returnValues, out bool isCancelled, string strippedText, out List<OrderItem> orderItems, out bool hasMultipleOrderes, out List<MultipleOrder> multipleOrderList, out List<SalesContact> salesContacts, out List<AdminContact> adminContacts)
        {
            returnValues = new Dictionary<string, string>();
            orderItems = new List<OrderItem>();
            multipleOrderList = new List<MultipleOrder>();
            string preCustomerName = "Campaign Track     (http://www.campaigntrack.com.au) This is an order notification from ";
            string customerName = "";
            string companyName = "";
            string propertyAddress = "";
            string propertyId = "";
            string orderId = "";
            string supplier = "";
            string productDescription = "";
            string requiredDate = "";
            string postCustomerName = "Relating to campaign:";
            string postPropertyAddress = " Property ID:";
            string postPropertyId = " OrderItem:";
            string postOrderId = " Sales contacts:";
            string postSalesContact = " Admin contact:";
            string postAdminContact = " Supplier:";
            string postSupplier = " Description of product/service being ordered:";
            string postProductDescription = " Required on ";
            string postRequiredDate = " Client Price Cost Price ";
            string postOrderDetails = " Click here to view your order.";

            string cancelPreCustomerCompanyName = "Campaign Track     (http://www.campaigntrack.com.au) The order listed below was cancelled by ";
            string cancelPostPropertyAddress = " Description of product/service being cancelled:";
            string tempString = string.Empty;

            isCancelled = false;

            strippedText = strippedText.Replace("\n", "");

            if (strippedText.Contains("The order listed below was cancelled"))
            {
                isCancelled = true;
                hasMultipleOrderes = false;
                salesContacts = new List<SalesContact>();
                adminContacts = new List<AdminContact>();

                tempString = GetTempString(cancelPreCustomerCompanyName, postCustomerName, strippedText);
                //remove this from actula text
                strippedText.Replace(tempString, "");
                tempString = tempString.Replace(cancelPreCustomerCompanyName, "");

                //get Customer and company name
                customerName = tempString.Replace(" at ", ",").Split(',')[0];
                returnValues.Add("CustomerName", customerName);
                companyName = tempString.Replace(" at ", ",").Split(',')[1];
                returnValues.Add("CompanyName", companyName);

                //get Property Address
                tempString = GetTempString(postCustomerName, cancelPostPropertyAddress, strippedText);
                strippedText.Replace(tempString, "");
                propertyAddress = tempString.Replace(postCustomerName, "");
                returnValues.Add("PropertyAddress", propertyAddress);

                //Product Description
                tempString = GetTempString(cancelPostPropertyAddress, postProductDescription, strippedText);
                strippedText.Replace(tempString, "");
                productDescription = tempString.Replace(cancelPostPropertyAddress, "");
                returnValues.Add("ProductDescription", productDescription);

                //Required Date
                tempString = GetTempString(postProductDescription, postRequiredDate, strippedText);
                strippedText.Replace(tempString, "");
                requiredDate = tempString.Replace(postProductDescription, "").Trim();
                if (requiredDate.Contains(" "))
                {
                    var test = requiredDate.Split(' ');
                    DateTime testdate = new DateTime();
                    if (DateTime.TryParse(test[0].ToString(), out testdate))
                        returnValues.Add("RequiredDate", test[0].ToString());
                }
                else
                {
                    returnValues.Add("RequiredDate", requiredDate);
                }
                return;
            }

            //get customer and company information
            tempString = GetTempString(preCustomerName, postCustomerName, strippedText);
            //remove this from actula text
            strippedText.Replace(tempString, "");
            tempString = tempString.Replace(preCustomerName, "");
            //get Customer and company name
            customerName = tempString.Replace(" at ", ",").Split(',')[0];
            returnValues.Add("CustomerName", customerName);
            companyName = tempString.Replace(" at ", ",").Split(',')[1];
            returnValues.Add("CompanyName", companyName);

            //get Property Address
            tempString = GetTempString(postCustomerName, postPropertyAddress, strippedText);
            strippedText.Replace(tempString, "");
            propertyAddress = tempString.Replace(postCustomerName, "");
            returnValues.Add("PropertyAddress", propertyAddress);

            //get Property ID
            tempString = GetTempString(postPropertyAddress, postPropertyId, strippedText);
            strippedText.Replace(tempString, "");
            propertyId = tempString.Replace(postPropertyAddress, "");
            returnValues.Add("PropertyId", propertyId);

            //get Order Id
            tempString = GetTempString(postPropertyId, postOrderId, strippedText);
            strippedText.Replace(tempString, "");
            hasMultipleOrderes = false;
            List<string> orderIds = new List<string>();
            if (tempString.Contains(","))
            {
                hasMultipleOrderes = true;
                tempString = tempString.Replace(postPropertyId, "").Trim();
                orderIds = tempString.Split(',').ToList();
            }
            else
            {
                orderId = tempString.Replace(postPropertyId, "");
            }

            returnValues.Add("OrderId", orderId);

            //get sales Contact
            tempString = GetTempString(postOrderId, postSalesContact, strippedText);
            strippedText.Replace(tempString, "");
            tempString = tempString.Replace(postPropertyId, "");
            salesContacts = new List<SalesContact>();
            if (tempString.Contains(","))
            {
                var list = tempString.Split(',').ToList();
                foreach (var contact in list)
                {
                    string tempContact = contact;
                    if (tempContact.Contains(postPropertyId))
                    {
                        tempContact = tempContact.Replace(postOrderId, "");
                    }
                    string salesExecutiveName = tempContact.Substring(0, tempContact.IndexOf(" on "));
                    string salesContactNumber1 = tempContact.Substring(tempContact.IndexOf(" on "), tempContact.IndexOf(" or") - tempContact.IndexOf(" on ")).Replace(" on ", "");
                    string salesContactNumber2 = tempContact.Substring(tempContact.IndexOf(" or"), tempContact.Length - tempContact.IndexOf(" or")).Replace(" or", "");
                    SalesContact salesContact = new SalesContact { SalesContactName = salesExecutiveName, SalesContactNumber1 = salesContactNumber1, SalesContactNumber2 = salesContactNumber2 };
                    salesContacts.Add(salesContact);
                }
            }
            else
            {
                string tempContact = tempString;
                if (tempContact.Contains(postPropertyId))
                {
                    tempContact = tempContact.Replace(postOrderId, "");
                }
                string salesExecutiveName = tempContact.Substring(0, tempContact.IndexOf(" on "));
                string salesContactNumber1 = tempContact.Substring(tempContact.IndexOf(" on "), tempContact.IndexOf(" or ") - tempContact.IndexOf(" on ")).Replace(" on ", "");
                string salesContactNumber2 = tempContact.Substring(tempContact.IndexOf(" or "), tempContact.Length - tempContact.IndexOf(" or ")).Replace(" or ", "");
                SalesContact salesContact = new SalesContact { SalesContactName = salesExecutiveName, SalesContactNumber1 = salesContactNumber1, SalesContactNumber2 = salesContactNumber2 };
                salesContacts.Add(salesContact);
            }

            strippedText.Replace(tempString, "");

            //get admin Contact
            tempString = GetTempString(postSalesContact, postAdminContact, strippedText);
            strippedText.Replace(tempString, "");
            tempString = tempString.Replace(postPropertyId, "");
            adminContacts = new List<AdminContact>();
            if (tempString.Contains(","))
            {
                var list = tempString.Split(',').ToList();
                foreach (var contact in list)
                {
                    string tempContact = contact;
                    if (tempContact.Contains(postSalesContact))
                    {
                        tempContact = tempContact.Replace(postSalesContact, "");
                    }
                    string adminName = tempContact.Substring(0, tempContact.IndexOf(" on "));
                    string adminEmail = tempContact.Substring(tempContact.IndexOf(" on "), tempContact.IndexOf(" or") - tempContact.IndexOf(" on ")).Replace(" on ", "");
                    string adminPhone = tempContact.Substring(tempContact.IndexOf(" or"), tempContact.Length - tempContact.IndexOf(" or")).Replace(" or", "");
                    AdminContact adminContact = new AdminContact { Name = adminName, Email = adminEmail, Phone = adminPhone };
                    adminContacts.Add(adminContact);
                }
            }
            else
            {
                string tempContact = tempString;
                if (tempContact.Contains(postSalesContact))
                {
                    tempContact = tempContact.Replace(postSalesContact, "");
                }
                string adminName = tempContact.Substring(0, tempContact.IndexOf(" on "));
                string adminPhone = tempContact.Substring(tempContact.IndexOf(" on "), tempContact.IndexOf(" or") - tempContact.IndexOf(" on ")).Replace(" on ", "");
                string adminEmail = tempContact.Substring(tempContact.IndexOf(" or"), tempContact.Length - tempContact.IndexOf(" or")).Replace(" or", "");
                AdminContact adminContact = new AdminContact { Name = adminName.Trim(), Email = adminEmail.Trim(), Phone = adminPhone.Trim() };
                adminContacts.Add(adminContact);
            }

            strippedText.Replace(tempString, "");

            //Sapplier Details
            tempString = GetTempString(postAdminContact, postSupplier, strippedText);
            strippedText.Replace(tempString, "");
            supplier = tempString.Replace(postAdminContact, "");
            returnValues.Add("Supplier", supplier);

            if (hasMultipleOrderes)
            {
                multipleOrderList = new List<MultipleOrder>();
                for (int ord = 0; ord < orderIds.Count; ord++)
                {
                    List<OrderItem> multipleOrderItems = new List<OrderItem>();
                    //Product Description
                    tempString = GetTempString(postSupplier, postProductDescription, strippedText);
                    strippedText.Replace(tempString, "");
                    productDescription = tempString.Replace(postSupplier, "");
                    //returnValues.Add("ProductDescription", productDescription);

                    //Required Date
                    tempString = GetTempString(postProductDescription, postRequiredDate, strippedText);
                    strippedText.Replace(tempString, "");
                    requiredDate = tempString.Replace(postProductDescription, "");
                    //returnValues.Add("RequiredDate", requiredDate);

                    //Order details
                    tempString = GetTempString(postRequiredDate, postOrderDetails, strippedText);
                    strippedText.Replace(tempString, "");
                    string tempOrderDetails = tempString.Replace(postRequiredDate, "");
                    var tempOrderItems = tempOrderDetails.Substring(0, tempOrderDetails.IndexOf(" Total ")).Split('$').ToList();
                    List<string> tempOrderItemReplace = new List<string>();
                    int count = tempOrderItems.Count();
                    if (count > 3)
                    {
                        for (int x = 0; x < count; x++)
                        {
                            if (x % 2 == 0 && x != 0)
                            {
                                decimal tempValue;
                                if (!Decimal.TryParse(tempOrderItems.ElementAt(x), out tempValue))
                                {
                                    var tempListValue = tempOrderItems.ElementAt(x);
                                    string tempValueofDecimal = tempListValue.Substring(0, tempListValue.IndexOf(" "));
                                    string tempItemDescription = tempListValue.Replace(tempValueofDecimal, "");
                                    tempOrderItems.Insert(x, tempValueofDecimal);
                                    tempOrderItems.RemoveAt(x + 1);
                                    tempOrderItems.Insert(x + 1, tempItemDescription.Trim());
                                }
                            }
                        }
                    }

                    int i = 1;

                    OrderItem orderItem = new OrderItem();
                    foreach (var value in tempOrderItems)
                    {
                        if (i == 1)
                        {
                            orderItem.Name = value;
                        }
                        else if (i == 2)
                        {
                            orderItem.ClientPrice = value;
                        }
                        else if (i == 3)
                        {
                            orderItem.CostPrice = value;
                            multipleOrderItems.Add(orderItem);
                            orderItem = new OrderItem();
                            i = 0;
                        }
                        i++;
                    }

                    MultipleOrder multOrder = new MultipleOrder { OrderId = orderIds.ToArray()[ord], ProductDescription = productDescription, RequiredDate = requiredDate, OrderItems = multipleOrderItems };
                    multipleOrderList.Add(multOrder);
                }
            }
            else
            {
                //Product Description
                tempString = GetTempString(postSupplier, postProductDescription, strippedText);
                strippedText.Replace(tempString, "");
                productDescription = tempString.Replace(postSupplier, "");
                returnValues.Add("ProductDescription", productDescription);

                //Required Date
                tempString = GetTempString(postProductDescription, postRequiredDate, strippedText);
                strippedText.Replace(tempString, "");
                requiredDate = tempString.Replace(postProductDescription, "");
                returnValues.Add("RequiredDate", requiredDate);

                //Order details
                tempString = GetTempString(postRequiredDate, postOrderDetails, strippedText);
                strippedText.Replace(tempString, "");
                string tempOrderDetails = tempString.Replace(postRequiredDate, "");
                var tempOrderItems = tempOrderDetails.Substring(0, tempOrderDetails.IndexOf(" Total ")).Split('$').ToList();
                List<string> tempOrderItemReplace = new List<string>();
                int count = tempOrderItems.Count();
                if (count > 3)
                {
                    for (int x = 0; x < count; x++)
                    {
                        if (x % 2 == 0 && x != 0)
                        {
                            decimal tempValue;
                            if (!Decimal.TryParse(tempOrderItems.ElementAt(x), out tempValue))
                            {
                                var tempListValue = tempOrderItems.ElementAt(x);
                                string tempValueofDecimal = tempListValue.Substring(0, tempListValue.IndexOf(" "));
                                string tempItemDescription = tempListValue.Replace(tempValueofDecimal, "");
                                tempOrderItems.Insert(x, tempValueofDecimal);
                                tempOrderItems.RemoveAt(x + 1);
                                tempOrderItems.Insert(x + 1, tempItemDescription.Trim());
                            }
                        }
                    }
                }

                int i = 1;

                OrderItem orderItem = new OrderItem();
                foreach (var value in tempOrderItems)
                {
                    if (i == 1)
                    {
                        orderItem.Name = value;
                    }
                    else if (i == 2)
                    {
                        orderItem.ClientPrice = value;
                    }
                    else if (i == 3)
                    {
                        orderItem.CostPrice = value;
                        orderItems.Add(orderItem);
                        orderItem = new OrderItem();
                        i = 0;
                    }
                    i++;
                }
            }
        }
示例#13
0
        private static void ParseRecievedOrder(out Dictionary<string, string> returnValues, out bool isCancelled, string strippedText, out List<OrderItem> orderItems, out bool hasMultipleOrderes, out List<MultipleOrder> multipleOrderList, out List<SalesContact> salesContacts, out List<AdminContact> adminContacts)
        {
            isCompanyMail = false;
            returnValues = new Dictionary<string, string>();
            orderItems = new List<OrderItem>();
            multipleOrderList = new List<MultipleOrder>();
            // string preCustomerName = "Campaign Track     (http://www.campaigntrack.com.au) This is an order notification from ";
            string preCustomerName = "Campaign Track     (http://www.campaigntrack.com.au) This is an order notification from ";
            string preCustomerNameWithOutUrl = "Campaign Track  This is an order notification from ";
            string preCustomerNameForNewLitho = "New Litho   This is an order notification from ";
            string customerName = "";
            string companyName = "";
            string propertyAddress = "";
            string propertyId = "";
            string orderId = "";
            string supplier = "";
            string productDescription = "";
            string requiredDate = "";
            string postCustomerName = "Relating to campaign:";
            string postPropertyAddress = " Property ID:";
            string postPropertyId = " OrderItem:";
            string postOrderId = " Sales contacts:";
            string postSalesContact = " Admin contact:";
            string postAdminContact = " Supplier:";
            string postSupplier = " Description of product/service being ordered:";
            string postProductDescription = " Required on ";
            string postRequiredDate = " Client Price Cost Price ";
            string postOrderDetails = " Click here to view your order.";

            string cancelPreCustomerCompanyName = "Campaign Track     (http://www.campaigntrack.com.au) The order listed below was cancelled by ";

            string cancelPreCustomerCompanyNameWithOutUrl = "Campaign Track  The order listed below was cancelled by ";

            string cancelPostPropertyAddress = " Description of product/service being cancelled:";
            string tempString = string.Empty;

            isCancelled = false;

            strippedText = strippedText.Replace("\n", "");

            if (strippedText.Contains("The order listed below was cancelled"))
            {
                isCancelled = true;
                hasMultipleOrderes = false;
                salesContacts = new List<SalesContact>();
                adminContacts = new List<AdminContact>();

                bool match = false;
                match = ExactMatch(strippedText, cancelPreCustomerCompanyName);

                if (match)
                {
                    tempString = GetTempString(cancelPreCustomerCompanyName, postCustomerName, strippedText);
                    //remove this from actula text
                    strippedText.Replace(tempString, "");
                    tempString = tempString.Replace(cancelPreCustomerCompanyName, "");
                }

                else
                {

                    /////////////////////////////////

                    match = ExactMatch(strippedText, cancelPreCustomerCompanyNameWithOutUrl);

                    if (match)
                    {
                        tempString = GetTempString(cancelPreCustomerCompanyNameWithOutUrl, postCustomerName, strippedText);
                        //remove this from actula text
                        strippedText.Replace(tempString, "");
                        tempString = tempString.Replace(cancelPreCustomerCompanyNameWithOutUrl, "");
                    }

                    else
                    {
                        match = ExactMatch(strippedText, cancelPreCustomerCompanyNameWithOutUrl);

                        if (match)
                        {
                            tempString = GetTempString(cancelPreCustomerCompanyNameWithOutUrl, postCustomerName, strippedText);
                        }
                        else
                        {
                            // Remove Extra spaces from the string and check it again in the stripeed text
                            cancelPreCustomerCompanyNameWithOutUrl = RemoveExtraSpaces(cancelPreCustomerCompanyNameWithOutUrl);
                            tempString = GetTempString(cancelPreCustomerCompanyNameWithOutUrl, postCustomerName, strippedText);

                        }
                        //remove this from actula text
                        strippedText.Replace(tempString, "");
                        tempString = tempString.Replace(cancelPreCustomerCompanyNameWithOutUrl, "");
                    }

                    ////////////////////////////////  old one ///////////////////////

                    //match = ExactMatch(strippedText, cancelPreCustomerCompanyNameWithOutUrl);
                    //tempString = GetTempString(cancelPreCustomerCompanyNameWithOutUrl, postCustomerName, strippedText);
                    ////remove this from actula text
                    //strippedText.Replace(tempString, "");
                    //tempString = tempString.Replace(cancelPreCustomerCompanyNameWithOutUrl, "");

                    //////////////////////////////// End old one ///////////////////////
                }

                //get Customer and company name
                customerName = tempString.Replace(" at ", ",").Split(',')[0];
                returnValues.Add("CustomerName", customerName);
                companyName = tempString.Replace(" at ", ",").Split(',')[1];
                returnValues.Add("CompanyName", companyName);

                //get Property Address
                tempString = GetTempString(postCustomerName, cancelPostPropertyAddress, strippedText);
                strippedText.Replace(tempString, "");
                propertyAddress = tempString.Replace(postCustomerName, "");
                returnValues.Add("PropertyAddress", propertyAddress);

                //Product Description
                tempString = GetTempString(cancelPostPropertyAddress, postProductDescription, strippedText);
                strippedText.Replace(tempString, "");
                productDescription = tempString.Replace(cancelPostPropertyAddress, "");
                returnValues.Add("ProductDescription", productDescription);

                //Required Date
                tempString = GetTempString(postProductDescription, postRequiredDate, strippedText);
                strippedText.Replace(tempString, "");
                requiredDate = tempString.Replace(postProductDescription, "").Trim();
                if (requiredDate.Contains(" "))
                {
                    var test = requiredDate.Split(' ');
                    DateTime testdate = new DateTime();
                    if (DateTime.TryParse(test[0].ToString(), out testdate))
                        returnValues.Add("RequiredDate", test[0].ToString());

                    else
                    {
                        string dateString = "20/05/2015"; // <-- Valid
                        string format = "dd/mmm/yyyy";
                        DateTime dateTime;
                        if (DateTime.TryParseExact(test[0].ToString(), format, CultureInfo.InvariantCulture,
                            DateTimeStyles.None, out dateTime))
                        {
                            returnValues.Add("RequiredDate", test[0].ToString());
                        }

                    }
                }
                else
                {
                    returnValues.Add("RequiredDate", requiredDate);
                }
                return;
            }

            if (strippedText.StartsWith("New Litho"))
            {
                //get customer and company information
                tempString = GetTempString(preCustomerNameForNewLitho, postCustomerName, strippedText);
                //remove this from actula text
                strippedText.Replace(tempString, "");
                tempString = tempString.Replace(preCustomerNameForNewLitho, "");
                isCompanyMail = true;
            }

            else
            {
                //get customer and company information

                bool match = false;
                match = ExactMatch(strippedText, preCustomerName);

                if (match)
                {
                    tempString = GetTempString(preCustomerName, postCustomerName, strippedText);
                    //remove this from actula text
                    strippedText.Replace(tempString, "");
                    tempString = tempString.Replace(preCustomerName, "");
                }

                else
                {
                    match = ExactMatch(strippedText, preCustomerNameWithOutUrl);

                    if (match)
                    {
                        tempString = GetTempString(preCustomerNameWithOutUrl, postCustomerName, strippedText);
                    }
                    else
                    {
                        // Remove Extra spaces from the string and check it again in the stripeed text
                        preCustomerNameWithOutUrl = RemoveExtraSpaces(preCustomerNameWithOutUrl);
                        tempString = GetTempString(preCustomerNameWithOutUrl, postCustomerName, strippedText);

                    }
                    //remove this from actula text
                    strippedText.Replace(tempString, "");
                    tempString = tempString.Replace(preCustomerNameWithOutUrl, "");
                }
            }

            //get Customer and company name
            customerName = tempString.Replace(" at ", ",").Split(',')[0];
            returnValues.Add("CustomerName", customerName);
            companyName = tempString.Replace(" at ", ",").Split(',')[1];
            returnValues.Add("CompanyName", companyName);

            //get Property Address
            tempString = GetTempString(postCustomerName, postPropertyAddress, strippedText);
            strippedText.Replace(tempString, "");
            propertyAddress = tempString.Replace(postCustomerName, "");
            returnValues.Add("PropertyAddress", propertyAddress);

            //get Property ID
            tempString = GetTempString(postPropertyAddress, postPropertyId, strippedText);
            strippedText.Replace(tempString, "");
            propertyId = tempString.Replace(postPropertyAddress, "");
            returnValues.Add("PropertyId", propertyId);

            //get Order Id
            tempString = GetTempString(postPropertyId, postOrderId, strippedText);
            strippedText.Replace(tempString, "");
            hasMultipleOrderes = false;
            List<string> orderIds = new List<string>();
            if (tempString.Contains(","))
            {
                hasMultipleOrderes = true;
                tempString = tempString.Replace(postPropertyId, "").Trim();
                orderIds = tempString.Split(',').ToList();
            }
            else
            {
                orderId = tempString.Replace(postPropertyId, "");
            }

            returnValues.Add("OrderId", orderId);

            //get sales Contact
            tempString = GetTempString(postOrderId, postSalesContact, strippedText);
            strippedText.Replace(tempString, "");
            tempString = tempString.Replace(postOrderId, "");
            salesContacts = new List<SalesContact>();
            if (tempString.Contains(","))
            {
                var list = tempString.Split(',').ToList();
                foreach (var contact in list)
                {
                    string tempContact = contact;
                    if (tempContact.Contains(postOrderId))
                    {
                        tempContact = tempContact.Replace(postOrderId, "");
                    }
                    string salesExecutiveName = tempContact.Substring(0, tempContact.IndexOf(" on "));
                    string salesContactNumber1 = tempContact.Substring(tempContact.IndexOf(" on "), tempContact.IndexOf(" or") - tempContact.IndexOf(" on ")).Replace(" on ", "");
                    string salesContactNumber2 = tempContact.Substring(tempContact.IndexOf(" or"), tempContact.Length - tempContact.IndexOf(" or")).Replace(" or", "");
                    SalesContact salesContact = new SalesContact { SalesContactName = salesExecutiveName, SalesContactNumber1 = salesContactNumber1, SalesContactNumber2 = salesContactNumber2 };
                    salesContacts.Add(salesContact);
                }
            }
            else
            {
                string tempContact = tempString;
                if (tempContact.Contains(postOrderId))
                {
                    tempContact = tempContact.Replace(postOrderId, "");
                }
                string salesExecutiveName = tempContact.Substring(0, tempContact.IndexOf(" on "));
                string salesContactNumber1 = tempContact.Substring(tempContact.IndexOf(" on "), tempContact.IndexOf(" or ") - tempContact.IndexOf(" on ")).Replace(" on ", "");
                string salesContactNumber2 = tempContact.Substring(tempContact.IndexOf(" or "), tempContact.Length - tempContact.IndexOf(" or ")).Replace(" or ", "");
                SalesContact salesContact = new SalesContact { SalesContactName = salesExecutiveName, SalesContactNumber1 = salesContactNumber1, SalesContactNumber2 = salesContactNumber2 };
                salesContacts.Add(salesContact);
            }

            strippedText.Replace(tempString, "");

            //get admin Contact
            tempString = GetTempString(postSalesContact, postAdminContact, strippedText);
            strippedText.Replace(tempString, "");
            tempString = tempString.Replace(postPropertyId, "");
            adminContacts = new List<AdminContact>();
            if (tempString.Contains(","))
            {
                var list = tempString.Split(',').ToList();
                foreach (var contact in list)
                {
                    string tempContact = contact;
                    if (tempContact.Contains(postSalesContact))
                    {
                        tempContact = tempContact.Replace(postSalesContact, "");
                    }
                    string adminName = tempContact.Substring(0, tempContact.IndexOf(" on "));
                    string adminEmail = tempContact.Substring(tempContact.IndexOf(" on "), tempContact.IndexOf(" or") - tempContact.IndexOf(" on ")).Replace(" on ", "");
                    string adminPhone = tempContact.Substring(tempContact.IndexOf(" or"), tempContact.Length - tempContact.IndexOf(" or")).Replace(" or", "");
                    AdminContact adminContact = new AdminContact { Name = adminName, Email = adminEmail, Phone = adminPhone };
                    adminContacts.Add(adminContact);
                }
            }
            else
            {
                string tempContact = tempString;
                if (tempContact.Contains(postSalesContact))
                {
                    tempContact = tempContact.Replace(postSalesContact, "");
                }
                string adminName = tempContact.Substring(0, tempContact.IndexOf(" on "));
                string adminPhone = tempContact.Substring(tempContact.IndexOf(" on "), tempContact.IndexOf(" or") - tempContact.IndexOf(" on ")).Replace(" on ", "");
                string adminEmail = tempContact.Substring(tempContact.IndexOf(" or"), tempContact.Length - tempContact.IndexOf(" or")).Replace(" or", "");
                AdminContact adminContact = new AdminContact { Name = adminName.Trim(), Email = adminEmail.Trim(), Phone = adminPhone.Trim() };
                adminContacts.Add(adminContact);
            }

            strippedText.Replace(tempString, "");

            //Sapplier Details
            tempString = GetTempString(postAdminContact, postSupplier, strippedText);
            strippedText.Replace(tempString, "");
            supplier = tempString.Replace(postAdminContact, "");
            returnValues.Add("Supplier", supplier);

            if (hasMultipleOrderes)
            {
                multipleOrderList = new List<MultipleOrder>();
                for (int ord = 1; ord <= orderIds.Count; ord++)
                {
                    List<OrderItem> multipleOrderItems = new List<OrderItem>();
                    //Product Description
                    tempString = GetTempString(postSupplier, postProductDescription, strippedText);
                    strippedText = ReplaceFirst(strippedText, tempString, "");// strippedText.Replace(tempString, "");
                    productDescription = tempString.Replace(postSupplier, "");
                    //returnValues.Add("ProductDescription", productDescription);

                    //Required Date
                    tempString = GetTempString(postProductDescription, postRequiredDate, strippedText);
                    strippedText = ReplaceFirst(strippedText, tempString, ""); //strippedText.Replace(tempString, "");
                    requiredDate = tempString.Replace(postProductDescription, "");
                    //returnValues.Add("RequiredDate", requiredDate);
                    if (ord < orderIds.Count)
                    {
                        //Order details
                        tempString = GetTempString(postRequiredDate, postSupplier, strippedText);

                    }
                    else
                    {
                        tempString = GetTempString(postRequiredDate, postOrderDetails, strippedText);
                    }
                    strippedText = ReplaceFirst(strippedText, tempString, ""); //strippedText.Replace(tempString, "");
                    string tempOrderDetails = tempString.Replace(postRequiredDate, "");
                    var tempOrderItems = tempOrderDetails.Substring(0, tempOrderDetails.IndexOf(" Total ")).Split('$').ToList();
                    List<string> tempOrderItemReplace = new List<string>();
                    int count = tempOrderItems.Count();
                    if (count > 3)
                    {
                        for (int x = 0; x < count; x++)
                        {
                            if (x % 2 == 0 && x != 0)
                            {
                                decimal tempValue;
                                if (!Decimal.TryParse(tempOrderItems.ElementAt(x), out tempValue))
                                {
                                    var tempListValue = tempOrderItems.ElementAt(x);
                                    string tempValueofDecimal = tempListValue.Substring(0, tempListValue.IndexOf(" "));
                                    string tempItemDescription = tempListValue.Replace(tempValueofDecimal, "");
                                    tempOrderItems.Insert(x, tempValueofDecimal);
                                    tempOrderItems.RemoveAt(x + 1);
                                    tempOrderItems.Insert(x + 1, tempItemDescription.Trim());
                                }
                            }
                        }
                    }

                    int i = 1;

                    OrderItem orderItem = new OrderItem();
                    foreach (var value in tempOrderItems)
                    {
                        if (i == 1)
                        {
                            orderItem.Name = value;
                        }
                        else if (i == 2)
                        {
                            orderItem.ClientPrice = value;
                        }
                        else if (i == 3)
                        {
                            if (value.Equals("0.00 Supplier Instructions - Property Ready: Monday 29th JuneContact: Dom [email protected] 98324774Access: Via vendorVendor: Michael Kroger (contact Dom)Property: 4bed / 2.5bath house "))
                            {
                                string value1 = value.Replace(" Supplier Instructions - Property Ready: Monday 29th JuneContact: Dom [email protected] 98324774Access: Via vendorVendor: Michael Kroger (contact Dom)Property: 4bed / 2.5bath house ", string.Empty);
                                orderItem.CostPrice = value1;
                            }
                            else
                            {
                                orderItem.CostPrice = value;
                            }

                            multipleOrderItems.Add(orderItem);
                            orderItem = new OrderItem();
                            i = 0;
                        }
                        i++;
                    }

                    MultipleOrder multOrder = new MultipleOrder { OrderId = orderIds.ToArray()[ord - 1], ProductDescription = productDescription, RequiredDate = requiredDate, OrderItems = multipleOrderItems };
                    multipleOrderList.Add(multOrder);
                }
            }
            else
            {
                //Product Description
                tempString = GetTempString(postSupplier, postProductDescription, strippedText);
                strippedText.Replace(tempString, "");
                productDescription = tempString.Replace(postSupplier, "");
                returnValues.Add("ProductDescription", productDescription);

                //Required Date
                tempString = GetTempString(postProductDescription, postRequiredDate, strippedText);
                strippedText.Replace(tempString, "");
                requiredDate = tempString.Replace(postProductDescription, "");
                returnValues.Add("RequiredDate", requiredDate);

                //Order details
                tempString = GetTempString(postRequiredDate, postOrderDetails, strippedText);
                strippedText.Replace(tempString, "");
                string tempOrderDetails = tempString.Replace(postRequiredDate, "");

                //var dollorCount = tempOrderDetails.ToArray().Where(x => x == '$').Count();

                ////decimal test3 = dollorCount/2;
                ////int test2=0;
                //if (dollorCount % 2 !=0)
                //{
                //    int dollorIndex= tempOrderDetails.IndexOf('$');
                //    tempOrderDetails = tempOrderDetails.Remove(dollorIndex,1);

                //}

                tempOrderDetails = tempOrderDetails.Replace("$54.00 incl GST", "54.00 incl GST");

                tempOrderDetails = tempOrderDetails.Replace("Adjustment: Supplier - As per Jess B $175.00 $2.30 $2.30 ", string.Empty);

                // replace the content as this is not a part of order - row_id- 2071

                var tempOrderItems = tempOrderDetails.Substring(0, tempOrderDetails.IndexOf(" Total ")).Split('$').ToList();
                List<string> tempOrderItemReplace = new List<string>();
                int count = tempOrderItems.Count();
                if (count > 2)
                {
                    decimal test;
                    if (!Decimal.TryParse(tempOrderItems[2], out test))
                    {
                        var testpriceIssue = tempOrderItems[2].Split(' ');
                        tempOrderItems.Insert(2, testpriceIssue[0].Trim());
                        tempOrderItems[3] = tempOrderItems[3].Replace(testpriceIssue[0].Trim(), string.Empty);
                    }
                    if (tempOrderItems.Count > 5)
                    {
                        if (!Decimal.TryParse(tempOrderItems[5], out test))
                        {
                            var testpriceIssue = tempOrderItems[5].Split(' ');
                            tempOrderItems.Insert(5, testpriceIssue[0].Trim());
                            tempOrderItems[6] = tempOrderItems[6].Replace(testpriceIssue[0].Trim(), string.Empty);
                        }
                    }
                    if (tempOrderItems.Count > 8)
                    {
                        if (!Decimal.TryParse(tempOrderItems[8], out test))
                        {
                            var testpriceIssue = tempOrderItems[8].Split(' ');
                            tempOrderItems.Insert(8, testpriceIssue[0].Trim());
                            tempOrderItems[9] = tempOrderItems[9].Replace(testpriceIssue[0].Trim(), string.Empty);
                        }
                    }
                    if (tempOrderItems.Count > 11)
                    {
                        if (!Decimal.TryParse(tempOrderItems[11], out test))
                        {
                            var testpriceIssue = tempOrderItems[11].Split(' ');
                            tempOrderItems.Insert(11, testpriceIssue[0].Trim());
                            tempOrderItems[12] = tempOrderItems[12].Replace(testpriceIssue[0].Trim(), string.Empty);
                        }
                    }
                    if (tempOrderItems.Count > 14)
                    {
                        if (!Decimal.TryParse(tempOrderItems[14], out test))
                        {
                            var testpriceIssue = tempOrderItems[14].Split(' ');
                            tempOrderItems.Insert(14, testpriceIssue[0]);
                            tempOrderItems[15] = tempOrderItems[15].Replace(testpriceIssue[0], string.Empty);
                        }
                    }
                    if (tempOrderItems.Count > 17)
                    {
                        if (!Decimal.TryParse(tempOrderItems[17], out test))
                        {
                            var testpriceIssue = tempOrderItems[17].Split(' ');
                            tempOrderItems.Insert(17, testpriceIssue[0]);
                            tempOrderItems[18] = tempOrderItems[18].Replace(testpriceIssue[0], string.Empty);
                        }
                    }
                    if (tempOrderItems.Count > 20)
                    {
                        if (!Decimal.TryParse(tempOrderItems[20], out test))
                        {
                            var testpriceIssue = tempOrderItems[20].Split(' ');
                            tempOrderItems.Insert(20, testpriceIssue[0]);
                            tempOrderItems[21] = tempOrderItems[21].Replace(testpriceIssue[0], string.Empty);
                        }
                    }
                    if (tempOrderItems.Count > 23)
                    {
                        if (!Decimal.TryParse(tempOrderItems[23], out test))
                        {
                            var testpriceIssue = tempOrderItems[23].Split(' ');
                            tempOrderItems.Insert(23, testpriceIssue[0]);
                            tempOrderItems[24] = tempOrderItems[24].Replace(testpriceIssue[0], string.Empty);
                        }
                    }
                    if (tempOrderItems.Count > 26)
                    {
                        if (!Decimal.TryParse(tempOrderItems[26], out test))
                        {
                            var testpriceIssue = tempOrderItems[26].Split(' ');
                            tempOrderItems.Insert(26, testpriceIssue[0]);
                            tempOrderItems[27] = tempOrderItems[27].Replace(testpriceIssue[0], string.Empty);
                        }
                    }
                    //if (!Decimal.TryParse(tempOrderItems[9], out test))
                    //{
                    //    var testpriceIssue = tempOrderItems[9].Split(' ');
                    //    tempOrderItems.Insert(9, testpriceIssue[0]);
                    //}
                    //for (int x = 0; x < count; x++)
                    //{
                    //    if (x % 2 == 0 && x != 0)
                    //    {
                    //        decimal tempValue;
                    //        if (!Decimal.TryParse(tempOrderItems.ElementAt(x).Trim(), out tempValue))
                    //        {
                    //            var tempListValue = tempOrderItems.ElementAt(x).Trim();
                    //            string tempValueofDecimal = tempListValue.Trim().Substring(0, tempListValue.IndexOf(" "));
                    //            string tempItemDescription = tempListValue;
                    //            if (!string.IsNullOrEmpty(tempValueofDecimal))
                    //            {
                    //                tempItemDescription = tempListValue.Replace(tempValueofDecimal, "");
                    //            }
                    //            tempOrderItems.Insert(x, tempValueofDecimal);
                    //            tempOrderItems.RemoveAt(x + 1);
                    //            tempOrderItems.Insert(x + 1, tempItemDescription.Trim());
                    //        }
                    //    }
                    //}
                }

                int i = 1;

                OrderItem orderItem = new OrderItem();
                foreach (var value in tempOrderItems)
                {
                    if (i == 1)
                    {
                        orderItem.Name = value;
                    }
                    else if (i == 2)
                    {

                        int l = value.Trim().IndexOf(" ");
                        if (l > 0)
                        {
                            string CPrice = string.Empty;
                            CPrice = value.Substring(0, l);
                            orderItem.ClientPrice = CPrice;
                        }
                        else
                        {
                            orderItem.ClientPrice = value;
                        }
                    }
                    else if (i == 3)
                    {
                        orderItem.CostPrice = value;
                        orderItems.Add(orderItem);
                        orderItem = new OrderItem();
                        i = 0;
                    }
                    i++;
                }
            }
        }