Ejemplo n.º 1
0
        /*******************************************************************************************************************\
        *                                                                                                                 *
        \*******************************************************************************************************************/

        private void update_timebook()  // shift_version
        {
            if (RefWeek == null)
            {
                return;
            }

            DataSet ds = dacTimebook.GetDS(RefWeek, 14);

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                var bookdate_ = row["Bookdate"];

                if (bookdate_ == DBNull.Value)
                {
                    continue;
                }
                DateTime bookdate = (DateTime)bookdate_;
                if (bookdate.Date < RefWeek.Date)
                {
                    continue;
                }
                if (bookdate.Date >= RefWeek.AddDays(14).Date)
                {
                    continue;
                }


                //ucStat uc = (ucStat)tlpCrew.GetControlFromPosition(0, 0);
                ucStat uc = _crew[row["EmpID"].ToString()];
                uc.RefreshDay(bookdate, row["ToffCode"].ToString(),
                              Convert.ToSingle(row["LogHours"]), Convert.ToSingle(row["LogOver"]),
                              row["LogVessel"].ToString(), Convert.ToInt32(row["LogShift"]), row["LogNote"].ToString());
            }
        }
Ejemplo n.º 2
0
        /*******************************************************************************************************************\
        *                                                                                                                 *
        \*******************************************************************************************************************/

        private void update_timebook(bool show_all)
        {
            if (RefWeek == null)
            {
                return;
            }

            //DataSet ds = dacTimebook.GetDS(RefWeek, 14);
            //foreach (DataRow row in ds.Tables[0].Rows)

            foreach (DataRow row in _dt_crew.Rows)
            {
                var bookdate_ = row["Bookdate"];

                if (bookdate_ == DBNull.Value)
                {
                    continue;
                }
                DateTime bookdate = (DateTime)bookdate_;
                //if (bookdate.Date < RefWeek.Date) continue;
                //if (bookdate.Date >= RefWeek.AddDays(14).Date) continue;
                if (bookdate.Date.CompareTo(RefWeek.Date) == -1)
                {
                    continue;
                }
                if (bookdate.Date.CompareTo(RefWeek.AddDays(14).Date) == 1)
                {
                    continue;
                }


                //ucStat uc = (ucStat)tlpCrew.GetControlFromPosition(0, 0);
                //if (!_crew.ContainsKey(row["EmpId"].ToString()))
                //    load_crew_from_row(RefWeek, row);

                try
                {
                    if (!show_all && !_crew.ContainsKey(row["EmpID"].ToString()))
                    {
                        continue;
                    }

                    ucStat uc = _crew[row["EmpID"].ToString()];

                    string notebug = null;  // can't use row["LogNote"].ToString()
                    if (!DBNull.Value.Equals(row["LogNote"]))
                    {
                        notebug = row["LogNote"].ToString();
                    }

                    //if (row["EmpID"].ToString().Equals("G8") && ((decimal)row["LogHours"]) == 13.0M
                    //if (row["EmpID"].ToString().Equals("W3") && ((DateTime)row["BookDate"]).Date.Equals(new DateTime(2015, 05, 11))
                    //    ) MessageBox.Show("W3" + row["ToffCode"].ToString() + row["LogHours"].ToString() );

                    uc.RefWeek = RefWeek;
                    uc.RefreshDay(bookdate, row["ToffCode"].ToString(),
                                  Convert.ToSingle(row["LogHours"]),
                                  Convert.ToSingle(row["LogOver"]),
                                  row["LogVessel"].ToString(),
                                  Convert.ToInt32(row["LogShift"]), notebug);
                }
                catch (Exception ex)
                {
                    string msg = string.Format("Error ({0}) : Employee : [{1}:{2}] {3} => TOFF Code [{4}]",
                                               ex.Message,
                                               bookdate,
                                               row["EmpID"].ToString(),
                                               row["EmpName"].ToString(),
                                               row["ToffCode"].ToString());

                    MessageBox.Show(msg, "frmSched.update_timebook()");
                }
            }
        }