示例#1
0
        private void printPreviewDTRToolStripMenuItem_Click(object sender, EventArgs e)
        {
            tabControl1.SelectTab(1);
            Thread.Sleep(200);
            Application.DoEvents();
            string          SDuration = toolStripComboBoxMonth.Text.Trim() + " " + toolStripComboBoxDuration.Text.Trim();
            ReportParameter p1        = new ReportParameter("EnrolleeName", textBoxName.Text.Trim());
            ReportParameter p2        = new ReportParameter("DurationLabel", SDuration);

            this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2 });
            if (System.Configuration.ConfigurationManager.AppSettings["PrintAll"] == "True")
            {
                DTRBindingSource.DataSource = lDTRSource;
            }
            else
            {
                var tempDTRSource = new List <DTR>();
                foreach (var dtr in lDTRSource)
                {
                    DTR d = dtr;
                    d.TotalHour   = null;
                    d.TotalMinute = null;
                    tempDTRSource.Add(d);
                }
                DTRBindingSource.DataSource = tempDTRSource;
            }
            this.reportViewer1.RefreshReport();
        }
示例#2
0
        private void InTR(string txt)
        {
            int tam = 0;

            try
            {
                if (LUsuarios.InvokeRequired)
                {
                    DTR MR = new DTR(InTR);
                    this.Invoke(MR, new object[] { txt });
                }
                else
                {
                    if (pictureBox1.Visible)
                    {
                        SP.Play();
                    }
                    tam = TR.TextLength;
                    TR.AppendText(txt + "\n");
                    if (txt.IndexOf("dice:" + (char)31) > -1)
                    {
                        TR.Select(TR.GetFirstCharIndexFromLine(TR.GetLineFromCharIndex(TR.Find("dice:" + (char)31, tam, RichTextBoxFinds.MatchCase))), TR.GetFirstCharIndexFromLine(TR.GetLineFromCharIndex(TR.Find("dice:" + (char)31, tam, RichTextBoxFinds.MatchCase)) + 1) - TR.GetFirstCharIndexFromLine(TR.GetLineFromCharIndex(TR.Find("dice:" + (char)31, tam, RichTextBoxFinds.MatchCase))));
                        TR.SelectionColor = Color.Green;
                    }

                    TR.Refresh();
                }
            }
            catch (Exception ex)
            {
                Funciones.Log(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase), ex.Message + ex.StackTrace.Substring(ex.StackTrace.Length - 11));
            }
        }
示例#3
0
        public static bool Delete(DTR dtr)
        {
            using (_d = new DataRepository <DTR>())
            {
                _d.Delete(dtr);
                _d.SaveChanges();
            }

            return(true);
        }
示例#4
0
    static IEnumerable <DTR> GetTransforms2(DTR ts)
    {
        yield return(ts);

        foreach (Transform t in ts.transform)
        {
            foreach (var t2 in GetTransforms2(new DTR {
                path = (ts.path + "/" + t.name), transform = t
            }))
            {
                yield return(t2);
            }
        }
    }
示例#5
0
        public static int Save(DTR dtr)
        {
            var a = new DTR
            {
                DTRId       = dtr.DTRId,
                EmployeeId  = dtr.EmployeeId,
                EmployeeNo  = dtr.EmployeeNo,
                DTRDate     = dtr.DTRDate,
                DTRDay      = dtr.DTRDay,
                TimeInAM    = dtr.TimeInAM,
                TimeOutAM   = dtr.TimeOutAM,
                TimeInPM    = dtr.TimeInPM,
                TimeOutPM   = dtr.TimeOutPM,
                TimeInOT    = dtr.TimeInOT,
                TimeOutOT   = dtr.TimeOutOT,
                TotalHours  = dtr.TotalHours,
                TotalHour   = dtr.TotalHour,
                TotalMinute = dtr.TotalMinute,
                DTRStatus   = dtr.DTRStatus,
                IsSource    = dtr.IsSource,
                EditedBy    = dtr.EditedBy,
                EditedOn    = dtr.EditedOn
            };

            using (_d = new DataRepository <DTR>())
            {
                if (dtr.DTRId > 0)
                {
                    _d.Update(a);
                }
                else
                {
                    _d.Add(a);
                }

                _d.SaveChanges();
            }

            return(a.DTRId);
        }
示例#6
0
        private void dTRBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            if (dTRBindingSource != null)
            {
                this.Validate();
                dTRBindingSource.EndEdit();
                List <DTR> lDtr1 = ActionClass.FillDTRs(OEnrollee.EnrolleeId, IMonth, IYear);
                var        lDtr2 = new List <DTR>();

                foreach (var dtr in lDTR)
                {
                    DTR d = lDtr1.FirstOrDefault(dt => (dt.DTRDate == dtr.DTRDate));
                    if (d == null)
                    {
                        dtr.IsSource = false;
                        dtr.EditedBy = SUserName;
                        dtr.EditedOn = DateTime.Now;
                        lDtr2.Add(dtr);
                    }
                    else
                    {
                        string tempTimeInAM  = (d.TimeInAM != null) ? d.TimeInAM.Trim() : null;
                        string tempTimeOutAM = (d.TimeOutAM != null) ? d.TimeOutAM.Trim() : null;
                        string tempTimeInPM  = (d.TimeInPM != null) ? d.TimeInPM.Trim() : null;
                        string tempTimeOutPM = (d.TimeOutPM != null) ? d.TimeOutPM.Trim() : null;
                        string tempTimeInOT  = (d.TimeInOT != null) ? d.TimeInOT.Trim() : null;
                        string tempTimeOutOT = (d.TimeOutOT != null) ? d.TimeOutOT.Trim() : null;

                        if ((tempTimeInAM != dtr.TimeInAM) || (tempTimeOutAM != dtr.TimeOutAM) ||
                            (tempTimeInPM != dtr.TimeInPM) || (tempTimeOutPM != dtr.TimeOutPM) ||
                            (tempTimeInOT != dtr.TimeInOT) || (tempTimeOutOT != dtr.TimeOutOT))
                        {
                            dtr.IsSource = false;
                            dtr.EditedBy = SUserName;
                            dtr.EditedOn = DateTime.Now;
                            dtr.DTRId    = d.DTRId;

                            ActionClass.SaveDTR(dtr);
                        }
                    }
                }

                if (lDtr2.Count > 0)
                {
                    int iResult = ActionClass.SaveDTR(lDtr2);
                    if (iResult > 0)
                    {
                        toolStripStatusLabel1.Text = "Record successfully saved. (" + lDtr2.Count.ToString() +
                                                     " record)";
                        Thread.Sleep(200);
                        Application.DoEvents();
                    }
                    else
                    {
                        toolStripStatusLabel1.Text = "Error Occured while saving data to database or duplicate record already exists.";
                    }
                }
                else
                {
                    toolStripStatusLabel1.Text = "Record already exists.";
                }
            }
            Cursor.Current = Cursors.Default;
        }
示例#7
0
        public List <Stdf4Record> ReadStdf4(BinaryReader reader)
        {
            List <Stdf4Record> records;

            if (this.OnlyParse)
            {
                records = null;
            }
            else
            {
                records = new List <Stdf4Record>(capacity: this.InitialListCapacity);
            }

            int                pos          = 0;
            int                recordNumber = 0;
            Stdf4Record        rec;
            StdfValueConverter converter = new StdfValueConverter();

            try
            {
                ushort recordLength;
                while (true)
                {
                    if (this.ReverseBytesOnRead)
                    {
                        this._twoBytes[1] = reader.ReadByte();
                        this._twoBytes[0] = reader.ReadByte();
                        recordLength      = BitConverter.ToUInt16(_twoBytes, 0);
                    }
                    else
                    {
                        recordLength = reader.ReadUInt16();
                    }

                    var stdfMajorType  = reader.ReadByte();
                    var stdfMinorType  = reader.ReadByte();
                    int stdfRecordType = (((int)stdfMajorType) << 8) | (int)stdfMinorType;

                    // for a FAR record, always read 6 bytes since we don't know the byte order yet.
                    // Also avoiding a cast here.
                    byte[] bytes;
                    if (stdfRecordType == 10)
                    {
                        recordLength = 2;
                    }

                    bytes         = reader.ReadBytes(recordLength);
                    pos          += recordLength + 4;
                    recordNumber += 1;

                    //Three most common record types without a cast and outside the switch statement
                    if (this._debugLevel >= 3)
                    {
                        // Fall through to case statement for lots of printing.
                    }
                    else if (stdfRecordType == 3850)
                    {
                        if (this.OnlyParse)
                        {
                            var ignore_PTR = new PTR(bytes, converter);
                        }
                        else
                        {
                            records.Add(new PTR(bytes, converter));
                        }
                        continue;
                    }
                    else if (stdfRecordType == 1290)
                    {
                        if (this.OnlyParse)
                        {
                            var ignore_PIR = new PIR(bytes, converter);
                        }
                        else
                        {
                            records.Add(new PIR(bytes, converter));
                        }
                        continue;
                    }

                    if (this._debugLevel >= 3 || (this.Verbose && stdfMajorType != 5 && stdfMajorType != 10 && stdfMajorType != 15))
                    {
                        Console.WriteLine(string.Empty);
                        Console.WriteLine($"  Record {recordNumber} is {recordLength} bytes long (0x{recordLength:X2}) of type {stdfMajorType} - {stdfMinorType} ({stdfRecordType}).");
                        if (this._debugLevel > 0)
                        {
                            Console.Write((new LavaData.Util.Debug.HexDump(bytes)).ToString());
                            if (this._debugLevel > 1)
                            {
                                // We want the record length and record type/sub-type.
                                var newBytes = new byte[bytes.Length + 4];
                                (newBytes[0], newBytes[1]) = converter.UshortToBytes(recordLength);
                                newBytes[2] = stdfMajorType;
                                newBytes[3] = stdfMinorType;
                                for (int i = 0; i < bytes.Length; i++)
                                {
                                    newBytes[i + 4] = bytes[i];
                                }
                                Console.WriteLine((new LavaData.Util.Debug.HexDump(newBytes).ToHexByteString()));
                            }
                        }
                    }

                    rec = null;
                    if (Enum.IsDefined(typeof(Stdf4RecordType), stdfRecordType))
                    {
                        Stdf4RecordType recordType = (Stdf4RecordType)stdfRecordType;
                        switch ((Stdf4RecordType)stdfRecordType)
                        {
                        case Stdf4RecordType.PTR:
                            // UNREACHABLE CODE -- handled above, except with debug >=3
                            rec = new PTR(bytes, converter);
                            break;

                        case Stdf4RecordType.PIR:
                            // UNREACHABLE CODE -- handled above, except with debug >=3
                            rec = new PIR(bytes, converter);
                            break;

                        case Stdf4RecordType.PRR:
                            rec = new PRR(bytes, converter);
                            break;

                        case Stdf4RecordType.FAR:
                            var far = new FAR(bytes, converter);
                            converter.CpuType       = far.CpuType;
                            this.ReverseBytesOnRead = converter.ReverseBytesOnRead;
                            rec = far;
                            break;

                        //Data collected on a per lot basis; 1-NN Records
                        case Stdf4RecordType.MIR:
                            rec = new MIR(bytes, converter);
                            break;

                        case Stdf4RecordType.MRR:
                            rec = new MRR(bytes, converter);
                            break;

                        case Stdf4RecordType.PCR:
                            rec = new PCR(bytes, converter);
                            break;

                        case Stdf4RecordType.HBR:
                            rec = new HBR(bytes, converter);
                            break;

                        case Stdf4RecordType.SBR:
                            rec = new SBR(bytes, converter);
                            break;

                        case Stdf4RecordType.PMR:
                            throw new Stdf4ParserException("PMR  Not Implemented");

                        case Stdf4RecordType.PGR:
                            throw new Stdf4ParserException("PGR  Not Implemented");

                        case Stdf4RecordType.RDR:
                            throw new Stdf4ParserException("RDR  Not Implemented");

                        case Stdf4RecordType.SDR:
                            rec = new SDR(bytes, converter);
                            break;

                        // Data collected per Wafer; 2-NN Records.
                        case Stdf4RecordType.WIR:
                            rec = new WIR(bytes, converter);
                            break;

                        case Stdf4RecordType.WRR:
                            rec = new WRR(bytes, converter);
                            break;

                        case Stdf4RecordType.WCR:
                            rec = new WCR(bytes, converter);
                            break;

                        case Stdf4RecordType.TSR:
                            //throw new Stdf4ParserException("TSR  Not Implemented");
                            break;


                        // Generic Data; 50-NN Records.
                        case Stdf4RecordType.GDR:
                            //throw new Stdf4ParserException("GDR  Not Implemented");
                            break;

                        case Stdf4RecordType.DTR:
                            rec = new DTR(bytes, converter);
                            break;

                        default:
                            Console.WriteLine($"  Unhandled STDF4 Record Type: {recordType} ({stdfMajorType} - {stdfMinorType}).");
                            break;
                        }

                        if (rec != null)
                        {
                            if (this._debugLevel >= 3 || (this.Verbose && stdfRecordType != 1300))
                            {
                                // Don't print PRR (1300), lots of them, except at a high debug level.
                                Console.WriteLine(rec.ToString());
                            }

                            if (!this.OnlyParse)
                            {
                                records.Add(rec);
                            }
                        }
                    }
                    else
                    {
                        Console.WriteLine($"  No ENUM Defined for STDF4 Record Type: {stdfMajorType} - {stdfMinorType}.");
                    }
                }
            }
            catch (EndOfStreamException)
            {
                if (this.Verbose)
                {
                    Console.WriteLine("Read to the end of the stream!");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Unhandled Exception: " + ex.Message);
                Console.WriteLine(ex.StackTrace);
            }

            if (this.Verbose)
            {
                Console.WriteLine($"Read {recordNumber} records.");
            }

            return(records);
        }
示例#8
0
        public bool Delete()
        {
            TA_TRX.Fill(DS_Master.TRX);
            TA_ARRIVE.Fill(DS_Master.ARRIVE);
            TA_DEPART.Fill(DS_Master.DEPART);

            DTR_RESERV = DS_Master.Tables["RESERVATION"].Rows[BS_RESERVATION.Position];
            int i = DTR_RESERV.GetChildRows("ARRIVE_FK_IdReser").Length;
            int j = DTR_RESERV.GetChildRows("DEPART_FK_IdReser").Length;

            // Pré-conditions
            if (i != 0 && j != i)
            {
                MessageBox.Show("Le nombre d'arrivés n'est pas compatible avec le nombre de départs associés à cette réservation", "Impossible de suprimer");
                return(false);
            }

            if (ir_Reserv.DTP_Fin.Value.AddDays(2) < DateTime.Today)
            {
                MessageBox.Show("Une réservation doit rester dans la base de donnée au moins 2 jours après sa date de fin.", "Impossible de suprimer");
                return(false);
            }

            // Post-conditions
            foreach (DataRow DTR in DTR_RESERV.GetChildRows("TRX_FK_IdReser"))
            {
                DTR["IdReser"] = DBNull.Value;
            }

            foreach (DataRow DTR in DTR_RESERV.GetChildRows("DE_FK_IdReser"))
            {
                DTR.Delete();
            }

            foreach (DataRow DTR in DTR_RESERV.GetChildRows("DEPART_FK_IdReser"))
            {
                DTR.Delete();
            }

            foreach (DataRow DTR in DTR_RESERV.GetChildRows("ARRIVE_FK_IdReser"))
            {
                DTR.Delete();
            }

            DTR_RESERV.Delete();

            try
            {
                TA_TRX.Update(DS_Master.TRX);
                TA_DE.Update(DS_Master.DE);
                TA_ARRIVE.Update(DS_Master.ARRIVE);
                TA_DEPART.Update(DS_Master.DEPART);
                TA_RESERVATION.Update(DS_Master.RESERVATION);

                Sync_ForeignTables();

                MessageBox.Show("Reservation supprimé avec succès.", "Succès");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }

            return(false);
        }