Ejemplo n.º 1
0
 public static void WriteErrorOLEDB(ProblemOT pot)
 {
     using (OleDbConnection connection = new OleDbConnection(ConnStr))
        {
        connection.Open();
        string mysql = "INSERT INTO [Sheet4$] VALUES (";
        StringBuilder sb = new StringBuilder(mysql);
        SetValueOnError(pot.EmpName,sb);
        SetValueOnError(pot.EmpNumber,sb);
        SetValueOnError(pot.OT_Date,sb);
        SetValueOnError(pot.Apply_Number,sb);
        SetValueOnError(pot.OT_Hours,sb);
        SetValueOnError(pot.Offset_hours,sb);
        sb.Append("'')");
        OleDbCommand commande = new OleDbCommand(sb.ToString(), connection);
        commande.ExecuteNonQuery();
        connection.Close();
        connection.Dispose();
        }
 }
Ejemplo n.º 2
0
        public void CheckOffsetIntegrated()
        {
            var q = from p in context.OT_WORK where p.PAY_TYPE=="1" select p;
                Comm.Logger.Info(string.Format("等待确认记录共{0}条.", q.Count()));
                foreach (OT_WORK otwork in q)
                {
                    decimal offset_hours = 0;
                   foreach(OT_WORK_OFFSET work_offset in otwork.OT_WORK_OFFSET)
                   {
                       offset_hours +=(decimal)work_offset.OFFSET_HOURS;

                   }
                   if(!otwork.HOURS.Equals(offset_hours))
                   {
                       ProblemOT pot = new ProblemOT();
                       pot.EmpName = otwork.OT_EMP.EMP_NAME;
                       pot.EmpNumber = otwork.OT_EMP.EMP_NUMBER;
                       pot.Offset_hours = ((DateTime)otwork.START_DATE).ToString("yyyy-MM-dd");
                       pot.Apply_Number = otwork.OT_APP1.APP1_NO;
                       pot.OT_Hours = otwork.HOURS.ToString();
                       pot.Offset_hours = offset_hours.ToString();
                       ExcelTool.WriteErrorOLEDB(pot);
                   }
                }
        }
Ejemplo n.º 3
0
        public static void WriteError(ProblemOT pot)
        {
            ExcelTool.ErrSheet = (Worksheet)ErrBook.Sheets[4];
               int lastRow = ErrSheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell).Row;
               int index = lastRow + 1;
               ErrSheet.Cells[index, 1] = pot.EmpName;
               ErrSheet.Cells[index, 2] = pot.EmpNumber;
               ErrSheet.Cells[index, 3] = pot.OT_Date;
               ErrSheet.Cells[index, 4] = pot.Apply_Number;
               ErrSheet.Cells[index, 5] = pot.OT_Hours;
               ErrSheet.Cells[index, 6] = pot.Offset_hours;

               ErrBook.Save();
        }