Exemplo n.º 1
0
        //----------------------------------------------------------
        public void Function_Dau_Vao()
        {
            try
            {
                List <string> file_name = doc.Title.Split('_').ToList();
                project_number = doc.ProjectInformation.Number;
                block          = doc.ProjectInformation.BuildingName;
                Class          = doc.ProjectInformation.LookupParameter("Class") == null ? "" : doc.ProjectInformation.LookupParameter("Class").AsString();
                if (string.IsNullOrEmpty(Class))
                {
                    MessageBox.Show("Share Parameter Class not found", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }

                if (file_name.Count() > 3)
                {
                    List <string> format = new List <string>();
                    if (project_number != file_name[0])
                    {
                        format.Add("Project Number");
                    }

                    if (block != file_name[1])
                    {
                        format.Add("Block");
                    }

                    if (Class != file_name[3])
                    {
                        format.Add("Class");
                    }

                    if (format.Count() == 0)
                    {
                        id_file     = file_name[0] + "_" + file_name[1] + "_" + file_name[2] + "_" + file_name[3] + "_";
                        unit_length = F_GetUnits.get_unit_length_type(doc);

                        input_block.Text = block;
                        F_Material.get_material_combobox(doc, input_material);

                        show_data_input(id_file, thong_tin_quantity_input);
                        material_of_element_in_project = new List <string>();

                        F_QuantityNotes.Get_Data_Notes_Web(project_number, Class, my_table_note, thong_tin_quantity_total_web);
                    }
                    else
                    {
                        MessageBox.Show(string.Format("Data is incorrect.\nPlease check {0} and try again!", string.Join(",", format)), "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("File name is incorrect. Please check and try again!", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
        //----------------------------------------------------------
        public void Function_Dau_Vao()
        {
            List <string> file_name = doc.Title.Split('_').ToList();

            project_number = doc.ProjectInformation.Number;
            block          = doc.ProjectInformation.BuildingName;
            Class          = doc.ProjectInformation.LookupParameter("Class") == null ? "" : doc.ProjectInformation.LookupParameter("Class").AsString();
            if (string.IsNullOrEmpty(Class))
            {
                MessageBox.Show("Share Parameter Class not found", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            if (file_name.Count() > 3)
            {
                unit_length = F_GetUnits.get_unit_length_type(doc);
                List <string> format = new List <string>();
                if (project_number != file_name[0])
                {
                    format.Add("Project Number");
                }

                if (block != file_name[1])
                {
                    format.Add("Block");
                }

                if (Class != file_name[3])
                {
                    format.Add("Class");
                }

                if (format.Count() == 0)
                {
                    F_GetDesciplineAndCategory.get_descipline_and_category(descipline, category);
                    CollectionView view_category = (CollectionView)CollectionViewSource.GetDefaultView(category.ItemsSource);
                    view_category.Filter = Filter_category;

                    my_family     = new ObservableCollection <data_family>();
                    my_parameters = new ObservableCollection <data_parameters>();
                    my_materials  = new ObservableCollection <data_materials>();
                    my_material   = new ObservableCollection <data_material>();
                    ElementType type = F_TypeDefault.get_type_select(uidoc, doc, descipline, category, outhome, inhome, kc);
                    Show_Tat_Ca_Family_Type();
                    if (type != null)
                    {
                        foreach (data_family family in my_family)
                        {
                            if (family.ten_family_type == type.FamilyName)
                            {
                                family.ValueExpanded = true;
                                foreach (data_type element_Type in family.Children)
                                {
                                    if (element_Type.ten_element_type == type.Name)
                                    {
                                        element_Type.ValueIsSelect = true;
                                        F_ViewDetail.view_detail(doc, element_Type, my_parameters, my_materials, my_material, thong_tin_kich_thuoc, thong_tin_cong_tac_vat_lieu, unit_length);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show(string.Format("Data is incorrect.\nPlease check {0} and try again!", string.Join(",", format)), "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("File name is incorrect. Please check and try again!", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                this.Close();
            }
        }