Exemplo n.º 1
0
        public void AddReferenceData(string _ColumeHead, string _writedata)
        {
            DataTable dtReport   = new DataTable();
            int       columindex = 0;

            try
            {
                if (refcount == 0)
                {
                    dtReport.Clear();
                    dtReport = ExcelKeywordTable.ExcelData(DataFilePath, "sheet1");
                    if (dtReport.Rows.Count >= 1)
                    {
                        CreateDynamicFile(_ColumeHead);
                        AddData(_ColumeHead, _writedata);
                    }
                    refcount++;
                }
                else
                {
                    dtReport.Clear();
                    dtReport = ExcelKeywordTable.ExcelData(DataFilePath, "sheet1");
                    int rowindex = dtReport.Rows.Count;
                    wSheet.Cells[rowindex + 1, columindex]     = new Cell(_writedata);
                    wSheet.Cells[rowindex + 1, columindex + 1] = new Cell("0");
                    wBook.Save(DataFilePath);
                }
            }
            catch (Exception e)
            {
                throw new Exception("Error while writing reference data to the File.");
            }
        }
Exemplo n.º 2
0
        public void FileCorreptionCheck()
        {
            try
            {
                if (new System.IO.FileInfo(DetailedReportFilePath).Length < 8192)
                {
                    DataTable dtReport = new DataTable();
                    dtReport.Clear();
                    dtReport = ExcelKeywordTable.ExcelData(DetailedReportFilePath, LoginOperatrion.batchforReport + "_" + LoginOperatrion.requiredPlant);

                    Workbook  loadBook  = Workbook.Load(DetailedReportFilePath);
                    Worksheet loadSheet = loadBook.Worksheets[0];

                    int rowindex   = dtReport.Rows.Count;
                    int columindex = 0;

                    if (rowindex <= 80)
                    {
                        int rows = 100 - rowindex;
                        for (int i = 0; i < rows; i++)
                        {
                            columindex = 25;
                            loadSheet.Cells[rowindex, columindex] = new Cell(" ");
                            rowindex++;
                        }
                    }
                    loadBook.Save(DetailedReportFilePath);
                }
            }
            catch (Exception e) { }
        }
Exemplo n.º 3
0
        public void FileCorreptionCheck()
        {
            try
            {
                if (new System.IO.FileInfo(DataFilePath).Length < 8192)
                {
                    DataTable dtReport = new DataTable();
                    dtReport.Clear();
                    dtReport = ExcelKeywordTable.ExcelData(DataFilePath, "sheet1");
                    int rowindex   = dtReport.Rows.Count;
                    int columindex = 0;

                    if (rowindex <= 80)
                    {
                        int rows = 150 - rowindex;
                        for (int i = 0; i < rows; i++)
                        {
                            columindex = 0;
                            wSheet.Cells[rowindex + 1, columindex] = new Cell("");
                            rowindex++;
                        }
                    }
                    wBook.Save(DataFilePath);
                }
            }
            catch (Exception e) { }
        }
Exemplo n.º 4
0
        public void AddData(string ColumHead, string WriteData)
        {
            DataTable dtReport = new DataTable();

            dtReport.Clear();
            dtReport = ExcelKeywordTable.ExcelData(DataFilePath, "sheet1");
            getColumeIndexData(dtReport.Columns.Count, ColumHead);
            wSheet.Cells[1, writecolumeIndex] = new Cell(WriteData);
            refcount++;
            wBook.Save(DataFilePath);
        }
Exemplo n.º 5
0
        public void RecordFailReport(string _Stepno, string _Description, string _Keywords, string _Status, string _Batch, string _Filepath, string _RecordedData)
        {
            try
            {
                Workbook  loadBook  = Workbook.Load(_Filepath);
                Worksheet loadSheet = new Worksheet(_Batch + "_" + LoginOperatrion.requiredPlant);
                DataTable dtReport  = new DataTable();
                dtReport.Clear();
                dtReport = ExcelKeywordTable.ExcelData(_Filepath, _Batch + "_" + LoginOperatrion.requiredPlant);

                if (dtReport == null)
                {
                    AddNewSheet(loadBook, loadSheet, _Batch, _Filepath);
                    dtReport = ExcelKeywordTable.ExcelData(_Filepath, _Batch + "_" + LoginOperatrion.requiredPlant);
                }
                int e = loadBook.Worksheets.Count - 1;
                loadSheet = loadBook.Worksheets[e];

                int rowindex   = dtReport.Rows.Count;
                int columindex = 0;

                loadSheet.Cells[rowindex + 1, columindex] = new Cell(_Stepno);
                columindex++;
                loadSheet.Cells[rowindex + 1, columindex] = new Cell(_Description);
                columindex++;
                loadSheet.Cells[rowindex + 1, columindex] = new Cell(_Keywords);
                columindex++;
                loadSheet.Cells[rowindex + 1, columindex] = new Cell(_Status);
                columindex++;
                loadSheet.Cells[rowindex + 1, columindex] = new Cell(_RecordedData);

                if (_Keywords != "Wait" && _Keywords != "SearchDataOperation" && _Keywords != "WaitPageLoad")
                {
                    if (rowindex <= 80)
                    {
                        int rows = 100 - rowindex;
                        for (int i = 0; i < rows; i++)
                        {
                            columindex = 25;
                            loadSheet.Cells[rowindex, columindex] = new Cell(" ");
                            rowindex++;
                        }
                    }
                }
                loadBook.Save(_Filepath);
            }
            catch (Exception e) { }
        }
Exemplo n.º 6
0
        public void UpdateData(string _Stepno, string _Description, string _Keywords, string _Status, string _Batch, string _Filepath, string _RecordedData)
        {
            try
            {
                Workbook  loadBook  = Workbook.Load(_Filepath);
                Worksheet loadSheet = new Worksheet(_Batch + "_" + LoginOperatrion.requiredPlant);

                DataTable dtReport = new DataTable();
                dtReport.Clear();
                dtReport = ExcelKeywordTable.ExcelData(_Filepath, _Batch + "_" + LoginOperatrion.requiredPlant);

                if (dtReport == null)
                {
                    AddNewSheet(loadBook, loadSheet, _Batch, _Filepath);
                    dtReport = ExcelKeywordTable.ExcelData(_Filepath, _Batch + "_" + LoginOperatrion.requiredPlant);
                }
                int e = loadBook.Worksheets.Count - 1;

                loadSheet = loadBook.Worksheets[e];

                int rowindex   = dtReport.Rows.Count;
                int columindex = 0;
                loadSheet.Cells[rowindex + 1, columindex] = new Cell(_Stepno);
                columindex++;
                loadSheet.Cells[rowindex + 1, columindex] = new Cell(_Description);
                columindex++;
                loadSheet.Cells[rowindex + 1, columindex] = new Cell(_Keywords);
                columindex++;
                loadSheet.Cells[rowindex + 1, columindex] = new Cell(_Status);
                columindex++;
                loadSheet.Cells[rowindex + 1, columindex] = new Cell(_RecordedData);


                loadBook.Save(_Filepath);
            }
            catch (Exception e) { }
        }
Exemplo n.º 7
0
        public void AddDataForReference(string _Filepath, string _columhead, string _writeData, string referencedata)
        {
            try
            {
                DataTable dtReport = new DataTable();
                dtReport.Clear();
                dtReport = ExcelKeywordTable.ExcelData(_Filepath, "sheet1");
                int    columeindex        = dtReport.Columns.Count;
                int    rowindex           = dtReport.Rows.Count;
                int    referenceDataCount = 0;
                string material           = string.Empty;
                var    Wbook  = Workbook.Load(DataFilePath);
                var    Wsheet = Wbook.Worksheets[0];

                #region RR
                if (referencedata.Contains(','))
                {
                    string[] MatchData = referencedata.Split(',');
                    if (MatchData.Count() > 1)
                    {
                        if (MatchData[0].StartsWith("Rec_"))
                        {
                            material = Operation.recordedData[MatchData[0].Replace("Rec_", string.Empty)].ToString();
                        }
                        else if (MatchData[0].StartsWith("Order"))
                        {
                            material = ExcelDataTable.ReadRefferenceInfoByOrder(MatchData[0].Split('=')[1], "Material");
                        }
                        else
                        {
                            material = ExcelDataTable.ReadData(1, MatchData[0]);
                        }

                        if (MatchData[1].Contains('+'))
                        {
                            string Store = ExcelDataTable.ReadData(1, MatchData[1].Split('+')[0]);
                            referencedata = material + ':' + ExcelDataTable.ReadRefferenceInfoByMaterialWithStore(Store, material, MatchData[1].Split('=')[1]);
                        }
                        else if (MatchData[1].StartsWith("Store"))
                        {
                            referencedata = ExcelDataTable.ReadData(1, MatchData[1].Split('=')[0]) + ':' + material;
                        }
                        getRefferenceIndexData(rowindex, columeindex, referencedata);
                    }
                    else
                    {
                        referencedata = ExcelDataTable.ReadData(1, MatchData[0]);
                    }
                }
                #endregion

                getColumeIndexData(columeindex, _columhead);
                if (writecolumeIndex == 0)
                {
                    Wsheet.Cells[0, columeindex] = new Cell(_columhead);
                    Wbook.Save(_Filepath);
                    getColumeIndexData(columeindex, _columhead);
                    getRefferenceIndexData(rowindex, columeindex, referencedata);
                    if (writeRowIndex.Contains(','))
                    {
                        string[] rowcount = writeRowIndex.Split(',');
                        foreach (var row in rowcount)
                        {
                            if (row != string.Empty)
                            {
                                Wsheet.Cells[Convert.ToInt16(row), columeindex] = new Cell(_writeData);
                            }
                        }
                    }
                    else
                    {
                        Wsheet.Cells[Convert.ToInt16(writeRowIndex), columeindex] = new Cell(_writeData);
                    }
                }
                else
                {
                    getRefferenceIndexData(rowindex, columeindex, referencedata);
                    if (referencedata.Contains(':'))
                    {
                        if (writeRowIndex.Contains(','))
                        {
                            string[] rowcount = writeRowIndex.Split(',');
                            foreach (var row in rowcount)
                            {
                                if (row != string.Empty)
                                {
                                    Wsheet.Cells[Convert.ToInt16(row), writecolumeIndex] = new Cell(_writeData);
                                }
                            }
                        }
                    }
                    else
                    {
                        for (int a = 1; a <= rowindex; a++)
                        {
                            if (Wsheet.Cells[a, 0].StringValue == referencedata)
                            {
                                referenceDataCount++;
                            }
                        }
                        if (referenceDataCount > 1)
                        {
                            Wsheet.Cells[Convert.ToInt16(writeRowIndex) + 1, writecolumeIndex] = new Cell(_writeData);
                        }
                        else
                        {
                            Wsheet.Cells[Convert.ToInt16(writeRowIndex), writecolumeIndex] = new Cell(_writeData);
                        }
                    }
                }
                Wsheet.Cells.ColumnWidth[0, (ushort)columeindex] = 5000;
                Wbook.Save(_Filepath);
            }
            catch (Exception e)
            {
                throw new Exception("Error while writing data for the reference data.");
            }
        }