Example #1
0
        public bool CheckFieldAlert(string field)
        {
            ExcelUtil.SetDataSource("Job.xlsx");
            ExcelData alerts = ExcelUtil.DataSet.SelectSheet("ALERTS").GetRowByKey("Empty");

            return(CheckAlertPopUp(alerts.GetValue(field)));
        }
        private static ShareSkill ReadFromExcel(string key)
        {
            ExcelDataReaderUtil.LoadWorsheet(PathUtil.GetCurrentPath($"{TestContext.Parameters["TestDataPath"]}Mars.xlsx"), "ShareSkill");
            ExcelData data = ExcelDataReaderUtil.FetchRowUsingKey(key);

            return(ObjectFactory.CreateInstance <ShareSkill>(data));
        }
Example #3
0
        private void openButton_OldResults_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter = "Excel |*.xlsx; *.xls";

            dialog.Multiselect = true;
            dialog.Title       = "Выберите файлы со старыми результатами";

            if (!((bool)dialog.ShowDialog(this)))
            {
                return;
            }

            FileNames_OldResults = dialog.FileNames;

            this.FoldName_OldResults = System.IO.Path.GetDirectoryName(FileNames_OldResults[0]); ///записываем путь к папке для, например, первого файла из списка, т.к. предполагается, что мы берём файлы из одной папки

            TextBox_Path_OldResullts.IsEnabled = true;                                           ///активируем окошко с путём к файлу
            TextBox_Path_OldResullts.Text      = this.FoldName_OldResults;                       ///записываем путь к папке в textbox

            int l = FileNames_OldResults.Length;

            Data_OldResults = new ExcelData[l];

            for (int i = 0; i < l; i++)
            {
                ExcelData Data_OldResult = new ExcelData(FileNames_OldResults[i]);
                Data_OldResults[i] = Data_OldResult;
            }
        }
Example #4
0
    public static void Export(List <string> fileList)
    {
        // 清空多语言管理器的缓存数据
        LanguageMgr.Instance.ClearCacheLanguage();
        // 加载多语言总表
        LanguageMgr.Instance.LoadAutoGenerateLanguageToCache();

        // 加载选择的Excel文件列表
        for (int i = 0; i < fileList.Count; i++)
        {
            string    filePath  = fileList[i];
            ExcelData excelFile = new ExcelData(filePath);
            if (excelFile.Load())
            {
                if (excelFile.Export())
                {
                    // 导出成功后,我们解析表格的多语言数据
                    var data = LanguageMgr.ParseLanguage(excelFile);
                    LanguageMgr.Instance.CacheLanguage(data);
                }
            }
            excelFile.Dispose();
        }

        // 创建新的多语言总表文件
        LanguageMgr.Instance.CreateAutoGenerateLanguageFile();
        // 导出多语言总表文件
        LanguageMgr.Instance.ExportAutoGenerateLanguageFile();
    }
Example #5
0
 public void FetchDataErrors02()
 {
     using (var script = new VariableRHostScript()) {
         ExcelData xlData = ExcelInterop.GenerateExcelData("zzzzzz", 2, 2);
         xlData.Should().BeNull();
     }
 }
Example #6
0
    /// <summary>
    /// 导出生成按钮
    /// </summary>
    private void createButton_Click(object sender, EventArgs e)
    {
        // 清空多语言管理器的缓存数据
        LanguageMgr.Instance.ClearCacheLanguage();
        // 加载多语言总表
        LanguageMgr.Instance.LoadAutoGenerateLanguageToCache();

        // 加载选择的Excel文件列表
        for (int i = 0; i < fileListBox.Items.Count; i++)
        {
            string    filePath  = (string)fileListBox.Items[i];
            ExcelData excelFile = new ExcelData(filePath);
            if (excelFile.Load())
            {
                if (excelFile.Export())
                {
                    // 导出成功后,我们解析表格的多语言数据
                    var data = LanguageMgr.ParseLanguage(excelFile);
                    LanguageMgr.Instance.CacheLanguage(data);
                }
            }
            excelFile.Dispose();
        }

        // 创建新的多语言总表文件
        LanguageMgr.Instance.CreateAutoGenerateLanguageFile();
        // 导出多语言总表文件
        LanguageMgr.Instance.ExportAutoGenerateLanguageFile();

        MessageBox.Show("导表完成.");
    }
Example #7
0
        public void CreateNewRequisition(IWebDriver _driver)
        {
            ArrayList ReqList = ExcelData.GetData("RequisitionData", "Requisition");

            LinkCreateNewRequisition();
            RadioCreateNewReq(ReqList[0].ToString());
            if (ReqList[0].ToString() == "Raise an ATR for a new position")
            {
                try
                {
                    IWebElement ele = driver.FindElement(By.XPath("//td[contains(text(),'" + ReqList[1].ToString() + "')]/../td[5]/a"));
                    ele.Click();
                }
                catch (Exception)
                {
                    ExtentReport.test.Log(LogStatus.Error, "Requisition Process Template was not found in the list");
                }
                BaseMethods.ExplicitWait(_driver, "//a[text()='View / Add Recruiter Files']");
                foreach (IWebElement ele in eleTxtAnswers)
                {
                    ele.SendKeys("Answer Entered");
                }
                SaveAndContinue();
                foreach (IWebElement ele in eleTxtAnswers)
                {
                    ele.SendKeys("Answer Entered");
                }
                PreviewAndSubmit();
                SaveAndSubmit();
            }
        }
        public static object CreateInstance(Type type, ExcelData data)
        {
            var instance = Activator.CreateInstance(type);

            foreach (var propertyInfo in GetProperties())
            {
                Type propertyType   = Nullable.GetUnderlyingType(propertyInfo.PropertyType) ?? propertyInfo.PropertyType;
                var  convertedValue = ConvertToPropertyValue(propertyType, GetColumnValue(propertyInfo.Name)) ?? default;
                propertyInfo.SetValue(instance, convertedValue, null);
            }
            return(instance);

            IEnumerable <PropertyInfo> GetProperties()
            {
                foreach (var property in type.GetProperties().Where(p => p.CanWrite))
                {
                    yield return(property);
                }
            }

            string GetColumnValue(string columnName)
            {
                return(data.GetValue(columnName));
            }

            object ConvertToPropertyValue(Type propertyType, string value)
            {
                if (value == null)
                {
                    return(default);
        public void CreateMultipleSteps(IWebDriver _driver, string ConfigKey, string Sheet, string ConditionKey)
        {
            ArrayList list = null;

            if (ConfigKey == "PositionDetailsFormData")
            {
                list = ExcelData.GetData(ConfigKey, Sheet, ConditionKey, "Yes");
            }
            else
            {
                list = ExcelData.GetData(ConfigKey, Sheet, ConditionKey, _FormType);
            }
            if (list != null)
            {
                int _Count          = list.Count;
                int _actualRowCount = _Count / 4;
                int j = 1;
                for (int i = 1; i <= _actualRowCount; i++)
                {
                    AddNewFormStep();
                    StepTitle(list[j].ToString());
                    BaseMethods.TinyMCEEditor(_driver, StepDescription(), list[j + 1].ToString());
                    BaseMethods.PageScrollDown(_driver);
                    QuestionLabelWidth(_driver, list[j + 2].ToString());
                    SaveStepDetails();
                    BaseMethods.InfoLogger("Step has been added successfully");
                    j = j + 4;
                }
            }
        }
Example #10
0
    public static List <ExcelPackageData> ReadExcel(string path)
    {
        if (!File.Exists(path))
        {
            Debug.LogError($"Not Found Excel: {path}");
        }
        FileStream fs = new FileStream(path, FileMode.Open);
        List <ExcelPackageData> datas = new List <ExcelPackageData>();

        using (ExcelPackage package = new ExcelPackage(fs))
        {
            for (int i = 0; i < package.Workbook.Worksheets.Count; i++)
            {
                ExcelWorksheet   sheet = package.Workbook.Worksheets[i];
                ExcelPackageData data  = new ExcelPackageData();
                data.sheetName = sheet.Name;
                for (int j = sheet.Dimension.Start.Column, k = sheet.Dimension.End.Column; j <= k; j++)
                {
                    for (int m = sheet.Dimension.Start.Row, n = sheet.Dimension.End.Row; m <= n; m++)
                    {
                        ExcelData excelData = new ExcelData();
                        excelData.axes.row = m;
                        excelData.axes.col = j;
                        excelData.data     = sheet.GetValue(m, j);
                        data.datas.Add(excelData);
                    }
                }
                datas.Add(data);
            }
        }
        return(datas);
    }
        public void multiSelectSingleSelectLocalQuestionsActiveInactiveFormTemplate()
        {
            HomePage homepage = new HomePage(_driver);

            formTemplatepage  = new FormTemplatePage(_driver);
            ExtentReport.test = ExtentReport.extent.StartTest("multiSelectSingleSelectLocalQuestionsActiveInactiveFormTemplate");

            homepage.EperformSystemConfigurationArrowIcon.Click();
            homepage.EperformFormTemplatesOption.Click();
            formTemplatepage.addformtemplateQuestionnaireForm("FormTemplateTest", "FormType1");
            DataRow dr = ExcelData.GetData_DataTable("EP_TESTDATA", "QuestionType", "KeyName", "AddQuestionType_01").Rows[0];

            formTemplatepage.EperformAddquestionButton.Click();
            formTemplatepage.handleLocalQuestionSingleLineTextBox(dr["Single Line Text Box"].ToString(), dr["reference"].ToString(), dr["label"].ToString(), dr["required"].ToString(), dr["Readonly"].ToString());
            formTemplatepage.EperformEditButton.Click();
            formTemplatepage.EperformOptionsIcon.Click();
            BaseMethods.verifyWebElement(formTemplatepage.EperformAddOptionButton, "Add Option Button is not displayed", "Add Option Button is displayed");
            formTemplatepage.EperformAddOptionButton.Click();
            formTemplatepage.EperformOptionTextBox.SendKeys(dr["OptionTextBox"].ToString());
            formTemplatepage.EperformSubmitButton.Click();
            BaseMethods.webelementverify(formTemplatepage.EperformOptionYesText);
            Assert.IsTrue(formTemplatepage.EperformOptionYesText.Displayed, "Active Yes text is not displayed");
            ExtentReport.test.Log(LogStatus.Pass, formTemplatepage.EperformOptionYesText.Text + "is displayed");
            formTemplatepage.EperformEditButton.Click();
            formTemplatepage.EperformNoRadioButton.Click();
            formTemplatepage.EperformSubmitButton.Click();
            BaseMethods.webelementverify(formTemplatepage.EperformOptionYesText);
        }
        public void changesMadeGlobalQuestionNotReflectedInFormTemplateDevelopmentActivityForm()
        {
            HomePage homepage = new HomePage(_driver);

            formTemplatepage  = new FormTemplatePage(_driver);
            ExtentReport.test = ExtentReport.extent.StartTest("changesMadeGlobalQuestionNotReflectedInFormTemplateDevelopmentActivityForm");
            DataRow dr = ExcelData.GetData_DataTable("EP_TESTDATA", "FormTemplateTest", "KeyName", "FormType2").Rows[0];

            homepage.EperformSystemConfigurationArrowIcon.Click();
            homepage.EperformFormTemplatesOption.Click();
            formTemplatepage.addFormTemplateDevelopmentActivityForm("FormTemplateTest", "FormType2");

            formTemplatepage.addGlobalQuestion("FormTemplateTest", "FormType1");

            homepage.EperformSystemConfigurationArrowIcon.Click();
            homepage.EperformGlobalQuestionsOption.Click();

            formTemplatepage.EperformFormTemplateSearchTextBox.SendKeys(dr["GlobalQuestionType"].ToString());
            formTemplatepage.EperformFormTemplateSearchButton.Click();
            formTemplatepage.EperformEditButton.Click();
            BaseMethods.webelementverify(formTemplatepage.EperformReferenceTestbox);
            formTemplatepage.EperformNoRadioButton.Click();
            formTemplatepage.EperformReferenceTestbox.Clear();
            DataRow data = ExcelData.GetData_DataTable("EP_TESTDATA", "QuestionType", "KeyName", "AddQuestionType_01").Rows[0];

            formTemplatepage.EperformReferenceTestbox.SendKeys(data["Change reference"].ToString());
            formTemplatepage.EperformSubmitButton.Click();
            homepage.EperformSystemConfigurationArrowIcon.Click();
            homepage.EperformFormTemplatesOption.Click();

            formTemplatepage.EperformFormTemplateSearchTextBox.SendKeys(dr["FormName"].ToString());
            formTemplatepage.EperformFormTemplateSearchButton.Click();
            var edittext = formTemplatepage.EperformEditButton;
            int count    = formTemplatepage.EperformEditListButton.Count();

            try
            {
                for (int i = 0; i < count; i++)
                {
                    formTemplatepage.EperformEditButton.Click();
                    if (formTemplatepage.EperformEditButton.Displayed)
                    {
                        formTemplatepage.EperformEditButton.Click();

                        BaseMethods.webelementverify(formTemplatepage.EperformReferenceTestbox);
                        break;
                    }
                    else
                    {
                        Thread.Sleep(3000);
                        _driver.Navigate().Back();
                    }
                }
            }
            catch
            {
                Thread.Sleep(3000);
                _driver.Navigate().Back();
            }
        }
        public void previewInactiveOptions()
        {
            HomePage homepage = new HomePage(_driver);

            formTemplatepage  = new FormTemplatePage(_driver);
            ExtentReport.test = ExtentReport.extent.StartTest("previewInactiveOptions");
            DataRow dr = ExcelData.GetData_DataTable("EP_TESTDATA", "QuestionType", "KeyName", "AddQuestionType_01").Rows[0];

            formTemplatepage.addformtemplateQuestionnaireForm("FormTemplateTest", "FormType1");
            formTemplatepage.handleAddLocalQuestionMultiLineTextArea(dr[" Multi Line Text Area"].ToString(), dr["reference"].ToString(), dr["maxLength"].ToString(), dr["label"].ToString(), dr["required"].ToString(), dr["Readonly"].ToString());
            formTemplatepage.EperformEditButton.Click();
            BaseMethods.verifyWebElement(formTemplatepage.EperformReadOnlyYesRadioBtn, "The Inactive option is not displayed in local question", "The Inactive option is displayed in local question");


            formTemplatepage.EperformSubmitButton.Click();
            formTemplatepage.EperformPreviewFormLink.Click();
            IList <IWebElement> element = _driver.FindElements(By.Id("Dto_IsReadOnly_t"));

            if (element.Count != 0)
            {
                ExtentReport.test.Log(LogStatus.Pass, "The Inactive option is displayed in local question");
            }
            else
            {
                ExtentReport.test.Log(LogStatus.Pass, "The Inactive option is not displayed in local question");
            }

            formTemplatepage.EperformBackButton.Click();
        }
        public void inactiveGlobalQuestionsFormTemplate()
        {
            HomePage homepage = new HomePage(_driver);

            formTemplatepage  = new FormTemplatePage(_driver);
            ExtentReport.test = ExtentReport.extent.StartTest("inactiveGlobalQuestionsFormTemplate");
            DataRow dr = ExcelData.GetData_DataTable("EP_TESTDATA", "FormTemplateTest", "KeyName", "FormType1").Rows[0];

            homepage.EperformSystemConfigurationArrowIcon.Click();
            homepage.EperformGlobalQuestionsOption.Click();

            formTemplatepage.EperformFormTemplateSearchTextBox.SendKeys(dr["GlobalQuestionType"].ToString());
            formTemplatepage.EperformFormTemplateSearchButton.Click();

            formTemplatepage.EperformEditButton.Click();

            formTemplatepage.EperformNoRadioButton.Click();
            formTemplatepage.EperformSubmitButton.Click();

            homepage.EperformSystemConfigurationArrowIcon.Click();
            homepage.EperformFormTemplatesOption.Click();

            formTemplatepage.EperformFormTemplateSearchTextBox.SendKeys(dr["GlobalQuestionType"].ToString());
            formTemplatepage.EperformFormTemplateSearchButton.Click();
            BaseMethods.webelementverify(_driver.FindElement(By.Id("NoListRecords")));
        }
        public void verifyQuestionRoleSubmitPreviewLink()
        {
            try
            {
                HomePage homepage = new HomePage(_driver);
                formTemplatepage  = new FormTemplatePage(_driver);
                ExtentReport.test = ExtentReport.extent.StartTest("verifyQuestionRoleSubmitPreviewLink");
                DataRow dr = ExcelData.GetData_DataTable("EP_TESTDATA", "QuestionType", "KeyName", "AddQuestionType_01").Rows[0];
                formTemplatepage.addformtemplateQuestionnaireForm("FormTemplateTest", "FormType1");
                formTemplatepage.addGlobalQuestion("FormTemplateTest", "FormType1");
                formTemplatepage.handleAddLocalQuestionMultiLineTextArea(dr[" Multi Line Text Area"].ToString(), dr["reference"].ToString(), dr["maxLength"].ToString(), dr["label"].ToString(), dr["required"].ToString(), dr["Readonly"].ToString());
                DataRow data = ExcelData.GetData_DataTable("EP_TESTDATA", "RoleType", "KeyName", "RoleType_01").Rows[0];
                formTemplatepage.filledByRoles(data["RoleType"].ToString());
                formTemplatepage.EperformPreviewFormLink.Click();
                formTemplatepage.EperformPreviewFormAsDropdownIcon.Click();
                BaseMethods.DdlSelectByText(formTemplatepage.EperformPreviewFormAsDropdownIcon, data["RoleType"].ToString());
                Assert.IsTrue(formTemplatepage.EperformPreviewLinkTextformat.Displayed, "Eperform PreviewName Text not displayed");
                ExtentReport.test.Log(LogStatus.Pass, formTemplatepage.EperformPreviewLinkTextformat.Text + "is displayed before selecting Preview form");

                formTemplatepage.EperformPreviewFormAsDropdownIcon.Click();
                BaseMethods.DdlSelectByText(formTemplatepage.EperformPreviewFormAsDropdownIcon, data["RoleType"].ToString());
                Assert.IsTrue(formTemplatepage.EperformPreviewNameText.Displayed, "Eperform PreviewName Text not displayed");
                ExtentReport.test.Log(LogStatus.Pass, formTemplatepage.EperformPreviewNameText.Text + "is displayed After selecting Preview form");
                formTemplatepage.EperformBackButton.Click();
            }
            catch
            {
                formTemplatepage.EperformBackButton.Click();
            }
        }
Example #16
0
        public void DeleteRequisitionProcess(IWebDriver _driver)
        {
            ArrayList Deletelist = ExcelData.GetData("RequisitionProcessTemplateData", "Delete_RequisitionProcess");

            if (Deletelist != null && Deletelist.Count > 0)
            {
                BaseMethods.DdlSelectByText(eleDdlProcessIsActive, "All");
                for (int i = 0; i < Deletelist.Count; i++)
                {
                    string _DelName = Deletelist[i].ToString();
                    try
                    {
                        IWebElement ele = driver.FindElement(By.XPath("(//a[text()='" + _DelName + "'])[1]"));
                        ele.Click();
                    }
                    catch (NoSuchElementException)
                    {
                        BaseMethods.InfoLogger("Record not found to Delete");
                    }
                    BaseMethods.ExplicitWait(_driver, "//div[@id='productFeedbackPromptDialog']/p/a");
                    elePopUpNoThanks.Click();
                    LinkDeleteProcess();
                    Delete();
                    string PermissionsExpectedMsg = "×\r\n>   The Requisition Process Template " + _DelName + " has been deleted.   ";
                    string PermissionsActualMsg   = DivAlertMsg();
                    Assert.AreEqual(PermissionsExpectedMsg, PermissionsActualMsg);
                    BaseMethods.InfoLogger("The Requisition Process Template " + _DelName + " has been deleted");
                }
            }
        }
Example #17
0
        public void readExcel()
        {
            try
            {
                excelApp = new Excel.Application();

                string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                string path        = System.IO.Path.Combine(desktopPath, "강의자료.xlsx");
                workBook  = excelApp.Workbooks.Open(path);
                workSheet = workBook.Worksheets.get_Item(1) as Excel.Worksheet;
                Excel.Range rng = workSheet.Range[workSheet.Cells[1, 1], workSheet.Cells[7, 7]];
                //Range 데이타를 배열 (One-based array)로
                object[,] data = rng.Value;

                //excelData에 기록.
                for (int r = 2; r <= data.GetLength(1); r++)
                {
                    ExcelData.GetE_Data().Add(new ExcelData()
                    {
                        ELmsSubject = data[r, 1].ToString(), ELmsTitle = data[r, 2].ToString(), ELmsRdata = data[r, 3].ToString()
                    });
                }

                workBook.Close(true);
                excelApp.Quit();
            }
            finally
            {
                ReleaseObject(workSheet);
                ReleaseObject(workBook);
                ReleaseObject(excelApp);
            }
        }
Example #18
0
        public void CreateAsContainer(ExcelData sheet, CAsDataConfig dataConfig)
        {
            string        name         = Global.FirstCharToUpper(sheet.SheetName.Replace("'", "").Replace("$", ""));
            string        filePath     = dataConfig.folder + @"\com\game\data\container\" + name + "Container.as";
            string        templatePath = @".\Templates\AS\temp_as_res_container.vm";
            List <string> needReplace  = new List <string>();
            ArrayList     replace      = new ArrayList();

            needReplace.Add("PackageString");
            needReplace.Add("importList");
            needReplace.Add("Name");
            needReplace.Add("ContainerName");
            replace.Add(dataConfig.package);
            List <string> import = new List <string>();

            if (dataConfig.containerImport.Length > 0)
            {
                foreach (var container in dataConfig.containerImport)
                {
                    import.Add(container);
                }
            }
            replace.Add(import);
            replace.Add(name);
            replace.Add(name + "Container");
            CNVelociryHelp.CreateFileByTemplate(filePath, templatePath, needReplace, replace);
            Debug.Log(name + "Container.as文件生成完毕");
        }
Example #19
0
        public void GenerateExcel(List <ExcelData> sheets, string fileName)
        {
            var helper = new ExcelHelper();

            if (sheets.Count == 1)
            {
                ExcelData sheet = sheets[0];
                using (var stream = helper.CreateExcel(sheet.DataRows, sheet.SheetName, sheet.Headers))
                {
                    using (FileStream file = new FileStream(fileName, FileMode.Create, FileAccess.Write))
                    {
                        stream.WriteTo(file);
                        file.Close();
                        stream.Close();
                    }
                }
            }
            else
            {
                using (var stream = helper.CreateExcelWithManySheets(sheets))
                {
                    using (FileStream file = new FileStream(fileName, FileMode.Create, FileAccess.Write))
                    {
                        stream.WriteTo(file);
                        file.Close();
                        stream.Close();
                    }
                }
            }
        }
        public void verifyActionscolumnMovingquestionsUpAndDownQuestionnaireForm()
        {
            try
            {
                HomePage homepage = new HomePage(_driver);
                formTemplatepage = new FormTemplatePage(_driver);
                SelectQuestionTypePage QTypePage = new SelectQuestionTypePage(_driver);
                ExtentReport.test = ExtentReport.extent.StartTest("verifyActionscolumnMovingquestionsUpAndDownQuestionnaireForm");
                DataRow dr = ExcelData.GetData_DataTable("EP_TESTDATA", "QuestionType", "KeyName", "AddQuestionType_01").Rows[0];
                formTemplatepage.addformtemplateQuestionnaireForm("FormTemplateTest", "FormType1");
                formTemplatepage.addGlobalQuestion("FormTemplateTest", "FormType1");
                formTemplatepage.handleAddLocalQuestionMultiLineTextArea(dr[" Multi Line Text Area"].ToString(), dr["reference"].ToString(), dr["maxLength"].ToString(), dr["label"].ToString(), dr["required"].ToString(), dr["Readonly"].ToString());
                BaseMethods.verifyWebElement(formTemplatepage.EperformGlobalQuestionDeleteButton, "Eperform GlobalQuestion Delete Button is not displayed in manage form", "Eperform GlobalQuestion Delete Button is displayed in manage form");
                BaseMethods.verifyWebElement(formTemplatepage.EperformEditButton, "Eperform Edit Button is not displayed in manage form", "Eperform Edit Button is displayed in manage form");
                BaseMethods.verifyWebElement(formTemplatepage.EperformDownButton, "Eperform Down Button is not displayed in manage form", "Eperform Down Button is displayed in manage form");
                BaseMethods.verifyWebElement(formTemplatepage.EperformUpButton, "Eperform Up Button is not displayed in manage form", "Eperform Up Button is displayed in manage form");
                formTemplatepage.EperformPreviewFormLink.Click();

                BaseMethods.webelementverify(formTemplatepage.EperformPreviewLinkTextformat);
                formTemplatepage.EperformBackButton.Click();
                System.Threading.Thread.Sleep(2000);
                formTemplatepage.EperformDownButton.Click();
                formTemplatepage.EperformPreviewFormLink.Click();
                BaseMethods.webelementverify(formTemplatepage.EperformPreviewLinkTextformat);
                formTemplatepage.EperformBackButton.Click();
            }
            catch
            {
                formTemplatepage.EperformBackButton.Click();
            }
        }
Example #21
0
        public string getAllUsersFromDbExcel(string text, int num)
        {
            string    dest = HttpContext.Current.Server.MapPath("~") + "\\reports\\" + text + ".csv";
            ExcelData user = new ExcelData();

            return(user.GetAllUsersFromDbExcel("ConnectionStringPerson", "userinclass", dest));
        }
Example #22
0
        public static int GetExcelData(string excelFileName, ExcelData exceldata ,string excelpath)
        {
            DBExcelHelper test = new DBExcelHelper(excelFileName);

            if (test.LoadExcelFile())
            {
                Logger.InfoFormat("Read  Excel File Name :{0}" ,excelFileName );
                foreach (Sheetdata sheetdata in exceldata.sheetDatalist)
                {
                    test.ClearData();

                    int result = test.GetContent(sheetdata.sheetName);

                    Logger.InfoFormat("Get  Sheet Content :{0}", sheetdata.sheetName);

                    if (0 == result)
                    {
                        string outfilename = Directory.GetCurrentDirectory() + excelpath + "temp/" + exceldata.GetFileName() + "." + sheetdata.sheetName + ".txt";

                        SaveExcelData(outfilename, test.outstring);
                    }

                }

                test.Close();
            }
            return 0;
        }
Example #23
0
        private void exportDataToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ExcelData excelForm = new ExcelData();

            excelForm.ShowDialog();
            tb_barcode.Focus();
        }
        internal static void LoadExcelDataCSV(string assetBundleName, string assetName, Stream stream)
        {
            ExcelData excelData = (ExcelData)ScriptableObject.CreateInstance(typeof(ExcelData));

            excelData.list = new List <ExcelData.Param>();
            using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
            {
                while (!reader.EndOfStream)
                {
                    string line = reader.ReadLine().Trim();

                    ExcelData.Param param = new ExcelData.Param {
                        list = line.Split(',').ToList()
                    };

                    excelData.list.Add(param);
                }
            }

            if (!ExternalExcelData.ContainsKey(assetBundleName))
            {
                ExternalExcelData[assetBundleName] = new Dictionary <string, ExcelData>();
            }
            ExternalExcelData[assetBundleName][assetName] = excelData;
        }
        public void TestThatExcelFileDataConstructorSetCorrectValuesOfExcelDataModel()
        {
            var exceldata = new ExcelData
            {
                Headers = new List <string>
                {
                    "Header1"
                },
                DataRows = new List <List <string> >
                {
                    new List <string> {
                        "Data1"
                    },
                    new List <string> {
                        "Data2"
                    }
                },
                SheetName = "Sheet"
            };

            var excelFileData = new ExcelFileData(exceldata);

            Assert.AreEqual(1, excelFileData.Headers.Count);
            Assert.AreEqual(2, excelFileData.DataRows.Count);
            Assert.AreEqual(1, excelFileData.DataRows[0].Count);
            Assert.AreEqual(1, excelFileData.DataRows[1].Count);
            Assert.AreEqual("Header1", excelFileData.Headers.First());
            Assert.AreEqual("Data1", excelFileData.DataRows[0].First());
            Assert.AreEqual("Data2", excelFileData.DataRows[1].First());
            Assert.AreEqual("Sheet", excelFileData.SheetName);
        }
Example #26
0
 public ArticleShedulerPage(IWebDriver driver) : base(driver)
 {
     Driver = driver;
     ExcelUtil.SetDataSource("articleScheduler.xlsx");
     CreateArticle = ExcelUtil.DataSet.SelectSheet("articlescheduler").GetRowByKey("valid");
     //UpdateArticle = ExcelUtil.DataSet.SelectSheet("articlescheduler").GetRowByKey("editarticle");
 }
Example #27
0
    public static void ReadExcelCreationCs()
    {
        string        path = Application.dataPath.Replace("Assets", "DataExcel");
        DirectoryInfo root = new DirectoryInfo(path);

        FileInfo[] FileInfoArr = root.GetFiles();

        List <ExcelData> eDataList = new List <ExcelData>();

        foreach (FileInfo f in FileInfoArr)
        {
            if (f.Extension == ".xlsx")
            {
                ExcelData eData = Helper.GetExcelData(f.FullName, f.Name.Replace(f.Extension, ""));
                if (eData != null)
                {
                    eDataList.Add(eData);
                }
            }
        }

        CreationDBTypeCs(eDataList);

        AssetDatabase.Refresh();
    }
Example #28
0
        public void Export(ExcelData excelData)
        {
            var info = excelData.Table;

            if (info == null)
            {
                return;
            }

            List <string> desc, types, keys;

            Filter(info, out desc, out types, out keys);

            string tableName = desc[0];

            List <List <string> > appendDesc = new List <List <string> >();

            if (GlobalSetting.ServerAppendNote)
            {
                appendDesc.Add(desc);
            }

            if (GlobalSetting.ServerAppendType)
            {
                appendDesc.Add(types);
            }


            OleDbExcel.RemoveFirstColumu(ref appendDesc);
            OleDbExcel.RemoveFirstColumu(ref info);

            ExcelConvert excelConvert = new ExcelConvert();

            excelConvert.Export(GlobalSetting.ServerOutputPath + "/" + tableName + "_Server.xlsx", "Server", info, types, appendDesc);
        }
Example #29
0
        public void CreateRequisitionProcessTemplate(string ConfigKey, string SheetName, string CondKey, string CondValue)
        {
            ArrayList list = ExcelData.GetData(ConfigKey, SheetName, CondKey, CondValue);

            if (list != null && list.Count > 0)
            {
                LinkCreateRequisitionProcessTemplate();
                int Count = list.Count;
                Count = Count / 5;
                int j = 1;
                for (int i = 0; i < Count; i++)
                {
                    TxtProcessName(list[j].ToString());
                    BaseMethods.DdlSelectByText(eleDdlProcessJobId, list[(j + 1)].ToString());
                    BaseMethods.SelectCheckBox(eleChkProcessIsActive, list[(j + 2)].ToString(), "Is Active");
                    Save();
                    string ExpectedValue = "×\r\n>   Active process must have at least one step and rule.    >   Process configuration incomplete, process set to inactive.   ";
                    string ActualValue   = DivAlertMsg();
                    Assert.AreEqual(ExpectedValue, ActualValue);
                    CreateStep(list[(j + 3)].ToString());
                    CreateRule();
                    BaseMethods.SelectCheckBox(eleChkProcessIsActive, "Yes", "Is Active");
                    Save();
                }
            }
        }
        public void CreateExcelFile_BlankCtor_Test()
        {
            // Arrange
            // path and sheet info for the excel file
            string       path          = Path.GetTempPath() + Guid.NewGuid() + ".xlsx";
            const string worksheetName = "test";

            IExcelData excelData = new ExcelData(path);

            // Act
            excelData.CreateExcelWorkSheet(path, worksheetName);

            // Assert
            bool exists = File.Exists(path);

            Assert.IsTrue(exists);
            Assert.IsTrue(excelData.Package != null);
            Assert.IsTrue(excelData.Worksheet != null);
            Assert.AreEqual(worksheetName, excelData.Worksheet.Name);

            // Now delete the excel file, as to not create hundreds of them on disk
            excelData.DeleteExcelFile();
            bool noLongerExists = File.Exists(path);

            Assert.IsFalse(noLongerExists);
        }
Example #31
0
        public static IResult GenerateExcel(IAccount account)
        {
            IResult result = new Result();

            try
            {
                ITable table = new Table();
                table.Data.Add(new Cell(1, 1), ExcelTableType.Time.ToString());
                table.Data.Add(new Cell(1, 2), ExcelTableType.Name.ToString());
                table.Data.Add(new Cell(1, 3), ExcelTableType.Description.ToString());
                table.Data.Add(new Cell(1, 4), ExcelTableType.Type.ToString());
                table.Data.Add(new Cell(1, 5), ExcelTableType.Money.ToString());
                table.Data.Add(new Cell(1, 6), ExcelTableType.Currency.ToString());

                AddTransactionsTable(table, account.Transactions, new Cell(2, 1));

                using (ExcelWriter writer = new ExcelWriter())
                {
                    ExcelData data = new ExcelData(1, 1, table);
                    writer.Write(data, GetFilePath(account));
                }

                result.Success = true;
                result.Message = MessageType.Success.ToString();
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.Message = ex.Message;
            }
            return(new Result());
        }
Example #32
0
    public void Parse(XmlNode doc)
    {
        XmlNodeList roots = doc.SelectNodes("ConfigData");
        if (roots.Count == 0)
        {
            throw new Exception("ExcelFile not found!");
        }
        if (roots.Count > 1)
        {
            throw new Exception("ExcelFile  Error!");
        }

        XmlNode root = roots[0];

        XmlAttribute xmlName = root.Attributes["Serverpath"];
        if (xmlName == null)
        {
            throw new Exception("protocol no [Serverpath] atrribute!");
        }

        ServerPath = xmlName.Value;

        xmlName = root.Attributes["ClientPath"];
        if (xmlName == null)
        {
            throw new Exception("protocol no [ClientPath] atrribute!");
        }

        ClientPath = xmlName.Value;

        xmlName = root.Attributes["Excelpath"];
        if (xmlName == null)
        {
            throw new Exception("protocol no [Excelpath] atrribute!");
        }

        Excelpath = xmlName.Value;

        //define

        XmlNodeList xmldefinesList = root.SelectNodes("ExcelFile");
        for (int i = 0; i < xmldefinesList.Count; i++)
        {
            XmlNode xmldefines = xmldefinesList[i];
            ExcelData excelData = new ExcelData();
            excelData.Parse(xmldefines);

            excelDatalist.Add(excelData);

        }
    }
Example #33
0
    /**
     * 	请将获得的ExcelData保存,避免重复读表
     *
     */
    public static void TryGet(string fileName,out ExcelData ed)
    {
        ed = null;

        UGExcelDataSource[] eds = GameObject.Find("UGLocalData").GetComponents<UGExcelDataSource>();

        for(int i = 0;i < eds.Length;i++)
        {

            if(eds[i].FileName == fileName)
            {
                ed = eds[i].data;
                break;
            }
        }
    }
    public void ReadSheetActionRow(string sheetName, ExcelData excelRowAction)
    {
        DataSet sheet1 = new DataSet();
        string selectSql = @"SELECT * FROM [" + sheetName + "$]";
        using (OleDbDataAdapter adapter =
            new OleDbDataAdapter(selectSql, this.oleDbConnection))
        {
            adapter.Fill(sheet1);
        }

        var table = sheet1.Tables[0];
        foreach (DataRow row in table.Rows)
        {
            excelRowAction(row);
        }
    }
Example #35
0
        // -------------------------------------------------------------------
        // Private
        // -------------------------------------------------------------------
        private void Format(ExcelData data, StringBuilder target)
        {
            for (int i = 0; i < data.Sheets.Count; i++)
            {
                ExcelDataSheet sheet = data.Sheets[i];
                if (sheet.Data == null || sheet.Data.Count <= 0)
                {
                    Diagnostic.Warning(
                        "Invalid or empty Excel Sheet Data in {0}.{1}",
                        data.FileName,
                        sheet.Name);
                    continue;
                }

                if (sheet.IsArrayData)
                {
                    this.FormatArrayData(sheet, target);
                }
                else
                {
                    if (sheet.Columns == null || sheet.Columns.Count <= 0)
                    {
                        Diagnostic.Warning(
                            "Invalid or empty columns for Sheet Data in {0}.{1}",
                            data.FileName,
                            sheet.Name);
                        continue;
                    }

                    this.FormatData(sheet, target);
                }

                if (i < data.Sheets.Count - 1)
                {
                    target.AppendLine(",");
                }
            }
        }
    public void ReadSheetActionRow(string sheetName, ExcelData excelRowAction)
    {
        DataSet sheet1 = new DataSet();
        string selectSql = @"SELECT * FROM [" + sheetName + "$]";
        using (OleDbDataAdapter adapter =
            new OleDbDataAdapter(selectSql, this.oleDbConnection))
        {
            adapter.Fill(sheet1);
        }

        var table = sheet1.Tables[0];
        foreach (DataRow row in table.Rows)
        {
            List<object> currentRow = new List<object>(table.Columns.Count);
            foreach (DataColumn column in table.Columns)
            {
                if (row[column] + "" != "")
                {
                    currentRow.Add(row[column]);
                }
            }
            excelRowAction(currentRow);
        }
    }
Example #37
0
 // Use this for initialization
 void Start()
 {
     _excelData = new ExcelData();
     _excelData.OpenFile(_fileName,_fileType);
     //		DisplayDataToEditor();
 }
 void Awake()
 {
     cleanitems = new GameObject[2,6];
     count = this.GetComponent<Count>();
     //UI Initialize
     stage_level = PlayerPrefs.GetInt("Stage");
     item_gauge = GameObject.Find("Canvas/Weapon/Gauge").GetComponent<Image>();
     life_gauge = GameObject.Find("Canvas/Life/LifeGauge").GetComponent<Image>();
     level_ui = GameObject.Find("Canvas/Weapon/Level").GetComponent<Text>();
     //Item Initialize
     playermv = GameObject.Find("Player").GetComponent<PlayerMove>();
     kindobject = new GameObject[]{
         Resources.Load<GameObject>("Prefabs/Item"),
         Resources.Load<GameObject>("Prefabs/ExplosionAOE")
     };
     exceldata = Resources.Load("Pattern/patternlist") as ExcelData;
     tower = GameObject.Find("Tower");
     center = Vector3.zero;
     //if(stage_level > 0){
         gamestartflag = true;
     //}
 }