예제 #1
0
 //----------------------------------------------------------
 private void Upload_Du_Lieu_WEB(object sender, RoutedEventArgs e)
 {
     try
     {
         if (thong_tin_quantity_total_web.SelectedItem != null)
         {
             data_table_note item = (data_table_note)thong_tin_quantity_total_web.SelectedItem;
             Get_Source();
             string result = "F";
             if (thong_tin_quantity_total_project.Items.Count > 0)
             {
                 result = F_UploadData.Upload(uiapp, doc, thong_tin_quantity_total_project, thong_tin_quantity_project, material_of_element_in_project, id_file, user);
             }
             if (thong_tin_quantity_input.Items.Count > 0)
             {
                 F_SaveData.save_data_input(uiapp, doc, input_block, input_level, input_material, input_id, input_quantity, input_unit, id_file, my_quantity_input, false, user);
                 show_data_input(id_file, thong_tin_quantity_input);
                 result = "S";
             }
             if (result == "S")
             {
                 MessageBox.Show("Upload Success!", "SUCCESS", MessageBoxButton.OK, MessageBoxImage.Information);
                 List <string> para = new List <string>()
                 {
                     "@DBProjectNumber", "@DBId", "@DBStatus"
                 };
                 for (int i = 0; i < item.ids.Count(); i++)
                 {
                     var a = JsonConvert.SerializeObject(new data_status()
                     {
                         open = false, edited = item.editeds[i]
                     });
                     List <object> para_value = new List <object>()
                     {
                         project_number, item.ids[i], a
                     };
                     SQL.SQLWrite(Source.path_WEB, "dbo.spUpdate_OnlyStatusQuantityNotes", Source.type_Procedure, para, para_value);
                 }
                 F_QuantityNotes.Get_Data_Notes_Web(project_number, Class, my_table_note, thong_tin_quantity_total_web);
             }
             else
             {
                 MessageBox.Show("Missing data. Upload fail!", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #2
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);
            }
        }