Beispiel #1
0
        protected void BtnNCTableADDClick(object sender, EventArgs e)
        {
            if (NCCodeData.SelectedValue == "" || NCHoursMSelection.SelectedValue == "00" && NCHoursHSelection.SelectedValue == "00" || NCCommentBox.Text == "")
            {
                Response.Write("<script>alert('Some fields do not have data please make sure that all fields are filled before adding a row.');</script>");
            }
            else
            {
                //Updates the amount of hours applied(Addition)
                float Tothours   = Global.TimeToFloat(TotalHoursAppLabel.Text);
                float Addedhours = Global.TimeToFloat(NCHoursHSelection.Text + " " + NCHoursMSelection.Text);

                TotalHoursAppLabel.Text = Global.TimeToString(Tothours + Addedhours);


                //Adds selected data to Non-Charge table
                DataTable NCTable = Session["NCtab"] as DataTable;
                DataRow   dr      = NCTable.NewRow();
                dr["NC Code"]            = NCCodeData.SelectedValue;
                dr["Hours:Mins"]         = NCHoursHSelection.SelectedValue + ":" + NCHoursMSelection.SelectedValue;
                dr["Non-Charge Comment"] = NCCommentBox.Text;
                NCTable.Rows.Add(dr);
                DataNCView.DataSource = NCTable;
                DataNCView.DataBind();
                Session["NCtab"] = NCTable;
            }
        }
Beispiel #2
0
        protected void DataNCView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            DataTable NCTable = Session["NCtab"] as DataTable;

            if (e.CommandName == "RemoveRow")
            {
                int   index        = Convert.ToInt32(e.CommandArgument);
                float Tothours     = Global.TimeToFloat(TotalHoursAppLabel.Text);
                float Removedhours = Global.TimeToFloat(NCTable.Rows[index]["Hours:Mins"].ToString().Replace(':', ' '));

                TotalHoursAppLabel.Text = Global.TimeToString(Tothours - Removedhours);

                //Deletes a row from table
                NCTable.Rows[index].Delete();
                DataNCView.DataSource = NCTable;
                DataNCView.DataBind();
                Session["NCtab"] = NCTable;
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //will only run when the first instance of a page is loaded
            if (!IsPostBack)
            {
                string userName = Session["UsrName"].ToString();
                //Provides Inital data for Infolist beside forms

                string Name = Global.ReadDataString($"SELECT EMPNAME FROM EMPLOYEES WHERE RESOURCENAME='{Session["UsrName"].ToString()}';");
                Ordernumbers = Global.ReadDataList("SELECT DISTINCT ORDERNUMBER FROM ORDERS;");

                NameViewLabel.Text = Name;
                DateViewLabel.Text = Global.DictUsrData[userName].Date;

                TotalHoursLabel.Text = Global.TimeToString(Global.DictUsrData[userName].TotalHours);

                TotalHoursAppLabel.Text = "0h 0m";


                NCCodeData.Items.Add("Please Select an Order Number");
                List <string> NCCodes = Global.ReadDataList("SELECT CODE FROM NONCHARGE;");
                foreach (string str in NCCodes)
                {
                    NCCodeData.Items.Add(str);
                }


                StepTaskData.Items.Add("Please Select a Step or Task");


                for (int i = 0; i <= 10; i++)
                {
                    if (i >= 0 && i <= 9)
                    {
                        CHHoursHSelection.Items.Add("0" + Convert.ToString(i));
                        NCHoursHSelection.Items.Add("0" + Convert.ToString(i));
                    }
                    else
                    {
                        CHHoursHSelection.Items.Add(Convert.ToString(i));
                        NCHoursHSelection.Items.Add(Convert.ToString(i));
                    }
                }

                for (int i = 0; i <= 3; i++)
                {
                    if (i == 0)
                    {
                        CHHoursMSelection.Items.Add("00");
                        NCHoursMSelection.Items.Add("00");
                    }
                    else
                    {
                        CHHoursMSelection.Items.Add(Convert.ToString(i * 15));
                        NCHoursMSelection.Items.Add(Convert.ToString(i * 15));
                    }
                }


                //Creates DataTables for data to be inputed into. This is for both Jobs and Assemblies and for Non-Charge Activities aswell.
                DataTable CHTable = new DataTable();
                CHTable.Columns.Add("Job/Assy");
                CHTable.Columns.Add("Number");
                CHTable.Columns.Add("Step/Task");
                CHTable.Columns.Add("Hours:Mins");
                CHTable.Columns.Add("WyEU REF");
                CHTable.Columns.Add("EU Step/Task");
                CHTable.Columns.Add("EU Cust");
                CHTable.Columns.Add("Customer");
                DataCHView.DataSource = CHTable;
                DataCHView.DataBind();

                Session["CHtab"] = CHTable;

                DataTable NCTable = new DataTable();
                NCTable.Columns.Add("NC Code");
                NCTable.Columns.Add("Hours:Mins");
                NCTable.Columns.Add("Non-Charge Comment");
                DataNCView.DataSource = NCTable;
                DataNCView.DataBind();
                Session["NCtab"] = NCTable;
            }
        }