public async Task <ModelMenuC2_InterfaceData> MenuC2InterfaceDataAsync(string userid, string username) { ModelMenuC2_InterfaceData resp = new ModelMenuC2_InterfaceData(); resp.ListAssigner = new List <ModelSelectOption>(); ModelSelectOption assigner_login = new ModelSelectOption(); assigner_login.value = userid; assigner_login.label = username + " (เช้าสู่ระบบ)"; resp.default_assigner_name = assigner_login.label; resp.default_assigner_seq = "0"; //Default 0 ไม่มีผล resp.ListAssigner.Add(assigner_login); int thai_year = CommonData.GetYearOfPeriod(); resp.ListYearOfProject = new List <ModelSelectOption>(); ModelSelectOption year_current = new ModelSelectOption(); year_current.value = (thai_year).ToString(); year_current.label = (thai_year).ToString(); resp.defaultyear = (thai_year); resp.ListYearOfProject.Add(year_current); ModelCountOfYear round_of_year = new ModelCountOfYear(); round_of_year = await _IDocMeetingRoundRepository.GetMeetingRoundOfProjectAsync(resp.defaultyear); resp.defaultround = round_of_year.count; resp.ListProjectNumber = new List <ModelSelectOption>(); resp.UserPermission = await _IRegisterUserRepository.GetPermissionPageAsync(userid, "M012"); if (resp.UserPermission != null && resp.UserPermission.alldata == true) { resp.ListProjectNumber = await GetAllProjectAsync("", "C2"); } else { resp.ListProjectNumber = await GetAllProjectAsync(userid, "C2"); } resp.ListSafetyType = new List <ModelSelectOption>(); resp.ListSafetyType = null; resp.ListApprovalType = new List <ModelSelectOption>(); resp.ListApprovalType = null; return(resp); }
public async Task <IActionResult> MenuC2InterfaceDataEdit(int docid, string userid, string username) { ModelMenuC2_InterfaceData e = await _IDocMenuCService.MenuC2InterfaceDataEditAsync(docid, userid, username); if (e != null) { return(Ok(e)); } else { return(BadRequest()); } }
public async Task <ModelMenuC2_InterfaceData> MenuC2InterfaceDataEditAsync(int docid, string userid, string username) { ModelMenuC2_InterfaceData resp = new ModelMenuC2_InterfaceData(); resp.UserPermission = await _IRegisterUserRepository.GetPermissionPageAsync(userid, "M012"); resp.editdata = new ModelMenuC2(); resp.editdata = await GetMenuC2DataEditAsync(docid, userid, resp.UserPermission); resp.ListAssigner = new List <ModelSelectOption>(); ModelSelectOption assigner_login = new ModelSelectOption(); assigner_login.value = resp.editdata.assignercode; assigner_login.label = resp.editdata.assignername; resp.default_assigner_name = assigner_login.label; resp.default_assigner_seq = "0"; //Default 0 ไม่มีผล resp.ListAssigner.Add(assigner_login); resp.ListProjectNumber = new List <ModelSelectOption>(); ModelSelectOption project_name_default = new ModelSelectOption() { value = resp.editdata.projectnumber, label = resp.editdata.projectnumber + " : " + resp.editdata.projectnamethai, }; resp.ListProjectNumber.Add(project_name_default); resp.ListYearOfProject = new List <ModelSelectOption>(); ModelSelectOption year_current = new ModelSelectOption(); year_current.value = resp.editdata.yearofmeeting; year_current.label = resp.editdata.yearofmeeting; resp.defaultyear = Convert.ToInt32(resp.editdata.yearofmeeting); resp.defaultround = Convert.ToInt32(resp.editdata.roundofmeeting); resp.ListYearOfProject.Add(year_current); return(resp); }