//----------------------------------------------------------
        private void Change_Status_Child(object sender, EventArgs e)
        {
            try
            {
                List <string> Check_Finish = new List <string>();
                foreach (child item in my_child)
                {
                    status_data data = (status_data)item.status_child;
                    item.color = data.color;
                    Check_Finish.Add(data.name);
                    thong_tin_clash_child.Items.Refresh();
                }

                if (Check_Finish.Distinct().ToList().Count() == 1 && Check_Finish[0] == Source.list_status_child[2].name)
                {
                    parent item_parent = (parent)thong_tin_clash_parent.SelectedItem;
                    item_parent.status_parent = Source.list_status_parent[1].name;
                    item_parent.color         = Source.list_status_parent[1].color;
                    thong_tin_clash_parent.Items.Refresh();
                }
                else
                {
                    parent item_parent = (parent)thong_tin_clash_parent.SelectedItem;
                    item_parent.status_parent = Source.list_status_parent[0].name;
                    item_parent.color         = Source.list_status_parent[0].color;
                    thong_tin_clash_parent.Items.Refresh();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        //--------------------------------------------------------------------------------------------------------------------------------------------------------------
        #region Clash Parent
        public void Get_Data_For_Parent()
        {
            try
            {
                if (!string.IsNullOrEmpty(project_number))
                {
                    List <string> Para2 = new List <string>()
                    {
                        "@DBProjectNumber"
                    };
                    List <string> Para2_Values = new List <string>()
                    {
                        project_number
                    };
                    var listtotal = SQL.SQLRead(Source.path_FileStream, "dbo.sp_ReadData_FromClashDetective", Source.type_Procedure, Para2, Para2_Values);
                    ObservableCollection <parent> parent_support = new ObservableCollection <parent>();
                    for (var i = 0; i < listtotal.Rows.Count; i++)
                    {
                        parent_support.Add(new parent()
                        {
                            clash_parent    = listtotal.Rows[i]["DisplayNameParent"].ToString(),
                            status_parent   = listtotal.Rows[i]["Status"].ToString(),
                            clash_file_name = listtotal.Rows[i]["FilesName"].ToString()
                        });
                    }
                    status_data status_Data = Source.list_status_parent[0];

                    my_parent = new ObservableCollection <parent>(parent_support.GroupBy(x => new
                    {
                        x.clash_parent
                    }).Where(y => y.Select(yy => yy.status_parent).Any(yyy => yyy != Source.list_status_child[2].name))
                                                                  .Select(z => new parent()
                    {
                        clash_parent    = z.Key.clash_parent,
                        status_parent   = status_Data.name,
                        color           = status_Data.color,
                        clash_file_name = z.First().clash_file_name
                    }));

                    thong_tin_clash_parent.ItemsSource = my_parent;
                    CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(thong_tin_clash_parent.ItemsSource);
                    view.SortDescriptions.Add(new SortDescription("clash_parent", ListSortDirection.Ascending));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        //--------------------------------------------------------------------------------------------------------------------------------------------------------------
        #region Clash Child
        public void Get_Data_Clash_Child(string clash_parent, string file_name)
        {
            try
            {
                my_child = new ObservableCollection <child>();

                List <string> Para2 = new List <string>()
                {
                    "@DBProjectNumber", "@DBFilesName", "@DBDisplayNameParent"
                };
                List <string> Para2_Values = new List <string>()
                {
                    project_number, file_name, clash_parent
                };
                var           listtotal    = SQL.SQLRead(Source.path_FileStream, "dbo.sp_ReadData_FromClashDetective_ForClash", Source.type_Procedure, Para2, Para2_Values);
                List <string> check_status = new List <string>();
                for (var i = 0; i < listtotal.Rows.Count; i++)
                {
                    status_data status = Source.list_status_child.First(x => x.name == listtotal.Rows[i]["Status"].ToString());

                    string             user        = "";
                    string             message     = "";
                    List <ImageSource> imageSource = new List <ImageSource>();

                    List <string> id_message = new List <string>();
                    string        Messages   = listtotal.Rows[i]["Messages"].ToString();
                    if (Messages != "null" && !string.IsNullOrEmpty(Messages))
                    {
                        List <data_messages> my_data_messages = JsonConvert.DeserializeObject <List <data_messages> >(Messages);
                        foreach (data_messages data in my_data_messages)
                        {
                            if (data.mark == true)
                            {
                                if (!string.IsNullOrEmpty(data.message))
                                {
                                    message += "\n" + data.message;
                                }
                                id_message.Add(data.id);
                            }
                        }
                    }

                    string Attach = listtotal.Rows[i]["Attach"].ToString();
                    if (Attach != "null" && !string.IsNullOrEmpty(Attach))
                    {
                        List <data_attach> my_data_attach = JsonConvert.DeserializeObject <List <data_attach> >(Attach);
                        foreach (data_attach data in my_data_attach)
                        {
                            if (data.messageId == "solution" || string.Join("|", id_message).Contains(data.messageId))
                            {
                                foreach (data_image image in data.images)
                                {
                                    imageSource.Add(Support.Image_Base64(image.src));
                                }
                            }
                        }
                    }

                    if (!string.IsNullOrEmpty(listtotal.Rows[i]["CommentBy"].ToString()))
                    {
                        var    list_data_user = SQL.SQLRead(Source.path_WEB, "dbo.spRead_User", Source.type_Procedure, new List <string>(), new List <string>());
                        string userId         = JsonConvert.DeserializeObject <data_time_comments>(listtotal.Rows[i]["CommentBy"].ToString()).userId;
                        for (var a = 0; a < list_data_user.Rows.Count; a++)
                        {
                            if (list_data_user.Rows[a]["UserId"].ToString() == userId)
                            {
                                user = list_data_user.Rows[a]["UserName"].ToString();
                                break;
                            }
                        }
                    }
                    bool isEnable = status.isEnable;

                    string hostName = Dns.GetHostName();
                    string myIP     = Dns.GetHostAddresses(hostName)[0].ToString();
                    string path     = Source.pathUserPassword + "\\" + myIP;
                    if (File.Exists(path))
                    {
                        var    infor  = File.ReadAllLines(path).ToList();
                        string userId = infor[1];

                        List <string> list_userId_assign = new List <string>();
                        string        assign_to          = listtotal.Rows[i]["AssignTo"].ToString();
                        if (assign_to != "null" && !string.IsNullOrEmpty(assign_to))
                        {
                            List <data_assign> my_data_assign = JsonConvert.DeserializeObject <List <data_assign> >(assign_to);
                            foreach (data_assign data in my_data_assign)
                            {
                                list_userId_assign.Add(data.userId);
                            }
                        }
                        if (list_userId_assign.Any(x => x == userId) == false)
                        {
                            if (status.name != Source.list_status_child[0].name && status.name != Source.list_status_child[1].name)
                            {
                                isEnable = false;
                            }
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(infor[2]))
                            {
                                isEnable = false;
                            }
                        }
                    }
                    Func <char, bool> isnumber = ch => char.IsNumber(ch);
                    int index = 0;
                    for (int j = 0; j < listtotal.Rows[i]["DisplayNameChild"].ToString().Length; j++)
                    {
                        if (isnumber(listtotal.Rows[i]["DisplayNameChild"].ToString()[j]))
                        {
                            index = j;
                            break;
                        }
                    }

                    bool   check_time = false;
                    string CommentBy  = listtotal.Rows[i]["CommentBy"].ToString();
                    if (CommentBy != "null" && !string.IsNullOrEmpty(CommentBy))
                    {
                        string   time      = JsonConvert.DeserializeObject <data_time_comments>(CommentBy).time;
                        DateTime dateTime  = DateTime.Parse(time, null, DateTimeStyles.RoundtripKind);
                        DateTime dateCheck = DateTime.Now.AddHours(-1);
                        if (dateCheck >= dateTime)
                        {
                            check_time = true;
                        }
                    }
                    if (check_time == true)
                    {
                        my_child.Add(new child()
                        {
                            clash_child_sort  = Convert.ToInt32(listtotal.Rows[i]["DisplayNameChild"].ToString().Substring(index)),
                            clash_child       = listtotal.Rows[i]["DisplayNameChild"].ToString(),
                            status_child_list = Source.list_status_child,
                            status_child      = status,
                            location_child    = listtotal.Rows[i]["Location"].ToString(),
                            approved_by_child = user,
                            solution_child    = listtotal.Rows[i]["Solution"].ToString() + message,

                            id1_child  = listtotal.Rows[i]["path1ID"].ToString(),
                            doc1_child = doc_file_1,
                            id2_child  = listtotal.Rows[i]["path2ID"].ToString(),
                            doc2_child = doc_file_2,

                            id = listtotal.Rows[i]["Id"].ToString(),

                            bitmap   = imageSource,
                            color    = status.color,
                            isEnable = isEnable
                        });
                    }
                    else
                    {
                        my_child.Add(new child()
                        {
                            clash_child_sort  = Convert.ToInt32(listtotal.Rows[i]["DisplayNameChild"].ToString().Substring(index)),
                            clash_child       = listtotal.Rows[i]["DisplayNameChild"].ToString(),
                            status_child_list = Source.list_status_child,
                            status_child      = status,
                            location_child    = listtotal.Rows[i]["Location"].ToString(),
                            approved_by_child = user,
                            solution_child    = listtotal.Rows[i]["Solution"].ToString() + message,

                            id1_child  = listtotal.Rows[i]["path1ID"].ToString(),
                            doc1_child = doc_file_1,
                            id2_child  = listtotal.Rows[i]["path2ID"].ToString(),
                            doc2_child = doc_file_2,

                            id = listtotal.Rows[i]["Id"].ToString(),

                            bitmap   = imageSource,
                            color    = status.color,
                            isEnable = false
                        });
                    }
                }
                thong_tin_clash_child.ItemsSource = my_child;

                CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(thong_tin_clash_child.ItemsSource);
                view.SortDescriptions.Add(new SortDescription("clash_child_sort", ListSortDirection.Ascending));

                view.Filter = Filter_ten_vat_lieu;
                get_count_state();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                thong_tin_clash_child.ItemsSource   = new ObservableCollection <child>();
                thong_tin_clash_parent.SelectedItem = null;
            }
        }