Ejemplo n.º 1
0
        public void EditReview(string strReviewID)
        {
            clsDB objDB = new clsDB(strDB);

            ReviewID = strReviewID;

            string SQL = "Select Review.ID as ReviewID,Consumer.ID as ConsumerID, strftime('%m/%d/%Y',Date) as Date, DesiredOutcome, Barriers, Note, Meeting.Description as Meeting, Meeting.ID as MeetingID";

            SQL = SQL + " , Job_ID, Job.Title as Job, Job.Description as JobDescription, Job.Employer, Job.Address, Job.City, Job.Zip, strftime('%m/%d/%Y',Job.PlacementDate) as PlacementDate, Staff_ID";
            SQL = SQL + " , Review.TimeIn, Review.TimeOut, Consumer.FirstName || ' ' || Consumer.LastName as Consumer";
            SQL = SQL + " From Review";
            SQL = SQL + " Join Meeting on Review.Meeting_ID = Meeting.ID";
            SQL = SQL + " Left Join Job on Review.Job_ID = Job.ID";
            SQL = SQL + " Join Consumer on Review.Consumer_ID=Consumer.ID";
            SQL = SQL + " WHERE Review.Id =" + strReviewID;

            SQLiteDataReader objReader = objDB.returnDataReader(SQL);

            clsFormat objFormat = new clsFormat();

            while (objReader.Read())
            {
                ReviewID            = objReader["ReviewID"].ToString();
                StaffID             = objReader["Staff_ID"].ToString();
                JobID               = objReader["Job_ID"].ToString();
                MeetingID           = objReader["MeetingID"].ToString();
                ID                  = objReader["ConsumerID"].ToString();
                dtDate.Text         = objReader["Date"].ToString();
                txtOutcome.Text     = objReader["DesiredOutcome"].ToString();
                txtBarriers.Text    = objReader["Barriers"].ToString();
                txtDetails.Text     = objReader["Note"].ToString();
                cmbMeeting.Text     = objReader["Meeting"].ToString();
                txtJob.Text         = objReader["Job"].ToString();
                txtDescription.Text = objReader["JobDescription"].ToString();
                txtEmployer.Text    = objReader["Employer"].ToString();
                txtAddress.Text     = objReader["Address"].ToString();
                txtCity.Text        = objReader["City"].ToString();
                txtZip.Text         = objReader["Zip"].ToString();
                txtPlacement.Text   = objReader["PlacementDate"].ToString();

                DateTime dtTime = objReader.GetDateTime(objReader.GetOrdinal("TimeIn"));
                dtTimeIn.Text = objFormat.convertTime_12hr(dtTime);

                dtTime         = objReader.GetDateTime(objReader.GetOrdinal("TimeOut"));
                dtTimeOut.Text = objFormat.convertTime_12hr(dtTime);

                txtConsumer.Text = objReader["Consumer"].ToString();

                butEnter.Text = "Update";
            }
        }
Ejemplo n.º 2
0
        private void writeActivityLog_XML(SQLiteDataReader objReader)
        {
            clsFormat objFormat = new clsFormat();

            strActivityLogPath = strActivityLogPath + "ActivityLog.xml";
            XmlWriter xmlWrite = XmlWriter.Create(strActivityLogPath);

            xmlWrite.WriteStartDocument();
            xmlWrite.WriteStartElement("ActivityLog");
            xmlWrite.WriteElementString("Header", "");
            xmlWrite.WriteStartElement("Body");
            while (objReader.Read())
            {
                xmlWrite.WriteElementString("Consumer", objReader["Consumer"].ToString());
                xmlWrite.WriteStartElement("Employer");
                xmlWrite.WriteElementString("Name", objReader["Employer"].ToString());
                xmlWrite.WriteStartElement("Location");
                xmlWrite.WriteElementString("Address", objReader["Address"].ToString());
                xmlWrite.WriteElementString("CityStateZip", objReader["CityStateZip"].ToString());
                xmlWrite.WriteEndElement();
                xmlWrite.WriteEndElement();
                xmlWrite.WriteStartElement("Review");
                xmlWrite.WriteStartElement("Info");
                xmlWrite.WriteElementString("Date", objReader["Date"].ToString());
                xmlWrite.WriteElementString("MeetingType", objReader["MeetingType"].ToString());

                string Time = objFormat.convertTime_12hr(objReader.GetDateTime(objReader.GetOrdinal("TimeIn")));
                xmlWrite.WriteElementString("TimeIn", Time);
                Time = objFormat.convertTime_12hr(objReader.GetDateTime(objReader.GetOrdinal("TimeOut")));
                xmlWrite.WriteElementString("TimeOut", Time);
                xmlWrite.WriteEndElement();

                //xmlWrite.WriteElementString("WaiverEnrolled", objReader["WaiverEnrolled"].ToString());
                xmlWrite.WriteElementString("ValuedOutcome", objReader["ValuedOutcome"].ToString());
                xmlWrite.WriteElementString("Barriers", objReader["Barriers"].ToString());
                xmlWrite.WriteElementString("Notes", objReader["Notes"].ToString());
                xmlWrite.WriteEndElement();      //Review

                xmlWrite.WriteEndElement();      //Body
            }
            xmlWrite.WriteStartElement("Footer");
            xmlWrite.WriteElementString("Date", DateTime.Now.ToShortDateString());
            xmlWrite.WriteEndElement();

            xmlWrite.WriteEndElement();
            xmlWrite.Close();

            objReader.Close();
        }
Ejemplo n.º 3
0
        // will take time and add 1/2 hour to out time, or remove 1/2 hour from output time
        private string updateTime(string Update, string strTime)
        {
            TimeSpan NewTime;

            if (Update == "out")
            {
                NewTime = Convert.ToDateTime(strTime).AddMinutes(60).TimeOfDay;
            }
            else
            {
                NewTime = Convert.ToDateTime(strTime).AddMinutes(-60).TimeOfDay;
            }

            clsFormat objFormat = new clsFormat();
            string    strOutput = objFormat.convertTime_12hr(NewTime);

            return(strOutput);
        }
Ejemplo n.º 4
0
        public void fillGrid(SQLiteDataReader objReader, int ColStart, ref DataGridView Grid, Graphics objGraphics)
        {
            clsFormat objFormat = new clsFormat();

            int[] colW = new int[objReader.FieldCount];

            //Setting rows and columns
            Grid.Columns.Clear();
            Grid.Rows.Clear();
            int Row = 0;

            Grid.ColumnCount = objReader.FieldCount;

            //Adding Data
            while (objReader.Read())
            {
                SizeF objSize;
                Grid.Rows.Add();

                for (int Col = 0; Col < objReader.FieldCount; Col++)
                {
                    if (Row == 0)
                    {
                        string strHeader = objReader.GetName(Col);
                        Grid.Columns[Col].HeaderText = objReader.GetName(Col);
                        objSize = objGraphics.MeasureString(objReader.GetName(Col), Grid.Font);
                        if (Col >= ColStart)
                        {
                            colW[Col] = (int)objSize.Width;
                        }
                    }

                    string strValue = "";
                    if (objReader.GetDataTypeName(Col) == "Time")
                    {
                        strValue = objFormat.convertTime_12hr(objReader.GetDateTime(Col));
                    }
                    else
                    {
                        strValue = objReader[Col].ToString();
                    }

                    objSize = objGraphics.MeasureString(strValue.Trim(), Grid.Font);
                    if (objSize.Width > colW[Col] && Col > 0)
                    {
                        if (Col >= ColStart)
                        {
                            colW[Col] = (int)objSize.Width;
                        }
                    }

                    Grid[Col, Row].Value = strValue;
                }

                Row++;
            }

            //                grdActivity.AutoResizeColumns();
            AdjustGrid(colW, Grid.Columns.Count - ColStart, ColStart, ref Grid);


            if (Grid.RowCount > 0)
            {
                Grid.Rows[0].Selected = false;
            }
        }
Ejemplo n.º 5
0
        private void writeMonthlyActivityLog_XML(SQLiteDataReader objReader)
        {
            clsFormat objFormat    = new clsFormat();
            float     fltTotalTime = 0;

            strActivityLogPath = strActivityLogPath + "MonthlyActivityLog.xml";
            ArrayList strBarriers = new ArrayList();
            XmlWriter xmlWrite    = XmlWriter.Create(strActivityLogPath);

            xmlWrite.WriteStartDocument();
            xmlWrite.WriteStartElement("MonthlyActivityLog");

            bool blStart = true;

            while (objReader.Read())
            {
                if (blStart == true)
                {
                    xmlWrite.WriteStartElement("Header");
                    // getting Month Name from .net
                    int    intMonth = Convert.ToInt16(objReader["Month"].ToString());
                    var    LongMth  = CultureInfo.CurrentCulture.DateTimeFormat;
                    string strMonth = LongMth.GetMonthName(intMonth);
                    xmlWrite.WriteElementString("Month", strMonth);

                    xmlWrite.WriteElementString("Year", objReader["Year"].ToString());
                    xmlWrite.WriteEndElement();

                    xmlWrite.WriteStartElement("Body");
                    xmlWrite.WriteStartElement("Consumer");
                    xmlWrite.WriteElementString("Name", objReader["Consumer"].ToString());
                    xmlWrite.WriteElementString("SSN", objReader["SSN"].ToString());
                    xmlWrite.WriteEndElement();

                    xmlWrite.WriteStartElement("Reviews");
                    blStart = false;
                }
                xmlWrite.WriteStartElement("Review");
                xmlWrite.WriteElementString("Staff", objReader["Staff"].ToString());
                xmlWrite.WriteElementString("Date", objReader["Date"].ToString());
                xmlWrite.WriteElementString("Employer", objReader["Employer"].ToString());
                xmlWrite.WriteElementString("MeetingType", objReader["MeetingType"].ToString());
                xmlWrite.WriteElementString("Note", objReader["Note"].ToString());


                string Time = objFormat.convertTime_12hr(objReader.GetDateTime(objReader.GetOrdinal("TimeIn")));
                xmlWrite.WriteElementString("TimeIn", Time);
                Time = objFormat.convertTime_12hr(objReader.GetDateTime(objReader.GetOrdinal("TimeOut")));
                xmlWrite.WriteElementString("TimeOut", Time);
                float fltTime = ReturnHours(objReader["TimeIn"].ToString(), objReader["TimeOut"].ToString());

                xmlWrite.WriteElementString("Hours", fltTime.ToString());
                fltTotalTime = fltTotalTime + fltTime;
                // Adding to Barriers Collection, to be used later
                if (objReader["Barriers"].ToString().Trim() != "" && objReader["Barriers"].ToString() != null)
                {
                    strBarriers.Add(objReader["Barriers"].ToString());
                }
                xmlWrite.WriteEndElement();
            }
            xmlWrite.WriteElementString("TotalHours", fltTotalTime.ToString());
            xmlWrite.WriteEndElement(); //Reviews
            writeMonthlyActivityLog_BarriersXML(ref xmlWrite, strBarriers);
            xmlWrite.WriteEndElement(); //Body

            //footer
            xmlWrite.WriteStartElement("Footer");
            xmlWrite.WriteElementString("Date", System.DateTime.Today.ToShortDateString());
            xmlWrite.WriteEndElement();

            xmlWrite.Close();

            objReader.Close();
        }