public void SelectApplication_unit_byApplication_unit(string application_unit) { Application_unit_Model application_Unit_Model = new Application_unit_Model(); application_Unit_Model.SelectApplication_unit_byApplication_unit(application_unit); Application_unit_no = application_Unit_Model.Application_unit_no; Application_unit = application_Unit_Model.Application_unit; Group = application_Unit_Model.Group; Application_phone_no = application_Unit_Model.Application_phone_no; Principal = application_Unit_Model.Principal; Principal_phone_no = application_Unit_Model.Principal_phone_no; Application_address = application_Unit_Model.Application_address; Work_content = application_Unit_Model.Work_content; Total_volunteers = application_Unit_Model.Total_volunteers; Unit_volunteer_list_Model unit_Volunteer_List_Model = new Unit_volunteer_list_Model(); List <Unit_volunteer_list_Model> unit_Volunteer_List_Models = unit_Volunteer_List_Model.Selectvolunteer_list_byApplication_unit(application_Unit_Model.Application_unit_no); List <Volunteer_List> tmp_Volunteer_Lists = new List <Volunteer_List>(); foreach (var row in unit_Volunteer_List_Models) { Volunteer_List volunteer_List = new Volunteer_List(); volunteer_List.Chinese_name = row.Chinese_name; volunteer_List.English_name = row.English_name; volunteer_List.Sex = row.Sex; volunteer_List.Birthday = row.Birthday; volunteer_List.IDcrad_no = row.IDcrad_no; volunteer_List.Medical_record_no = row.Medical_record_no; volunteer_List.Identity_type = row.Identity_type; volunteer_List.Seniority = row.Seniority; volunteer_List.Vest_no = row.Vest_no; volunteer_List.Education = row.Education; tmp_Volunteer_Lists.Add(volunteer_List); } Volunteer_Lists = tmp_Volunteer_Lists; Unit_expertise_Model unit_Expertise_Model = new Unit_expertise_Model(); List <string> unit_Expertises = unit_Expertise_Model.SelectUnit_ExpertisebyApplication_unit_no(application_Unit_Model.Application_unit_no); List <string> tmp_expertises = new List <string>(); foreach (var row in unit_Expertises) { tmp_expertises.Add(row); } Expertises = tmp_expertises; Unit_service_period_Model unit_Service_Period_Model = new Unit_service_period_Model(); List <Unit_service_period_Model> unit_Service_Periods = unit_Service_Period_Model.SelectUnit_service_period_byApplication_unit_no(application_Unit_Model.Application_unit_no); List <Unit_service_period> tmp_Service_Periods = new List <Unit_service_period>(); foreach (var row in unit_Service_Periods) { Unit_service_period unit_Service_Period = new Unit_service_period(); unit_Service_Period.Service_period = row.Service_period; unit_Service_Period.Volunteer_number = row.Volunteer_number; tmp_Service_Periods.Add(unit_Service_Period); } Service_Periods = tmp_Service_Periods; }
public void CommitApplication_unit(string Commit_type, Application_unit_data_ViewModel application_Unit_Data_ViewModel, List <string> Insert_list, List <string> Delete_list, List <Unit_service_period> Insert_Service_Periods, List <Unit_service_period> Delete_Service_Periods) { Application_unit_Model application_Unit_Model = new Application_unit_Model(); Unit_expertise_Model unit_Expertise_Model = new Unit_expertise_Model(); Unit_service_period_Model unit_Service_Period_Model = new Unit_service_period_Model(); if (application_Unit_Data_ViewModel.Application_unit_no > 0) { application_Unit_Model.Application_unit_no = application_Unit_Data_ViewModel.Application_unit_no; } application_Unit_Model.Application_unit = application_Unit_Data_ViewModel.Application_unit; application_Unit_Model.Group = application_Unit_Data_ViewModel.Group; application_Unit_Model.Application_phone_no = application_Unit_Data_ViewModel.Application_phone_no; application_Unit_Model.Application_address = application_Unit_Data_ViewModel.Application_address; application_Unit_Model.Principal = application_Unit_Data_ViewModel.Principal; application_Unit_Model.Principal_phone_no = application_Unit_Data_ViewModel.Principal_phone_no; application_Unit_Model.Work_content = application_Unit_Data_ViewModel.Work_content; List <Unit_service_period_Model> Insert_sp = new List <Unit_service_period_Model>(); foreach (var row in Insert_Service_Periods) { Unit_service_period_Model Insert_Model = new Unit_service_period_Model(); Insert_Model.Service_period = row.Service_period; Insert_Model.Volunteer_number = row.Volunteer_number; Insert_sp.Add(Insert_Model); } List <Unit_service_period_Model> Delete_sp = new List <Unit_service_period_Model>(); foreach (var row in Delete_Service_Periods) { Unit_service_period_Model Delete_Model = new Unit_service_period_Model(); Delete_Model.Service_period = row.Service_period; Delete_Model.Volunteer_number = row.Volunteer_number; Delete_sp.Add(Delete_Model); } switch (Commit_type) { case "新增": application_Unit_Model.InsertApplication_unit(application_Unit_Model); break; case "修改": application_Unit_Model.UpdateApplication_unit(application_Unit_Model); unit_Expertise_Model.DeleteUnit_Expertise(application_Unit_Model.Application_unit_no, Delete_list); unit_Service_Period_Model.DeleteUnit_service_period(application_Unit_Model.Application_unit_no, Delete_sp); break; } ; unit_Service_Period_Model.InsertUnit_service_period(application_Unit_Model.Application_unit_no, Insert_sp); unit_Expertise_Model.InsertUnit_Expertise(application_Unit_Model.Application_unit_no, Insert_list); }
public List <string> Selectexpertises_byUnit_no(int Unit_no) { Unit_expertise_Model unit_Expertise_Model = new Unit_expertise_Model(); List <string> Unit_expertise_list = unit_Expertise_Model.SelectUnit_ExpertisebyApplication_unit_no(Unit_no); List <string> unit_expertises = new List <string>(); foreach (var row in Unit_expertise_list) { unit_expertises.Add(row); } return(unit_expertises); }