Ejemplo n.º 1
0
        private void TxtPPSAP_Click(object sender, EventArgs e)
        {
            string file;

            //Call function to calculate PlanPort and SAP hours for week of chosen date, adjusting SAP hours to 40 hours proportion
            TTTimeTracker t = new TTTimeTracker();

            file = t.CalculateSumHoursForWeekPPSAP(TxtEmployeeId.Text, DteDate.Text);

            if (file == "NO_DATA")
            {
                MessageBox.Show("No data found!");
            }
            else if (file == "NOT_40")
            {
                MessageBox.Show("40 hours or more must be booked before a weekly file can be created!");
            }
            else
            {
                using (FileStream fs = File.Open(file, FileMode.Open))
                {
                    Process.Start("notepad.exe", file);
                }
            }
        }
Ejemplo n.º 2
0
        public void GetThisText()
        {
            //
            double hoursDate = 0.0;
            double hoursWeek = 0.0;
            string interval  = "";

            TTTimeTracker tt = new TTTimeTracker();

            //Calculate hours for selected date (in date picker control) and corresponding week
            hoursDate = tt.CalculateSumHoursForDate(TxtEmployeeId.Text, DteDate.Text);
            hoursWeek = tt.CalculateSumHoursForWeek(TxtEmployeeId.Text, DteDate.Text);

            //Get popup interval
            interval = GetPopupInterval();

            //Update windows header
            this.Text = "TimeTracker v" + TTStatic.ttVersion + " |  Popup: " + interval + " | " + DteDate.Text + ": " + hoursDate + " hours | Week " + TxtWeek.Text + ": " + hoursWeek + " hours";
        }
Ejemplo n.º 3
0
        private void CreateWBSButtons(string show)
        {
            //Variables for positioning buttons
            int left        = 5;
            int top         = 55;
            int width       = 146;
            int height      = 20;
            int hSpace      = 3;
            int vSpace      = 3;
            int hButtons    = 4; //Number of buttons horizontally
            int vButtons    = 4; //Number of buttons vertically
            int buttonIndex = 0;

            string line;
            string WBS;
            string WBSDescription;

            //Create arrays for WBS numbers
            Button[]  buttonArray  = new Button[hButtons * vButtons];
            TextBox[] textBoxArray = new TextBox[hButtons * vButtons];
            ToolTip[] toolTipArray = new ToolTip[hButtons * vButtons];

            //Create instance of TimeTracker to access methods
            TTTimeTracker t = new TTTimeTracker();

            //Open WBS.TXT filr for reading
            StreamReader file = new StreamReader(TTStatic.ttAppPath + "\\WBS.txt");

            //Create buttons (horizontal x vertical)
            for (int i = 0; i < vButtons; i++)
            {
                for (int j = 0; j < hButtons; j++)
                {
                    line = file.ReadLine();

                    if (line != null && line.Length > 0)
                    {
                        WBS            = TTStatic.GetDelimitedFieldData(line, 1, ",");
                        WBSDescription = TTStatic.GetDelimitedFieldData(line, 2, ",");

                        //Hidden textbox array to use for WBS description
                        textBoxArray[buttonIndex]         = new TextBox();
                        textBoxArray[buttonIndex].Name    = "TxtWBSDescription_" + WBS;
                        textBoxArray[buttonIndex].Text    = WBSDescription;
                        textBoxArray[buttonIndex].Visible = false;

                        //Button array to use for WBS
                        buttonArray[buttonIndex]        = new Button();
                        buttonArray[buttonIndex].Name   = "BtnWBS_" + WBS;
                        buttonArray[buttonIndex].Click += new EventHandler(buttonArray_Click);

                        buttonArray[buttonIndex].Size     = new Size(width, height);
                        buttonArray[buttonIndex].Location = new Point(left + j * (width + vSpace), top + i * (height + hSpace));

                        buttonArray[buttonIndex].Text = WBS;
                        toolTipArray[buttonIndex]     = new ToolTip();
                        toolTipArray[buttonIndex].SetToolTip(buttonArray[buttonIndex], WBSDescription);

                        //Add buttons and textboxes to Controls collection
                        this.Controls.Add(buttonArray[buttonIndex]);
                        this.Controls.Add(textBoxArray[buttonIndex]);
                        buttonIndex += 1;
                    }
                }
            }

            file.Close();

            //Call this to show WBS descriptions instead of numbers on buttons
            this.LblWBS_Click(this, null);
        }