private void LoadFunctionNext()
        {
            List <ExcelQuestionType> infoListContent;

            InfoFileName   = (tableL2.Controls["firstControl"] as ComboBox).SelectedItem.ToString();
            ResultFileName = (tableL2.Controls["secondControl"] as ComboBox).SelectedItem.ToString();
            try
            {
                infoListContent = GetExcelService.GetProfileNamesEP(FilePath, InfoFileName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            chooseDG.Columns.Add(CommonService.CreateTextColumn("Идентификатор", "id"));
            chooseDG.Columns.Add(CommonService.CreateTextColumn("Название части анкеты", "profileName", true));
            chooseDG.Columns.Add(CommonService.CreateTextColumn("Возможные ответы", "answers", true));
            chooseDG.Columns.Add(CommonService.CreateComboColumn("Название листа", "sheetName", false, false));

            List <string> profileSheets = worksheetNames.Where(x => x != InfoFileName && x != ResultFileName).ToList();

            foreach (var item in infoListContent)
            {
                chooseDG.Rows.Add(item.Id, item.ProfileName, item.Answers);
                (chooseDG["sheetName", chooseDG.RowCount - 1] as DataGridViewComboBoxCell).Items.AddRange(profileSheets.ToArray());
                int index = 0;
                for (int i = 0; i < (chooseDG["sheetName", chooseDG.RowCount - 1] as DataGridViewComboBoxCell).Items.Count; i++)
                {
                    if ((chooseDG["sheetName", chooseDG.RowCount - 1] as DataGridViewComboBoxCell).Items[i].ToString() == item.Sheet)
                    {
                        index = i;
                        break;
                    }
                }
                chooseDG["sheetName", chooseDG.RowCount - 1].Value = (chooseDG["sheetName", chooseDG.RowCount - 1] as DataGridViewComboBoxCell).Items[index];
            }

            (tableL2.Controls["firstControl"] as ComboBox).Enabled  = false;
            (tableL2.Controls["secondControl"] as ComboBox).Enabled = false;
            acceptBtn.Text = "Принять";
        }
 public void GetMenuExcellTestApi()
 {
     string _path = AppDomain.CurrentDomain.BaseDirectory.Replace(@"UnitTestProject1\bin\Debug", "") +
                               @"ACSDining.Web\ExcelFiles\Menu.xls";
     //GetExcelController excelApi = new GetExcelController(_unitOfWork);
     GetExcelService excelService = new GetExcelService(_unitOfWork.RepositoryAsync<WeekOrderMenu>());
     WeekYearDto wyDto = new WeekYearDto
     {
         Week = 22,
         Year = 2016
     };
     ForMenuExcelDto feDto = new ForMenuExcelDto
     {
         WeekYear = wyDto,
         MenuTitle = "test string"
     };
     string result = excelService.GetMenuExcel(feDto);
     Assert.IsNotNull(result);
     Process.Start(_path);
 }
 public void GetExcellPaimentsTestApi()
 {
     //string _path = AppDomain.CurrentDomain.BaseDirectory.Replace(@"UnitTestProject1\bin\Debug", "") +
     //                          @"ACSDining.Web\ExcelFiles\Paiments.xls";
     //GetExcelController excelApi = new GetExcelController(_unitOfWork);
     GetExcelService excelService = new GetExcelService(_unitOfWork.RepositoryAsync<WeekOrderMenu>());
     WeekYearDto wyDto = new WeekYearDto
     {
         Week = 23,
         Year = 2016
     };
     ForExcelDataDto feDto = new ForExcelDataDto
     {
         WeekYear = wyDto,
         DataString = "test string"
     };
     string result = excelService.GetExcelFileFromPaimentsModel(feDto);
     Assert.IsNotNull(result);
     Process.Start(result);
 }
Exemple #4
0
        public void GetMenuExcellTestApi()
        {
            string _path = AppDomain.CurrentDomain.BaseDirectory.Replace(@"UnitTestProject1\bin\Debug", "") +
                           @"ACSDining.Web\ExcelFiles\Menu.xls";
            //GetExcelController excelApi = new GetExcelController(_unitOfWork);
            GetExcelService excelService = new GetExcelService(_unitOfWork.RepositoryAsync <WeekOrderMenu>());
            WeekYearDto     wyDto        = new WeekYearDto
            {
                Week = 22,
                Year = 2016
            };
            ForMenuExcelDto feDto = new ForMenuExcelDto
            {
                WeekYear  = wyDto,
                MenuTitle = "test string"
            };
            string result = excelService.GetMenuExcel(feDto);

            Assert.IsNotNull(result);
            Process.Start(_path);
        }
Exemple #5
0
        public void GetExcellPaimentsTestApi()
        {
            //string _path = AppDomain.CurrentDomain.BaseDirectory.Replace(@"UnitTestProject1\bin\Debug", "") +
            //                          @"ACSDining.Web\ExcelFiles\Paiments.xls";
            //GetExcelController excelApi = new GetExcelController(_unitOfWork);
            GetExcelService excelService = new GetExcelService(_unitOfWork.RepositoryAsync <WeekOrderMenu>());
            WeekYearDto     wyDto        = new WeekYearDto
            {
                Week = 23,
                Year = 2016
            };
            ForExcelDataDto feDto = new ForExcelDataDto
            {
                WeekYear   = wyDto,
                DataString = "test string"
            };
            string result = excelService.GetExcelFileFromPaimentsModel(feDto);

            Assert.IsNotNull(result);
            Process.Start(result);
        }