コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Button oBtn = sender as Button;

            if (oBtn != null && FormLoaded)
            {
                CMTReportOptions repOptions = new CMTReportOptions();

                repOptions.fromDate = Convert.ToDateTime(dtpFromDate.Value.ToShortDateString());
                repOptions.toDate   = Convert.ToDateTime(dtpToDate.Value.ToShortDateString());
                repOptions.toDate   = repOptions.toDate.AddHours(23);

                try
                {
                    frmCMTViewRep vRep = new frmCMTViewRep(15, QueryParms, repOptions);
                    int           h    = Screen.PrimaryScreen.WorkingArea.Height;
                    int           w    = Screen.PrimaryScreen.WorkingArea.Width;
                    vRep.ClientSize = new Size(w, h);
                    vRep.ShowDialog(this);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    cmboLine.Items.Clear();
                    cmboCMT.Items.Clear();
                    frmCMTWip_Load(this, null);
                }
            }
        }
コード例 #2
0
ファイル: frmMPSel.cs プロジェクト: radtek/Tradelink
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Button oBtn = sender as Button;

            if (oBtn != null && formloaded)
            {
                CMTReportOptions repOpts = new CMTReportOptions();

                try
                {
                    repOpts.fromDate = Convert.ToDateTime(dtpFromDate.Value.ToShortDateString());
                    repOpts.toDate   = Convert.ToDateTime(dtpToDate.Value.ToShortDateString());
                    repOpts.toDate   = repOpts.toDate.AddHours(23);

                    frmCMTViewRep vRep = new frmCMTViewRep(16, QueryParms, repOpts);
                    int           h    = Screen.PrimaryScreen.WorkingArea.Height;
                    int           w    = Screen.PrimaryScreen.WorkingArea.Width;
                    vRep.ClientSize = new Size(w, h);
                    vRep.ShowDialog(this);
                }
                finally
                {
                    cmboMeasurement.Items.Clear();
                    cmboDepartment.Items.Clear();
                    cmboSize.Items.Clear();
                    cmboStyle.Items.Clear();
                    frmMPSel_Load(this, null);
                }

                formloaded = true;
            }
        }
コード例 #3
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Button oBtn = (Button)sender;

            if (!_Export)
            {
                var Depts = (TLADM_Departments)cmboDepartments.SelectedItem;
                if (Depts == null)
                {
                    using (DialogCenteringService svces = new DialogCenteringService(this))
                    {
                        MessageBox.Show("Please select a CMT to report on");
                        return;
                    }

                }
                CMTReportOptions repOps = new CMTReportOptions();
                repOps.SLFCmt = Depts.Dep_Id;

                DateTime dt = Convert.ToDateTime(dtpToDate.Value.ToShortDateString());
                repOps.toDate = dt.AddHours(23);
                // repOps.toDate = (DateTimedtpToDate.Value;

                frmCMTViewRep vRep = new frmCMTViewRep(18, repOps);
                int h = Screen.PrimaryScreen.WorkingArea.Height;
                int w = Screen.PrimaryScreen.WorkingArea.Width;
                vRep.ClientSize = new Size(w, h);
                vRep.ShowDialog(this);
            }
        }
コード例 #4
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Button oBtn = sender as Button;

            if (oBtn != null && FormLoaded)
            {
                if (QueryParms.Depts.Count == 0)
                {
                    MessageBox.Show("Please select a least one CMT to analyse");
                    return;
                }


                repOpts = new CMTReportOptions();

                frmCMTViewRep vRep = new frmCMTViewRep(19, QueryParms, repOpts);

                int h = Screen.PrimaryScreen.WorkingArea.Height;
                int w = Screen.PrimaryScreen.WorkingArea.Width;
                vRep.ClientSize = new Size(w, h);
                vRep.ShowDialog(this);

                cmboColours.Items.Clear();
                cmboSizes.Items.Clear();
                cmboStyles.Items.Clear();


                frmCostAnalysisValues_Load(this, null);
            }
        }
コード例 #5
0
ファイル: frmSelFeederFChk.cs プロジェクト: radtek/Tradelink
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Button oBtn = sender as Button;

            if (oBtn != null && formloaded)
            {
                RepOpts.fromDate    = Convert.ToDateTime(dtpfromDate.Value.ToShortDateString());
                RepOpts.toDate      = Convert.ToDateTime(dtptoDate.Value.ToShortDateString());
                RepOpts.toDate      = RepOpts.toDate.AddHours(23);
                RepOpts.ReportTitle = "Line Feeder Quality CheckList";
                frmCMTViewRep vRep = new frmCMTViewRep(17, RepOpts);
                int           h    = Screen.PrimaryScreen.WorkingArea.Height;
                int           w    = Screen.PrimaryScreen.WorkingArea.Width;
                vRep.ClientSize = new Size(w, h);
                vRep.ShowDialog(this);

                RepOpts    = new CMTReportOptions();
                formloaded = false;
                cmboReportOptions.SelectedIndex = -1;
                cmboCutSheet.SelectedValue      = -1;
                cmboSupervisor.SelectedValue    = -1;
                cmboLines.SelectedValue         = -1;
                cmboFacility.SelectedValue      = -1;
                cmboStyles.SelectedIndex        = -1;

                formloaded = true;
            }
        }
コード例 #6
0
ファイル: frmSelFeederFChk.cs プロジェクト: radtek/Tradelink
        private void frmSelFeederFChk_Load(object sender, EventArgs e)
        {
            formloaded = false;
            LineFSort  = 0;

            RepOpts = new CMTReportOptions();

            using (var context = new TTI2Entities())
            {
                cmboFacility.DataSource    = context.TLADM_Departments.Where(x => x.Dep_IsCMT).ToList();
                cmboFacility.ValueMember   = "Dep_Id";
                cmboFacility.DisplayMember = "Dep_Description";
                cmboFacility.SelectedValue = -1;

                cmboLines.DataSource    = context.TLCMT_FactConfig.ToList();
                cmboLines.ValueMember   = "TLCMTCFG_Pk";
                cmboLines.DisplayMember = "TLCMTCFG_Description";
                cmboLines.SelectedValue = -1;

                cmboSupervisor.DataSource    = context.TLADM_MachineOperators.Where(x => x.MachOp_Inspector && !x.MachOp_Discontinued).ToList();
                cmboSupervisor.ValueMember   = "MachOp_Pk";
                cmboSupervisor.DisplayMember = "MachOp_Description";
                cmboSupervisor.SelectedValue = -1;

                var Existing = (from li in context.TLCMT_LineIssue
                                join cs in context.TLCUT_CutSheet
                                on li.TLCMTLI_CutSheet_FK equals cs.TLCutSH_Pk
                                where !li.TLCMTLI_IssuedToLine && !li.TLCMTLI_WorkCompleted
                                orderby cs.TLCutSH_No
                                select cs).ToList();

                cmboCutSheet.DataSource    = Existing;
                cmboCutSheet.ValueMember   = "TLCutSH_Pk";
                cmboCutSheet.DisplayMember = "TLCutSH_No";
                cmboCutSheet.SelectedValue = -1;

                cmboStyles.DataSource    = context.TLADM_Styles.ToList();
                cmboStyles.ValueMember   = "Sty_Id";
                cmboStyles.DisplayMember = "Sty_Description";
                cmboStyles.SelectedValue = -1;

                var reportOptions = new BindingList <KeyValuePair <int, string> >();
                reportOptions.Add(new KeyValuePair <int, string>(1, "CMT, Line"));
                reportOptions.Add(new KeyValuePair <int, string>(2, "CMT, Supervisor"));
                reportOptions.Add(new KeyValuePair <int, string>(3, "CMT, Colour"));
                reportOptions.Add(new KeyValuePair <int, string>(4, "CMT, Style"));

                cmboReportOptions.DataSource    = reportOptions;
                cmboReportOptions.ValueMember   = "Key";
                cmboReportOptions.DisplayMember = "Value";
                cmboReportOptions.SelectedIndex = -1;
            }

            formloaded = true;
        }
コード例 #7
0
        private void rbCutSheetsOnHold_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton oRad = (RadioButton)sender;

            if (oRad != null && oRad.Checked && FormLoaded)
            {
                CMTReportOptions   repOpts    = new CMTReportOptions();
                CMTQueryParameters QueryParms = new CMTQueryParameters();
                frmCMTViewRep      vRep       = new frmCMTViewRep(24, QueryParms, repOpts);
                int h = Screen.PrimaryScreen.WorkingArea.Height;
                int w = Screen.PrimaryScreen.WorkingArea.Width;
                vRep.ClientSize = new Size(w, h);
                vRep.ShowDialog(this);
            }
        }
コード例 #8
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Button        oBtn = sender as Button;
            frmCMTViewRep vRep;

            if (oBtn != null && formloaded)
            {
                CMTReportOptions repOpts = new CMTReportOptions();
                repOpts.fromDate = Convert.ToDateTime(dtpFromDate.Value.ToShortDateString());
                repOpts.toDate   = Convert.ToDateTime(dtpToDate.Value.ToShortDateString());
                repOpts.toDate   = repOpts.toDate.AddHours(23);

                if (rbNoOfGarments.Checked)
                {
                    repOpts.NoOfGarments = true;
                }
                else
                {
                    repOpts.NoOfBoxes = true;
                }

                repOpts.SortSequence = ReportSort; // ReportSort;
                if (_Prod)
                {
                    vRep = new frmCMTViewRep(12, QueryParms, repOpts);
                }
                else
                {
                    vRep = new frmCMTViewRep(13, QueryParms, repOpts);
                }

                int h = Screen.PrimaryScreen.WorkingArea.Height;
                int w = Screen.PrimaryScreen.WorkingArea.Width;
                vRep.ClientSize = new Size(w, h);
                vRep.ShowDialog(this);

                ReportSort = 0;

                formloaded = false;

                cmboSize.SelectedValue          = -1;
                cmboFactory.SelectedValue       = -1;
                cmboQuality.SelectedValue       = -1;
                cmboReportOptions.SelectedValue = -1;

                formloaded = true;
            }
        }
コード例 #9
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Button oBtn = (Button)sender;

            if (oBtn != null && FormLoaded)
            {
                CMTReportOptions repOpts = new CMTReportOptions();
                var FDate = Convert.ToDateTime(dtpFromDate.Value.ToShortDateString());
                var TDate = Convert.ToDateTime(DtpToDate.Value.ToShortDateString());
                TDate = TDate.AddHours(23);

                repOpts.fromDate = FDate;
                repOpts.toDate   = TDate;

                if (rbGradeA.Checked)
                {
                    repOpts.GradeAOnly = true;
                }
                else if (rbGradeB.Checked)
                {
                    repOpts.GradeBOnly = true;
                }
                else
                {
                    repOpts.GradeBoth = true;
                }

                if (rbUnits.Checked)
                {
                    repOpts.Units = true;
                }
                else
                {
                    repOpts.Boxes = true;
                }

                CMTQueryParameters QueryParms = new CMTQueryParameters();

                frmCMTViewRep vRep = new frmCMTViewRep(26, QueryParms, repOpts);
                int           h    = Screen.PrimaryScreen.WorkingArea.Height;
                int           w    = Screen.PrimaryScreen.WorkingArea.Width;
                vRep.ClientSize = new Size(w, h);
                vRep.ShowDialog(this);
            }
        }
コード例 #10
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Button oBtn = (Button)sender;

            if (oBtn != null && Formloaded)
            {
                CMTReportOptions repOpts = new CMTReportOptions();

                frmCMTViewRep vRep = new frmCMTViewRep(24, QueryParms, repOpts);
                int           h    = Screen.PrimaryScreen.WorkingArea.Height;
                int           w    = Screen.PrimaryScreen.WorkingArea.Width;
                vRep.ClientSize = new Size(w, h);
                vRep.ShowDialog(this);

                cmboDepartments.Items.Clear();

                frmSelCSOnHold_Load(this, null);
            }
        }
コード例 #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            Button oBtn = (Button)sender;

            if (oBtn != null)
            {
                CMTReportOptions CMTRepOpts = new CMTReportOptions();

                DateTime FromDate = Convert.ToDateTime(dtpFromDate.Value.ToShortDateString());
                DateTime ToDate   = Convert.ToDateTime(dtpToDate.Value.ToShortDateString());
                //  DateTime dt = Convert.ToDateTime(dtpToDate.Value.ToShortDateString());
                CMTRepOpts.fromDate = FromDate;
                CMTRepOpts.toDate   = ToDate.AddHours(23);

                frmCMTViewRep vRep = new frmCMTViewRep(29, CMTRepOpts);
                int           h    = Screen.PrimaryScreen.WorkingArea.Height;
                int           w    = Screen.PrimaryScreen.WorkingArea.Width;
                vRep.ClientSize = new Size(w, h);
                vRep.ShowDialog(this);
            }
        }
コード例 #12
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Button oBtn = sender as Button;

            if (oBtn != null && formloaded)
            {
                CMTReportOptions repOps = new CMTReportOptions();
                var CMT = (TLADM_Departments)cmboDepartments.SelectedItem;
                if (CMT != null)
                {
                    repOps.CMT = CMT.Dep_Id;
                }

                repOps.SortSequence = ReportSeq;
                frmCMTViewRep vRep = new frmCMTViewRep(11, repOps);
                int           h    = Screen.PrimaryScreen.WorkingArea.Height;
                int           w    = Screen.PrimaryScreen.WorkingArea.Width;
                vRep.ClientSize = new Size(w, h);
                vRep.ShowDialog(this);
            }
        }
コード例 #13
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Button oBtn = sender as Button;

            if (oBtn != null && FormLoaded)
            {
                repOpts             = new CMTReportOptions();
                QueryParms.FromDate = Convert.ToDateTime(FromDate.Value.ToShortDateString());
                QueryParms.ToDate   = Convert.ToDateTime(ToDate.Value.ToShortDateString()).AddHours(23);

                frmCMTViewRep vRep = new frmCMTViewRep(33, QueryParms, repOpts);

                int h = Screen.PrimaryScreen.WorkingArea.Height;
                int w = Screen.PrimaryScreen.WorkingArea.Width;
                vRep.ClientSize = new Size(w, h);
                vRep.ShowDialog(this);

                cmboColours.Items.Clear();
                cmboStyles.Items.Clear();

                frmCMTProdAnalysis_Load(this, null);
            }
        }
コード例 #14
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Button oBtn = sender as Button;

            if (oBtn != null)
            {
                CMTReportOptions CMTRepOpts = new CMTReportOptions();
                Object           tst        = cmboReportOptions.SelectedItem;
                if (tst == null)
                {
                    MessageBox.Show("Please select a report option");
                    return;
                }

                foreach (PropertyInfo prop in tst.GetType().GetProperties())
                {
                    if (prop.Name == "Key")
                    {
                        CMTRepOpts.PanelStockSortOrder = Convert.ToInt32(prop.GetValue(tst));
                    }
                }

                frmCMTViewRep vRep = new frmCMTViewRep(7, QueryParms, CMTRepOpts);

                int h = Screen.PrimaryScreen.WorkingArea.Height;
                int w = Screen.PrimaryScreen.WorkingArea.Width;
                vRep.ClientSize = new Size(w, h);
                vRep.ShowDialog(this);

                cmboDepartment.Items.Clear();
                comboColours.Items.Clear();
                comboSizes.Items.Clear();
                comboStyles.Items.Clear();

                frmCMTPanelStock_Load(this, null);
            }
        }
コード例 #15
0
        private void button1_Click(object sender, EventArgs e)
        {
            var RepOpts = new CMTReportOptions();
            var CS      = (TLCUT_CutSheet)cmboCutSheet.SelectedItem;

            if (CS != null)
            {
                var oBtn = (Button)sender;
                if (oBtn != null && FormLoaded)
                {
                    RepOpts.ReportTitle   = CS.TLCutSH_No;
                    RepOpts.SLFCutSheetFK = CS.TLCutSH_Pk;
                    frmCMTViewRep vRep = new frmCMTViewRep(23, RepOpts);
                    int           h    = Screen.PrimaryScreen.WorkingArea.Height;
                    int           w    = Screen.PrimaryScreen.WorkingArea.Width;
                    vRep.ClientSize = new Size(w, h);
                    vRep.ShowDialog(this);
                }
            }
            else
            {
                MessageBox.Show("Please select a custsheet from the drop down box");
            }
        }
コード例 #16
0
        private void Submit_Click(object sender, EventArgs e)
        {
            Button oBtn = sender as Button;

            if (oBtn != null)
            {
                CMTReportOptions CMTRepOpts = new CMTReportOptions();

                Object tst = cmboReportOptions.SelectedItem;
                if (tst == null)
                {
                    MessageBox.Show("Please select a report option");
                    return;
                }

                foreach (PropertyInfo prop in tst.GetType().GetProperties())
                {
                    if (prop.Name == "Key")
                    {
                        CMTRepOpts.WorkAnalysis = Convert.ToInt32(prop.GetValue(tst));
                    }
                }


                try
                {
                    if (chkQaSummary.Checked)
                    {
                        CMTRepOpts.QAReport = true;
                    }

                    if (chkException.Checked)
                    {
                        CMTRepOpts.Exception            = true;
                        CMTRepOpts.Percentage_Exception = Convert.ToInt32(txtPercentage.Text);
                    }

                    CMTRepOpts.fromDate = Convert.ToDateTime(dtpFromDate.Value.ToShortDateString());
                    CMTRepOpts.toDate   = Convert.ToDateTime(dtpToDate.Value.ToShortDateString());
                    CMTRepOpts.toDate   = CMTRepOpts.toDate.AddHours(23);

                    frmCMTViewRep vRep = new frmCMTViewRep(20, QueryParms, CMTRepOpts);

                    int h = Screen.PrimaryScreen.WorkingArea.Height;
                    int w = Screen.PrimaryScreen.WorkingArea.Width;
                    vRep.ClientSize = new Size(w, h);
                    vRep.ShowDialog(this);

                    if (chkException.Checked)
                    {
                        chkException.Checked = false;
                        txtPercentage.Text   = "0";
                    }
                }
                finally
                {
                    cmboFactory.Items.Clear();
                    cmboSize.Items.Clear();
                    cmboStyle.Items.Clear();
                    cmboColour.Items.Clear();

                    frmCMTFinishedWAnalysis_Load(this, null);
                }
            }
        }
コード例 #17
0
ファイル: frmDateRequired.cs プロジェクト: radtek/Tradelink
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Button oBtn = (Button)sender;

            if (oBtn != null && FormLoaded)
            {
                if (_Mode)
                {
                    if (chkProductionResults.Checked)
                    {
                        QueryParms.ProductionResults = true;
                    }

                    repOptions = new CMTReportOptions();

                    DateTime FromDate = Convert.ToDateTime(dtpFromDate.Value.ToShortDateString());
                    DateTime ToDate   = Convert.ToDateTime(dtpToDate.Value.ToShortDateString());

                    ToDate = ToDate.AddHours(23);

                    repOptions.fromDate = FromDate;
                    repOptions.toDate   = ToDate;

                    frmCMTViewRep vRep = new frmCMTViewRep(30, QueryParms, repOptions);
                    int           h    = Screen.PrimaryScreen.WorkingArea.Height;
                    int           w    = Screen.PrimaryScreen.WorkingArea.Width;
                    vRep.ClientSize = new Size(w, h);
                    vRep.ShowDialog(this);

                    frmDateRequired_Load(this, null);
                }
                else
                {
                    using (var context = new TTI2Entities())
                    {
                        foreach (DataGridViewRow Row in dataGridView1.Rows)
                        {
                            if (!(bool)Row.Cells[1].Value)
                            {
                                continue;
                            }

                            var Pk        = (int)Row.Cells[0].Value;
                            var LineIssue = context.TLCMT_LineIssue.Find(Pk);
                            if (LineIssue != null)
                            {
                                LineIssue.TLCMTLI_Required_Date = dtpFromDate.Value;
                            }
                        }

                        try
                        {
                            context.SaveChanges();
                            MessageBox.Show("Data successfully saved to the database");

                            this.frmDateRequired_Load(this, null);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }
                }
            }
        }
コード例 #18
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Button          oBtn        = sender as Button;
            int             Col3        = 0;
            TLCMT_LineIssue LineIssue   = null;
            int             Pk          = 0;
            string          Description = string.Empty;
            var             RepOpts     = new CMTReportOptions();

            if (oBtn != null && formloaded)
            {
                if (!InternalTransfer)
                {
                    var DeptSelected = (TLADM_Departments)cmboDepartment.SelectedItem;
                    if (DeptSelected == null)
                    {
                        MessageBox.Show("Please select an location from the drop down box");
                        return;
                    }

                    using (var context = new TTI2Entities())
                    {
                        Object tst = cmboCutSheet.SelectedItem;
                        if (tst != null)
                        {
                            foreach (PropertyInfo prop in tst.GetType().GetProperties())
                            {
                                if (prop.Name == "Key")
                                {
                                    Pk = Convert.ToInt32(prop.GetValue(tst));
                                }
                                else if (prop.Name == "Value")
                                {
                                    Description = Convert.ToString(prop.GetValue(tst));
                                }
                            }
                        }

                        if (Pk == 0)
                        {
                            MessageBox.Show("Please select a cut sheet from the drop down box");
                            return;
                        }

                        var LineDetails = (TLCMT_FactConfig)cmboLineDetails.SelectedItem;

                        if (LineDetails == null)
                        {
                            MessageBox.Show("Please select a line to assign this cut sheet too");
                            return;
                        }

                        LineIssue = new TLCMT_LineIssue();
                        LineIssue = context.TLCMT_LineIssue.Find(Pk);
                        if (LineIssue != null)
                        {
                            LineIssue.TLCMTLI_TransactionNo   = Col3;
                            LineIssue.TLCMTLI_TransferDate    = DateTime.Now;
                            LineIssue.TLCMTLI_CutSheetDetails = "SI" + Description.Remove(0, 2);
                            LineIssue.TLCMTLI_OnHold          = false;
                            var LNU = context.TLADM_LastNumberUsed.Where(x => x.LUN_Department_FK == LineIssue.TLCMTLI_CmtFacility_FK).FirstOrDefault();
                            if (LNU != null)
                            {
                                LineIssue.TLCMTLI_TransactionNo = LNU.col3;
                            }

                            LineIssue.TLCMTLI_Required_Date = dtpRequiredDate.Value;
                            LineIssue.TLCMTLI_LineNo_FK     = LineDetails.TLCMTCFG_Pk;
                            LineIssue.TLCMTLI_IssuedToLine  = true;
                        }

                        Col3 += 1;

                        try
                        {
                            context.SaveChanges();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                        finally
                        {
                            MessageBox.Show("Data successfully saved to database");
                            //--------------Cut Sheet document
                            frmCMTViewRep vRep = new frmCMTViewRep(8, LineIssue.TLCMTLI_Pk);
                            int           h    = Screen.PrimaryScreen.WorkingArea.Height;
                            int           w    = Screen.PrimaryScreen.WorkingArea.Width;
                            vRep.ClientSize = new Size(w, h);
                            vRep.ShowDialog(this);

                            RepOpts.ReportTitle   = context.TLCUT_CutSheet.Find(LineIssue.TLCMTLI_CutSheet_FK).TLCutSH_No;
                            RepOpts.SLFCutSheetFK = LineIssue.TLCMTLI_CutSheet_FK;

                            /*//------------------Line Feeder Document
                             * No longer required as they copy this onto the back of cutsheet to conserve
                             * vRep = new frmCMTViewRep(23, RepOpts);
                             * h = Screen.PrimaryScreen.WorkingArea.Height;
                             * w = Screen.PrimaryScreen.WorkingArea.Width;
                             * vRep.ClientSize = new Size(w, h);
                             * vRep.ShowDialog(this);*////

                            vRep            = new frmCMTViewRep(5, LineIssue.TLCMTLI_CutSheet_FK);
                            h               = Screen.PrimaryScreen.WorkingArea.Height;
                            w               = Screen.PrimaryScreen.WorkingArea.Width;
                            vRep.ClientSize = new Size(w, h);
                            vRep.ShowDialog(this);

                            formloaded = false;
                            cmboCutSheet.SelectedValue    = -1;
                            cmboDepartment.SelectedValue  = -1;
                            cmboLineDetails.SelectedValue = -1;
                            formloaded = true;

                            txtColours.Text = string.Empty;
                            txtPanels.Text  = string.Empty;
                            txtSizes.Text   = string.Empty;
                            txtStyle.Text   = string.Empty;
                        }
                    }
                }
                else
                {
                    using (var context = new TTI2Entities())
                    {
                        foreach (DataGridViewRow row in dataGridView1.Rows)
                        {
                            if (row.Cells[0].Value == null)
                            {
                                continue;
                            }

                            var OnHold = (bool)row.Cells[5].Value;
                            if (OnHold)
                            {
                                var Reason = row.Cells[2].Value.ToString();
                                if (Reason.Length == 0)
                                {
                                    MessageBox.Show("Please provide a reason as to why this Cutsheet is placed on hold");
                                    return;
                                }
                            }


                            Pk = (int)row.Cells[0].Value;

                            LineIssue = context.TLCMT_LineIssue.Find(Pk);
                            if (LineIssue != null)
                            {
                                LineIssue.TLCMTLI_Reason           = row.Cells[2].Value.ToString();
                                LineIssue.TLCMTLI_TransferApproved = row.Cells[3].Value.ToString();
                                LineIssue.TLCMTLI_TransferDate     = DateTime.Now;
                                LineIssue.TLCMTLI_OnHold           = OnHold;

                                if (NewLineAssigned != 0)
                                {
                                    LineIssue.TLCMTLI_LineNo_FK = NewLineAssigned;
                                }
                            }
                        }

                        try
                        {
                            context.SaveChanges();
                            MessageBox.Show("Data successfully saved to database");

                            dataGridView1.Rows.Clear();
                            dataGridView1.Rows.Add();

                            cmboCutSheet.SelectedValue    = -1;
                            cmboDepartment.SelectedValue  = -1;
                            cmboLineDetails.SelectedValue = -1;

                            txtColours.Text = string.Empty;
                            txtPanels.Text  = string.Empty;
                            txtSizes.Text   = string.Empty;
                            txtStyle.Text   = string.Empty;
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }
                }
            }
        }