コード例 #1
0
ファイル: frmStaff.cs プロジェクト: GordonSimon/TB20.hub
        /*******************************************************************************************************************\
        *                                                                                                                 *
        \*******************************************************************************************************************/

        private void do_delete()
        {
            bool    flag_save = false;
            DataSet ds        = dacTimebook.GetDS(RefWeek, 14);

            for (int i = 0; i < tlpCrew.RowCount; i++)
            {
                ucSalary uc = (ucSalary)tlpCrew.GetControlFromPosition(0, i);

                if (uc.EmpChk)
                {
                    if (uc.IsDirty())
                    {
                        flag_save = true;
                    }
                    continue;
                }

                if (!uc.IsDelete())
                {
                    continue;
                }


                //DataRow row;
                DateTime next_date;

                for (int day = 0; day < 14; day++)
                {
                    next_date = RefWeek.Date.AddDays(day);

                    dacTimebook.FindDel(new object[] { next_date, uc.EmpID, 0 });
                }

                uc.DeleteReset();
            }

            dacTimebook.DeleteData();
            dacCache.PutTimebook();

            cmdSave.Text    = "Save";
            cmdSave.Visible = flag_save;
        }
コード例 #2
0
ファイル: frmStaff.cs プロジェクト: GordonSimon/TB20.hub
        private void do_save()
        {
            DataSet ds = dacTimebook.GetDS(RefWeek, 14);

            for (int i = 0; i < tlpCrew.RowCount; i++)
            {
                ucSalary uc = (ucSalary)tlpCrew.GetControlFromPosition(0, i);

                if (!uc.EmpChk)
                {
                    continue;
                }
                if (uc.IsDelete())
                {
                    continue;
                }
                if (!uc.IsDirty())
                {
                    continue;
                }

                //MessageBox.Show(uc.EmpName);

                //RCD rcd = uc.RcdStat;
                //for (int j = 0; j <= 13; j++)
                //    if (rcd.toff[j] != null)  MessageBox.Show(rcd.toff[j].ToString());


                DataRow  row;
                DateTime next_date;

                for (int day = 0; day < 14; day++)
                {
                    next_date = RefWeek.Date.AddDays(day);

                    string toff   = uc.EmpToff[day];
                    string vessel = uc.EmpVessel[day];

                    row            = ds.Tables[0].NewRow();
                    row["EmpName"] = uc.EmpName;

                    if (toff != null && toff.Length == 0)
                    {
                        row["ToffCode"] = null;
                    }
                    else
                    {
                        row["ToffCode"] = toff;
                    }

                    row["LogHours"] = uc.EmpHour[day];
                    row["LogOver"]  = uc.EmpOver[day];

                    if (vessel != null && vessel.Length == 0)
                    {
                        row["LogVessel"] = null;
                    }
                    else
                    {
                        row["LogVessel"] = uc.EmpVessel[day];
                    }

                    row["LogShift"] = 0;

                    row["LogNote"] = null;
                    if (uc.EmpNote[day] != null && uc.EmpNote[day].Length > 0)
                    {
                        row["LogNote"] = uc.EmpNote[day];
                    }

                    dacTimebook.FindAdd(new object[] { next_date, uc.EmpID, 0 }, row);

                    uc.SaveReset();
                }
            }

            dacTimebook.SaveData();
            dacCache.PutTimebook();
            cmdSave.Visible = false;
        }