public List <string> SplitDivisionHelper(DivisionCriteria SDC, string Input, bool IsRemoveDivision)
        {
            List <string> result       = new List <string>();
            string        alteredInput = Input;
            string        temp;

            if (!string.IsNullOrEmpty(SDC.DivisionStart) && !string.IsNullOrEmpty(SDC.DivisionEnd))
            {
                while (alteredInput.Contains(SDC.DivisionStart) && alteredInput.Contains(SDC.DivisionEnd))
                {
                    temp = alteredInput.Substring(alteredInput.IndexOf(SDC.DivisionStart), alteredInput.IndexOf(SDC.DivisionEnd) + SDC.DivisionEnd.Length);
                    if (IsRemoveDivision)
                    {
                        temp = temp.Replace(SDC.DivisionStart, "").Replace(SDC.DivisionEnd, "").Replace("\n", "");
                    }
                    result.Add(temp);
                    alteredInput = alteredInput.Substring(alteredInput.IndexOf(SDC.DivisionEnd) + SDC.DivisionEnd.Length);
                }
                if (!IsRemoveDivision)
                {
                    result.Add(alteredInput);
                }
            }
            foreach (var item in result.ToList())
            {
                if (!IsRemoveDivision && (!item.Contains(SDC.DivisionStart) || !item.Contains(SDC.DivisionEnd)))
                {
                    result.Remove(item);
                }
            }
            return(result);
        }
 void XMLSearchCriteriaDefinition()
 {
     AdvertSplitDivisionCriteria = new DivisionCriteria()
     {
         DivisionStart = "<tr data-id=\"",
         DivisionEnd   = "</tr>"
     };
     AdvertTrimCriteria = new DivisionCriteria()
     {
         DivisionStart = "<tbody class=\"searchResultsRowClass\">",
         DivisionEnd   = "</tbody>"
     };
     AttributeTrimCriteria = new DivisionCriteria()
     {
         DivisionStart = "</td>\n            ",
         DivisionEnd   = "<td class=\"searchResultsPriceValue\">"
     };
     PriceCriteria = new SearchCriteria()
     {
         SearchStart = "<td class=\"searchResultsPriceValue\">\n                        <div> ",
         SearchEnd   = "</div>"
     };
     AdvertIDCriteria = new SearchCriteria()
     {
         SearchStart = "<tr data-id=\"",
         SearchEnd   = "\"\n"
     };
     DescriptionCriteria = new SearchCriteria()
     {
         SearchStart = "/detay\">\n    ",
         SearchEnd   = "</a>"
     };
     ThumbnailCriteria = new SearchCriteria()
     {
         SearchStart = " src=\"",
         SearchEnd   = "\"\n"
     };
     LocationCriteria = new SearchCriteria()
     {
         SearchStart = "<td class=\"searchResultsLocationValue\">\n                        ",
         SearchEnd   = "</td>"
     };
     DateCriteria = new SearchCriteria()
     {
         SearchStart = "<span>",
         SearchEnd   = "</span>\n                    </td>"
     };
     DateCriteria = new SearchCriteria()
     {
         SearchStart = "<span>",
         SearchEnd   = "</span>\n                    </td>"
     };
     ResultAttributeDivisionCriteria = new DivisionCriteria()
     {
         DivisionStart = "<td class=\"searchResultsAttributeValue\">\n",
         DivisionEnd   = "</td>"
     };
 }
        public List <GetDivisionComboResult> GetDivisionCombo(DivisionCriteria criteria)
        {
            using (TransactionEntities Context = new TransactionEntities())
            {
                var result = Context.GetDivisionCombo(
                    prodDate: criteria.ProdDate
                    , userCode: criteria.UserCode
                    ).ToList();

                return(result);
            }
        }
        public string TrimHelper(DivisionCriteria TC, string Input)
        {
            string result = "";

            if (!string.IsNullOrEmpty(TC.DivisionStart) && !string.IsNullOrEmpty(TC.DivisionEnd))
            {
                if (Input.IndexOf(TC.DivisionStart) >= 0 && Input.IndexOf(TC.DivisionEnd) >= 0)
                {
                    result = Input.Substring(Input.IndexOf(TC.DivisionStart) + TC.DivisionStart.Length);
                    result = result.Substring(0, result.IndexOf(TC.DivisionEnd));
                }
            }
            return(result);
        }
Exemple #5
0
        public ActionResult GetDivisionComboData(DataSourceLoadOptions loadOptions)
        {
            DivisionCriteria cri = new DivisionCriteria();

            cri.ProdDate = this.CommonService.GetProductionDate();
            cri.UserCode = UserDetail.UserID;

            //test
            //cri.UserCode = "3570";

            var divisions = this.TransactionService.GetDivisionCombo(cri);

            //divisions.Insert(0, new GetDivisionCombo_Result() { DivCode = null, DivCodeDisplay = "--Select--",DivName= "--Select--" });

            return(Content(JsonConvert.SerializeObject(DataSourceLoader.Load(divisions, loadOptions)), ConstantValues.JSON_CONTENT_TYPE));
        }