Example #1
0
        private void importNextConfession_Click(object sender, EventArgs e)
        {
            publishConfessionToFBSucsessLbl.Visible = false;
            publishConfessionToFBFailLbl.Visible    = false;
            sheetData data = handler.getSheetRowData();

            if (data != null)
            {
                confessionTimeStampTxtBox.Text = data.timeStamp;
                _confessionNum        = confessionNumTxtBox.Text = data.confessionNumber.ToString();
                _pesonalIfno          = personalDetailTxtBox.Text = data.personalInfo;
                confessionTxtBox.Text = _confesionText = data.confesionText;
                excelLineTxtBox.Text  = data.excelLine.ToString();
                _sex = sexTxtBox.Text = data.Sex;


                if (!String.IsNullOrEmpty(confessionTimeStampTxtBox.Text))
                {
                    publishConfessionToFaceBook.Enabled = true;
                }
            }
            else
            {
                confessionTxtBox.Text = "היית בעייה בקריאת הוידוי";
            }
        }
Example #2
0
        public sheetData getSheetRowData()
        {
            _fullReadRange = _formName + "!A" + _readRange + ":D";
            _request       = _service.Spreadsheets.Values.Get(_spreadsheetId, _fullReadRange);

            sheetData  data                = new sheetData();
            ValueRange response            = _request.Execute();
            IList <IList <Object> > values = response.Values;

            if (values != null && values.Count > 0)
            {
                // string writeRange = "Form responses 1!";
                string personalInfo = String.Empty, text = String.Empty, timeStamp = String.Empty, sex = String.Empty;


                string phoneNumber = string.Empty;

                for (int i = 0; i < 1; i++)
                {
                    IList <Object> row = values[i];
                    if (row.ElementAtOrDefault(0) != null && row.ElementAtOrDefault(1) != null && //text and timestamp
                        row.ElementAtOrDefault(3) != null)
                    {
                        text         = row[1].ToString();
                        timeStamp    = row[0].ToString();
                        personalInfo = row[2].ToString();
                        sex          = row[3].ToString();
                        fillSpreadSheet(_service, _spreadsheetId, _formName + "!E" + (_readRange), "#" + _counter);
                        //int startIndex = text.IndexOf("$$"), endindex = -1;
                        //if (startIndex > -1)
                        //{
                        //    endindex = text.IndexOf("$$", text.IndexOf("$$") + 1);
                        //    if (endindex > -1)
                        //    {
                        //        personalInfo = text.Substring(startIndex, endindex - startIndex).Replace("$$", string.Empty);
                        //        fillSpreadSheet(_service, _spreadsheetId, _formName + "!C" + (_readRange + 1), personalInfo);
                        //        text = text.Substring(0, startIndex);
                        //    }
                        //    else
                        //    {
                        //        fillSpreadSheet(_service, _spreadsheetId, _formName + "!C" + (_readRange + 1), "no end speical end charchaters(\"$$\")");

                        //    }
                        //}


                        //fillSpreadSheet(_service, _spreadsheetId, _formName + "!D" + (_readRange + 1), "#" + _counter);
                        Debug.WriteLine("number {0} {1}, {2}", _counter, timeStamp, text);



                        _counter++;
                    }
                    else
                    {
                        text = "אין וידוי בשורה זו";
                    }


                    data.timeStamp        = timeStamp;
                    data.confesionText    = text;
                    data.confessionNumber = _counter;
                    data.personalInfo     = personalInfo;
                    data.excelLine        = _readRange;
                    data.Sex = sex;


                    _readRange++;
                }
            }
            else
            {
                Console.WriteLine("No data found.");
            }
            return(data);
        }