示例#1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (MerchantSuppliedId != null)
         {
             hashCode = hashCode * 59 + MerchantSuppliedId.GetHashCode();
         }
         if (Active != null)
         {
             hashCode = hashCode * 59 + Active.GetHashCode();
         }
         if (SortId != null)
         {
             hashCode = hashCode * 59 + SortId.GetHashCode();
         }
         if (MinNumOptions != null)
         {
             hashCode = hashCode * 59 + MinNumOptions.GetHashCode();
         }
         if (MaxNumOptions != null)
         {
             hashCode = hashCode * 59 + MaxNumOptions.GetHashCode();
         }
         if (NumFreeOptions != null)
         {
             hashCode = hashCode * 59 + NumFreeOptions.GetHashCode();
         }
         if (MinOptionChoiceQuantity != null)
         {
             hashCode = hashCode * 59 + MinOptionChoiceQuantity.GetHashCode();
         }
         if (MaxOptionChoiceQuantity != null)
         {
             hashCode = hashCode * 59 + MaxOptionChoiceQuantity.GetHashCode();
         }
         if (MinAggregateOptionsQuantity != null)
         {
             hashCode = hashCode * 59 + MinAggregateOptionsQuantity.GetHashCode();
         }
         if (MaxAggregateOptionsQuantity != null)
         {
             hashCode = hashCode * 59 + MaxAggregateOptionsQuantity.GetHashCode();
         }
         if (Options != null)
         {
             hashCode = hashCode * 59 + Options.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#2
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Subtitle != null)
         {
             hashCode = hashCode * 59 + Subtitle.GetHashCode();
         }
         if (MerchantSuppliedId != null)
         {
             hashCode = hashCode * 59 + MerchantSuppliedId.GetHashCode();
         }
         if (Active != null)
         {
             hashCode = hashCode * 59 + Active.GetHashCode();
         }
         if (SortId != null)
         {
             hashCode = hashCode * 59 + SortId.GetHashCode();
         }
         if (Items != null)
         {
             hashCode = hashCode * 59 + Items.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#3
0
        /// <summary>
        /// Returns true if ItemExtraOption instances are equal
        /// </summary>
        /// <param name="input">Instance of ItemExtraOption to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ItemExtraOption input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Name == input.Name ||
                     Name != null &&
                     Name.Equals(input.Name)
                     ) &&
                 (
                     Description == input.Description ||
                     Description != null &&
                     Description.Equals(input.Description)
                 ) &&
                 (
                     MerchantSuppliedId == input.MerchantSuppliedId ||
                     MerchantSuppliedId != null &&
                     MerchantSuppliedId.Equals(input.MerchantSuppliedId)
                 ) &&
                 (
                     Active == input.Active ||
                     Active != null &&
                     Active.Equals(input.Active)
                 ) &&
                 (
                     Price == input.Price ||
                     Price != null &&
                     Price.Equals(input.Price)
                 ) &&
                 (
                     BasePrice == input.BasePrice ||
                     BasePrice != null &&
                     BasePrice.Equals(input.BasePrice)
                 ) &&
                 (
                     Default == input.Default ||
                     Default != null &&
                     Default.Equals(input.Default)
                 ) &&
                 (
                     SortId == input.SortId ||
                     SortId != null &&
                     SortId.Equals(input.SortId)
                 ) &&
                 (
                     TaxRate == input.TaxRate ||
                     TaxRate != null &&
                     TaxRate.Equals(input.TaxRate)
                 ) &&
                 (
                     Extras == input.Extras ||
                     Extras != null &&
                     Extras.SequenceEqual(input.Extras)
                 ));
        }
示例#4
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (MerchantSuppliedId != null)
         {
             hashCode = hashCode * 59 + MerchantSuppliedId.GetHashCode();
         }
         if (Active != null)
         {
             hashCode = hashCode * 59 + Active.GetHashCode();
         }
         if (IsAlcohol != null)
         {
             hashCode = hashCode * 59 + IsAlcohol.GetHashCode();
         }
         if (IsBikeFriendly != null)
         {
             hashCode = hashCode * 59 + IsBikeFriendly.GetHashCode();
         }
         if (SortId != null)
         {
             hashCode = hashCode * 59 + SortId.GetHashCode();
         }
         if (Price != null)
         {
             hashCode = hashCode * 59 + Price.GetHashCode();
         }
         if (BasePrice != null)
         {
             hashCode = hashCode * 59 + BasePrice.GetHashCode();
         }
         if (Extras != null)
         {
             hashCode = hashCode * 59 + Extras.GetHashCode();
         }
         if (TaxRate != null)
         {
             hashCode = hashCode * 59 + TaxRate.GetHashCode();
         }
         if (OriginalImageUrl != null)
         {
             hashCode = hashCode * 59 + OriginalImageUrl.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#5
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (MerchantSuppliedId != null)
         {
             hashCode = hashCode * 59 + MerchantSuppliedId.GetHashCode();
         }
         if (Active != null)
         {
             hashCode = hashCode * 59 + Active.GetHashCode();
         }
         if (Price != null)
         {
             hashCode = hashCode * 59 + Price.GetHashCode();
         }
         if (BasePrice != null)
         {
             hashCode = hashCode * 59 + BasePrice.GetHashCode();
         }
         if (Default != null)
         {
             hashCode = hashCode * 59 + Default.GetHashCode();
         }
         if (SortId != null)
         {
             hashCode = hashCode * 59 + SortId.GetHashCode();
         }
         if (TaxRate != null)
         {
             hashCode = hashCode * 59 + TaxRate.GetHashCode();
         }
         if (Extras != null)
         {
             hashCode = hashCode * 59 + Extras.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#6
0
        /// <summary>
        /// Returns true if MenuCategory instances are equal
        /// </summary>
        /// <param name="input">Instance of MenuCategory to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(MenuCategory input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Name == input.Name ||
                     Name != null &&
                     Name.Equals(input.Name)
                     ) &&
                 (
                     Subtitle == input.Subtitle ||
                     Subtitle != null &&
                     Subtitle.Equals(input.Subtitle)
                 ) &&
                 (
                     MerchantSuppliedId == input.MerchantSuppliedId ||
                     MerchantSuppliedId != null &&
                     MerchantSuppliedId.Equals(input.MerchantSuppliedId)
                 ) &&
                 (
                     Active == input.Active ||
                     Active != null &&
                     Active.Equals(input.Active)
                 ) &&
                 (
                     SortId == input.SortId ||
                     SortId != null &&
                     SortId.Equals(input.SortId)
                 ) &&
                 (
                     Items == input.Items ||
                     Items != null &&
                     Items.SequenceEqual(input.Items)
                 ));
        }
示例#7
0
        /// <summary>
        /// Returns true if NestedL2ItemExtra instances are equal
        /// </summary>
        /// <param name="input">Instance of NestedL2ItemExtra to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(NestedL2ItemExtra input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Name == input.Name ||
                     Name != null &&
                     Name.Equals(input.Name)
                     ) &&
                 (
                     Description == input.Description ||
                     Description != null &&
                     Description.Equals(input.Description)
                 ) &&
                 (
                     MerchantSuppliedId == input.MerchantSuppliedId ||
                     MerchantSuppliedId != null &&
                     MerchantSuppliedId.Equals(input.MerchantSuppliedId)
                 ) &&
                 (
                     Active == input.Active ||
                     Active != null &&
                     Active.Equals(input.Active)
                 ) &&
                 (
                     SortId == input.SortId ||
                     SortId != null &&
                     SortId.Equals(input.SortId)
                 ) &&
                 (
                     MinNumOptions == input.MinNumOptions ||
                     MinNumOptions != null &&
                     MinNumOptions.Equals(input.MinNumOptions)
                 ) &&
                 (
                     MaxNumOptions == input.MaxNumOptions ||
                     MaxNumOptions != null &&
                     MaxNumOptions.Equals(input.MaxNumOptions)
                 ) &&
                 (
                     NumFreeOptions == input.NumFreeOptions ||
                     NumFreeOptions != null &&
                     NumFreeOptions.Equals(input.NumFreeOptions)
                 ) &&
                 (
                     MinOptionChoiceQuantity == input.MinOptionChoiceQuantity ||
                     MinOptionChoiceQuantity != null &&
                     MinOptionChoiceQuantity.Equals(input.MinOptionChoiceQuantity)
                 ) &&
                 (
                     MaxOptionChoiceQuantity == input.MaxOptionChoiceQuantity ||
                     MaxOptionChoiceQuantity != null &&
                     MaxOptionChoiceQuantity.Equals(input.MaxOptionChoiceQuantity)
                 ) &&
                 (
                     MinAggregateOptionsQuantity == input.MinAggregateOptionsQuantity ||
                     MinAggregateOptionsQuantity != null &&
                     MinAggregateOptionsQuantity.Equals(input.MinAggregateOptionsQuantity)
                 ) &&
                 (
                     MaxAggregateOptionsQuantity == input.MaxAggregateOptionsQuantity ||
                     MaxAggregateOptionsQuantity != null &&
                     MaxAggregateOptionsQuantity.Equals(input.MaxAggregateOptionsQuantity)
                 ) &&
                 (
                     Options == input.Options ||
                     Options != null &&
                     Options.SequenceEqual(input.Options)
                 ));
        }
示例#8
0
        /// <summary>
        /// Returns true if Item instances are equal
        /// </summary>
        /// <param name="input">Instance of Item to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Item input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Name == input.Name ||
                     Name != null &&
                     Name.Equals(input.Name)
                     ) &&
                 (
                     Description == input.Description ||
                     Description != null &&
                     Description.Equals(input.Description)
                 ) &&
                 (
                     MerchantSuppliedId == input.MerchantSuppliedId ||
                     MerchantSuppliedId != null &&
                     MerchantSuppliedId.Equals(input.MerchantSuppliedId)
                 ) &&
                 (
                     Active == input.Active ||
                     Active != null &&
                     Active.Equals(input.Active)
                 ) &&
                 (
                     IsAlcohol == input.IsAlcohol ||
                     IsAlcohol != null &&
                     IsAlcohol.Equals(input.IsAlcohol)
                 ) &&
                 (
                     IsBikeFriendly == input.IsBikeFriendly ||
                     IsBikeFriendly != null &&
                     IsBikeFriendly.Equals(input.IsBikeFriendly)
                 ) &&
                 (
                     SortId == input.SortId ||
                     SortId != null &&
                     SortId.Equals(input.SortId)
                 ) &&
                 (
                     Price == input.Price ||
                     Price != null &&
                     Price.Equals(input.Price)
                 ) &&
                 (
                     BasePrice == input.BasePrice ||
                     BasePrice != null &&
                     BasePrice.Equals(input.BasePrice)
                 ) &&
                 (
                     Extras == input.Extras ||
                     Extras != null &&
                     Extras.SequenceEqual(input.Extras)
                 ) &&
                 (
                     TaxRate == input.TaxRate ||
                     TaxRate != null &&
                     TaxRate.Equals(input.TaxRate)
                 ) &&
                 (
                     OriginalImageUrl == input.OriginalImageUrl ||
                     OriginalImageUrl != null &&
                     OriginalImageUrl.Equals(input.OriginalImageUrl)
                 ));
        }
示例#9
0
        private void FilterAdvandedEx_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (System.Windows.MessageBox.Show("Tiến hành lọc Id", "Xác nhận lọc Id", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    Dic = new Dictionary <string, dynamic>();
                    List <dynamic> listMapEx = new List <dynamic>();
                    string         str       = "";
                    string         type      = "ex";
                    List <string>  listex    = new List <string>();
                    List <string>  listbt    = new List <string>();
                    List <string>  listregex = CreatRegex();
                    str     = listregex[0];
                    strfile = listregex[1];
                    Regex rx = new Regex(str);
                    listMapEx = classlist.mapNewFile(rx, type, listPath);
                    if ((listMapEx == null || listMapEx.Count == 0))
                    {
                        System.Windows.MessageBox.Show("Không có câu hỏi nào trắc nghiệm được lọc ra", "Thoát");
                    }
                    List <string> listLabel = new List <string>();
                    List <SortId> listsort  = new List <SortId>();
                    Dic = new Dictionary <string, dynamic>();
                    var listDataGrid = new List <DataGrid1>();
                    foreach (var item in listMapEx)
                    {
                        string stringId   = item["codeId"];
                        string stringEcer = item["exersice"];
                        if (listLabel.Contains(stringId))
                        {
                            Dic[stringId].Add(stringEcer);
                        }
                        else
                        {
                            List <string> listEcer = new List <string>();
                            listEcer.Add(stringEcer);
                            Dic.Add(stringId, listEcer);
                            listLabel.Add(stringId);
                            SortId sort = new SortId();
                            sort.ClassId = int.Parse(stringId[0].ToString());
                            if (stringId[1] == 'D')
                            {
                                sort.ObjectId = 1;
                            }
                            else
                            {
                                sort.ObjectId = 2;
                            }
                            sort.CharterId = int.Parse(stringId[2].ToString());
                            switch (stringId[3])
                            {
                            case 'Y':
                                sort.LevelId = 1;
                                break;

                            case 'B':
                                sort.LevelId = 2;
                                break;

                            case 'K':
                                sort.LevelId = 3;
                                break;

                            case 'G':
                                sort.LevelId = 5;
                                break;

                            case 'T':
                                sort.LevelId = 4;
                                break;
                            }
                            sort.SectionId = int.Parse(stringId[4].ToString());
                            sort.CodeId    = stringId;
                            listsort.Add(sort);
                        }
                    }
                    Dic.Add("listid", listsort);
                    Dic.Add("listCodeId", listLabel);
                    foreach (var item in listLabel)
                    {
                        DataGrid1 getDataGrid1 = new DataGrid1();
                        int       classId      = Int32.Parse(item[0].ToString());
                        if (classId > 3)
                        {
                            getDataGrid1.ClassName = "Lớp " + classId;
                        }
                        if (classId <= 3)
                        {
                            getDataGrid1.ClassName = "Lớp 1" + classId;
                        }
                        char strChapterName1 = item[1];
                        char strChapterName2 = item[2];
                        if (strChapterName1 == 'H')
                        {
                            getDataGrid1.ChapterName = "Hình  chương " + strChapterName2;
                        }
                        if (strChapterName1 == 'D')
                        {
                            getDataGrid1.ChapterName = "Đại  chương " + strChapterName2;
                        }
                        char strSectionName = item[4];
                        getDataGrid1.SectionName = "Bài " + strSectionName;
                        char levelName = item[3];
                        if (levelName == 'Y')
                        {
                            getDataGrid1.LevelId = "Yếu";
                        }
                        if (levelName == 'B')
                        {
                            getDataGrid1.LevelId = "Trung bình";
                        }
                        if (levelName == 'K')
                        {
                            getDataGrid1.LevelId = "Khá";
                        }
                        if (levelName == 'G')
                        {
                            getDataGrid1.LevelId = "Giỏi";
                        }
                        getDataGrid1.CodeId               = item;
                        getDataGrid1.NumberExersice       = Dic[item].Count;
                        getDataGrid1.NumberExersiceSelect = 0;
                        getDataGrid1.IsSelected           = false;
                        listDataGrid.Add(getDataGrid1);
                    }
                    DataGridCollectionViewSource source = GridTotal.FindResource("cvsDataGrid") as DataGridCollectionViewSource;
                    source.Source = listDataGrid;
                }
            }
            catch (Exception a)
            {
                System.Windows.MessageBox.Show(a.Message, "Thoát");
            }
        }
示例#10
0
        public Dictionary <string, dynamic> mapSort(List <dynamic> listMapEx, string type)
        {
            try
            {
                if (type == "ex")
                {
                    List <SortId> listsort           = new List <SortId>();
                    Dictionary <string, dynamic> Dic = new Dictionary <string, dynamic>();
                    List <string> list = new List <string>();
                    foreach (var item in listMapEx)
                    {
                        string stringId   = item["codeId"];
                        string stringEcer = item["exersice"];
                        if (list.Contains(stringId))
                        {
                            Dic[stringId].Add(stringEcer);
                        }
                        else
                        {
                            List <string> listEcer = new List <string>();
                            listEcer.Add(stringEcer);
                            Dic.Add(stringId, listEcer);
                            list.Add(stringId);
                            SortId sort = new SortId();
                            sort.ClassId = int.Parse(stringId[0].ToString());
                            if (stringId[1] == 'D')
                            {
                                sort.ObjectId = 1;
                            }
                            else
                            {
                                sort.ObjectId = 2;
                            }
                            sort.CharterId = int.Parse(stringId[2].ToString());
                            switch (stringId[3])
                            {
                            case 'Y':
                                sort.LevelId = 1;
                                break;

                            case 'B':
                                sort.LevelId = 2;
                                break;

                            case 'K':
                                sort.LevelId = 3;
                                break;

                            case 'G':
                                sort.LevelId = 5;
                                break;

                            case 'T':
                                sort.LevelId = 4;
                                break;
                            }
                            sort.SectionId = int.Parse(stringId[4].ToString());
                            sort.CodeId    = stringId;
                            listsort.Add(sort);
                        }
                    }
                    Dic.Add("listid", listsort);
                    Dic.Add("listCodeId", list);
                    return(Dic);
                }
                else
                {
                    List <SortId> listsort           = new List <SortId>();
                    Dictionary <string, dynamic> Dic = new Dictionary <string, dynamic>();
                    List <string> list = new List <string>();
                    foreach (var item in listMapEx)
                    {
                        string stringId   = item["codeId"];
                        string stringEcer = item["exersice"];
                        if (stringId.Contains(";"))
                        {
                            string[] stringarray = stringId.Split(';');
                            foreach (string st in stringarray)
                            {
                                if (list.Contains(stringId))
                                {
                                    Dic[stringId].Add(stringEcer);
                                }
                                else
                                {
                                    List <string> listEcer = new List <string>();
                                    listEcer.Add(stringEcer);
                                    Dic.Add(stringId, listEcer);
                                    list.Add(stringId);
                                    SortId sort = new SortId();
                                    sort.ClassId = int.Parse(stringId[0].ToString());
                                    if (stringId[1] == 'D')
                                    {
                                        sort.ObjectId = 1;
                                    }
                                    else
                                    {
                                        sort.ObjectId = 2;
                                    }
                                    sort.CharterId = int.Parse(stringId[2].ToString());
                                    switch (stringId[3])
                                    {
                                    case 'Y':
                                        sort.LevelId = 1;
                                        break;

                                    case 'B':
                                        sort.LevelId = 2;
                                        break;

                                    case 'K':
                                        sort.LevelId = 3;
                                        break;

                                    case 'G':
                                        sort.LevelId = 5;
                                        break;

                                    case 'T':
                                        sort.LevelId = 4;
                                        break;
                                    }
                                    sort.SectionId = int.Parse(stringId[4].ToString());
                                    sort.CodeId    = stringId;
                                    listsort.Add(sort);
                                }
                            }
                        }
                        else
                        {
                            if (list.Contains(stringId))
                            {
                                Dic[stringId].Add(stringEcer);
                            }
                            else
                            {
                                List <string> listEcer = new List <string>();
                                listEcer.Add(stringEcer);
                                Dic.Add(stringId, listEcer);
                                list.Add(stringId);
                                SortId sort = new SortId();
                                sort.ClassId = int.Parse(stringId[0].ToString());
                                if (stringId[1] == 'D')
                                {
                                    sort.ObjectId = 1;
                                }
                                else
                                {
                                    sort.ObjectId = 2;
                                }
                                sort.CharterId = int.Parse(stringId[2].ToString());
                                switch (stringId[3])
                                {
                                case 'Y':
                                    sort.LevelId = 1;
                                    break;

                                case 'B':
                                    sort.LevelId = 2;
                                    break;

                                case 'K':
                                    sort.LevelId = 3;
                                    break;

                                case 'G':
                                    sort.LevelId = 5;
                                    break;

                                case 'T':
                                    sort.LevelId = 4;
                                    break;
                                }
                                sort.SectionId = int.Parse(stringId[4].ToString());
                                sort.CodeId    = stringId;
                                listsort.Add(sort);
                            }
                        }
                    }
                    Dic.Add("listid", listsort);
                    Dic.Add("listCodeId", list);
                    return(Dic);
                }
            }
            catch (Exception e)
            {
                return(null);
            }
        }