private void ComboBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (comboBox.Text != "" && comboBox.Text != temptext && 1 == 2)
            {
                Newtonsoft.Json.Linq.JArray b = idlist;
                var d  = b.ToList();
                var cc = d.FindAll(x => x != null && Regex.Match(x["name"].ToString(), "^" + comboBox.Text, RegexOptions.IgnoreCase).Success);
                if (cc.Count > 0)
                {
                    var c = cc.OrderBy(x => x["name"].ToString().Length).Take(10);


                    clearcombo();

                    foreach (var a in c)
                    {
                        comboBox.Items.Add(a["name"].ToString());
                    }

                    comboBox.IsDropDownOpen = true;
                    System.Windows.Controls.TextBox tb = (System.Windows.Controls.TextBox)comboBox.Template.FindName("PART_EditableTextBox", comboBox);
                    tb.Select(tb.Text.Length, 0);
                }
                else
                {
                    clearcombo();
                }
            }
            if (temptext != comboBox.Text)
            {
                comboBox.IsDropDownOpen = true;
                System.Windows.Controls.TextBox tb = (System.Windows.Controls.TextBox)comboBox.Template.FindName("PART_EditableTextBox", comboBox);
                tb.Select(tb.Text.Length, 0);
            }
            loadFromName();
        }
 public ActionResult SubmitStoreEvent(StoreEvent entity, string keyValue = "")
 {
     if (entity.EventConfigString.Equals("[[]]"))
     {
         return(Error("满减条件不可为空!"));
     }
     if (string.IsNullOrEmpty(keyValue))
     {
         entity.EventType = 0;
         int res = GoodsBLL.instance.AddStoreEvent(entity);
         if (!string.IsNullOrEmpty(entity.EventConfigString))
         {
             var json = Newtonsoft.Json.JsonConvert.DeserializeObject(entity.EventConfigString);
             Newtonsoft.Json.Linq.JArray arr = json as Newtonsoft.Json.Linq.JArray;
             if (res > 0 && arr.Count > 0)
             {
                 arr.ToList().ForEach(item =>
                 {
                     StoreEventConfig cfg = new StoreEventConfig
                     {
                         ConditionName  = item["ConditionName"].ToString(),
                         ConditionValue = item["ConditionValue"].ToString(),
                         StoreEventID   = res.ToString()
                     };
                     cfg.Description = $"满{cfg.ConditionName},减{cfg.ConditionValue}";
                     SysBLL.Instance.Insert(cfg);
                 });
             }
         }
     }
     else
     {
         StoreEvent evt = SysBLL.Instance.GetALL <StoreEvent>(where : $"ID='{keyValue}'").FirstOrDefault();
         evt.StartTime = entity.StartTime;
         evt.EndTime   = entity.EndTime;
         evt.Name      = entity.Name;
         evt.Remark    = entity.Remark;
         evt.StoreIds  = entity.StoreIds;
         var res = SysBLL.Instance.UpdateByKey(evt);
         if (res)
         {
             if (!string.IsNullOrEmpty(entity.EventConfigString))
             {
                 var effectRow = 0;
                 var json      = Newtonsoft.Json.JsonConvert.DeserializeObject(entity.EventConfigString);
                 Newtonsoft.Json.Linq.JArray arr = json as Newtonsoft.Json.Linq.JArray;
                 if (arr.Count > 0)
                 {
                     SysBLL.Instance.DeleteByWhere <StoreEventConfig>($"StoreEventID='{keyValue}'");
                     arr.ToList().ForEach(item =>
                     {
                         StoreEventConfig cfg = new StoreEventConfig
                         {
                             ConditionName  = item["ConditionName"].ToString(),
                             ConditionValue = item["ConditionValue"].ToString(),
                             StoreEventID   = evt.ID.ToString()
                         };
                         cfg.Description = $"满{cfg.ConditionName},减{cfg.ConditionValue}";
                         bool result     = SysBLL.Instance.Insert(cfg);
                         effectRow      += (result ? 1 : 0);
                     });
                 }
                 return(effectRow > 0 ? Success("更新成功!") : Error("更新失败!"));
             }
         }
     }
     return(Success("操作成功!"));
 }