protected void BtnAcceptMVClick(object sender, EventArgs e)
        {
            if (sigPad.Visible == false && SigImg.Visible == false)
            {
                if (Global.signatureData.ContainsKey(Session["ManagerName"].ToString()))
                {
                    //Set the image to the image data for the signature.
                    SigImg.Visible = true;
                    SigImg.Src     = Global.signatureData[Session["ManagerName"].ToString()];


                    signLabel.Text    = "Stored Signature:";
                    signLabel.Visible = true;
                    imgbtn.Visible    = true;
                    return;
                }
                btnAccept1MV.Visible = false;
                btnAccept2MV.Visible = true;
                signLabel.Visible    = true;
                sigPad.Visible       = true;
                clearBtn.Visible     = true;
            }
            else if (sigPad.Visible == false && SigImg.Visible == true)
            {
                //export file with the stored signature
                DataFile df = Session["DataFile"] as DataFile;
                df.ManagerSignature = Global.signatureData[Session["ManagerName"].ToString()].Split(';')[1];
                df.Export();



                //TODO:export file with the stored signature
                Server.Transfer("ManagerViewScreen.aspx");
            }
            else
            {
                //store signature data
                Global.signatureData.Add(Session["ManagerName"].ToString(), hiddenfield.Value);
                DataFile df = Session["DataFile"] as DataFile;
                df.ManagerSignature = hiddenfield.Value.Split(';')[1];
                df.Export();
                Server.Transfer("ManagerViewScreen.aspx");
            }
        }
        protected void BtnAcceptMUClick(object sender, EventArgs e)
        {
            UpdateSelection.Visible = true;

            if (sigPad.Visible == false && SigImg.Visible == false)
            {
                if (Global.signatureData.ContainsKey(Session["ManagerName"].ToString()))
                {
                    //Set the image to the image data for the signature.
                    SigImg.Visible = true;
                    SigImg.Src     = Global.signatureData[Session["ManagerName"].ToString()];


                    signLabel.Text    = "Stored Signature:";
                    signLabel.Visible = true;
                    imgbtn.Visible    = true;
                    return;
                }
                btnAccept1MU.Visible = false;
                btnAccept2MU.Visible = true;
                signLabel.Visible    = true;
                sigPad.Visible       = true;
                clearBtn.Visible     = true;
            }
            else if (sigPad.Visible == false && SigImg.Visible == true)
            {
                List <string> empData = Session["empData"] as List <string>;

                DataFile OldData  = Session["DataFile"] as DataFile;
                DataFile dataFile = new DataFile();
                dataFile.CreateHeader(Global.ReadDataString($"SELECT RESOURCENAME FROM EMPLOYEES WHERE EMPNAME='{empData[0]}';"), empData[1], Session["ManagerName"].ToString());

                DataTable dt = new DataTable();



                foreach (GridViewRow row in UpdateView.Rows)
                {
                    JobType jobType     = (JobType)Enum.Parse(typeof(JobType), row.Cells[1].Text);
                    string  orderNumber = row.Cells[2].Text;
                    string  task        = row.Cells[3].Text;

                    //Calculate 'time' in a float format


                    float time = Global.TimeToFloat(row.Cells[4].Text);



                    string customer = row.Cells[8].Text;

                    dataFile.AddData(jobType, orderNumber, task, time, customer);
                }
                string sig = Global.signatureData[Session["ManagerName"].ToString()].Split(';')[1];
                dataFile.ManagerSignature = sig;
                OldData.Write(false, true);
                dataFile.Export(true);
                Server.Transfer("ManagerViewScreen.aspx");
            }
            else
            {
                List <string> empData = Session["empData"] as List <string>;

                DataFile OldData  = Session["DataFile"] as DataFile;
                DataFile dataFile = new DataFile();
                dataFile.CreateHeader(Global.ReadDataString($"SELECT RESOURCENAME FROM EMPLOYEES WHERE EMPNAME='{empData[0]}';"), empData[1], Session["ManagerName"].ToString());

                DataTable dt = new DataTable();


                foreach (GridViewRow row in UpdateView.Rows)
                {
                    JobType jobType     = (JobType)Enum.Parse(typeof(JobType), row.Cells[1].Text);
                    string  orderNumber = row.Cells[2].Text;
                    string  task        = row.Cells[3].Text;

                    //Calculate 'time' in a float format


                    float time = Global.TimeToFloat(row.Cells[4].Text);



                    string customer = row.Cells[8].Text;

                    dataFile.AddData(jobType, orderNumber, task, time, customer);
                }

                string sig = hiddenfield.Value.Split(';')[1];
                dataFile.ManagerSignature = sig;
                OldData.Write(false, true);
                dataFile.Export(true);
                Server.Transfer("ManagerViewScreen.aspx");
            }
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataFile dataFile = new DataFile();
                string   userName = Session["UsrName"].ToString();
                //Gets data to show on View Screen and loads it onto the page.

                EmployeeNameData.Text    = Global.ReadDataString($"SELECT EMPNAME FROM EMPLOYEES WHERE RESOURCENAME ='{userName}';");
                TimeWorkedData.Text      = Global.DictUsrData[userName].StartTime + " - " + Global.DictUsrData[userName].EndTime;
                BreakTimeData.Text       = Global.DictUsrData[userName].LunchTime;
                TotalTimeWorkedData.Text = Global.TimeToString(Global.DictUsrData[userName].TotalHours);


                dataFile.CreateHeader(userName, Global.DictUsrData[userName].Date);


                DataTable CHTable = Session["CHtab"] as DataTable;
                DataTable NCTable = Session["NCtab"] as DataTable;

                foreach (DataRow row in CHTable.Rows)
                {
                    JobType jobType     = (JobType)Enum.Parse(typeof(JobType), row["Job/Assy"].ToString());
                    string  orderNumber = row["Number"].ToString();
                    string  task        = row["Step/Task"].ToString();

                    //Calculate 'time' in a float format
                    string[] strSplit = row["Hours:Mins"].ToString().Split(':');

                    float time = 0f;
                    //I'm parsing as an int because doing it as a float would mean potentially having to
                    //deal with the value being +/- phi
                    time += int.Parse(strSplit[0]);
                    time += (float)(int.Parse(strSplit[1])) / 60;

                    string customer = row["Customer"].ToString();

                    dataFile.AddData(jobType, orderNumber, task, time, customer);
                }

                foreach (DataRow row in NCTable.Rows)
                {
                    JobType jobType   = JobType.NonCharge;
                    string  NCcomment = row["Non-Charge Comment"].ToString();
                    string  task      = row["NC Code"].ToString();

                    //Calculate 'time' in a float format
                    string[] strSplit = row["Hours:Mins"].ToString().Split(':');

                    float time = 0f;
                    //I'm parsing as an int because doing it as a float would mean potentially having to
                    //deal with the value being +/- phi
                    time += int.Parse(strSplit[0]);
                    time += (float)(int.Parse(strSplit[1])) / 60;

                    dataFile.AddData(jobType, "", task, time, NCcomment);
                }

                if (CHTable.Rows.Count != 0)
                {
                    JobsAssembliesViewGrid.DataSource = CHTable;
                    JobsAssembliesViewGrid.DataBind();
                }
                else
                {
                    viewJALabel.Visible = false;
                }

                if (NCTable.Rows.Count != 0)
                {
                    NonChargeViewGrid.DataSource = NCTable;
                    NonChargeViewGrid.DataBind();
                }
                else
                {
                    viewNCLabel.Visible = false;
                }


                List <string> managerNames = Global.ReadDataList("SELECT RESOURCENAME FROM EMPLOYEES WHERE MANAGER='TRUE';");
                foreach (string str in managerNames)
                {
                    ManagerDropdown.Items.Add(str);
                }



                Global.UserData.Add(userName, dataFile);
            }
        }