/*******************************************************************************************************************\ * * \*******************************************************************************************************************/ //private TableLayoutPanel _tlpNote; private void note_click(object sender) { object[] note = (object[])((Panel)sender).Tag; string memo = note[0].ToString(); DateTime day = (DateTime)note[1]; ucNote uc = new ucNote(_emp_id, memo, day.Date); uc.ShowNote(); //_tlpNote = (TableLayoutPanel)(this.ParentForm.Controls.Find("tlpNote", false)[0]); //_tlpNote.Controls.Add(uc); //_tlpNote.Show(); //_tlpNote.BringToFront(); }
private void cmsSched_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { ToolStripItem i = e.ClickedItem; ContextMenuStrip cms = (ContextMenuStrip)sender; TextBox tbx = (TextBox)cms.SourceControl; DateTime d = (DateTime)tbx.Tag; //DataRow row = null; //DataTable dt = qrySummary.GetView("Employee", d, 1, _emp_id, null); //string emp_name = string.Empty; //string memo = string.Empty; //if (dt == null || dt.Rows.Count == 0) // emp_name = _emp_name; //else //{ // row = dt.Rows[0]; // emp_name = (string)row["EmpName"]; // memo = (string)row["Note"]; //} DateTime day = d.Date; DataSet ds = dacTimebook.GetDS(d, 1); DataRow row = ds.Tables[0].Rows.Find(new object[] { d, _emp_id, 0 }); string memo = string.Empty; if (row == null) { row = ds.Tables[0].NewRow(); row["EmpName"] = _emp_name; row["LogHours"] = 0m; row["LogOver"] = 0m; row["LogVessel"] = null; row["LogShift"] = 0; row["LogNote"] = null; } else { memo = row["LogNote"].ToString(); } switch (i.Text) { case "Note": //object[] note = (object[])((Panel)sender).Tag; //string memo = note[0].ToString(); //DateTime day = (DateTime)note[1]; ucNote uc = new ucNote(_emp_name, memo, day.Date); uc.EditNote(); if (uc.IsAccept() || !uc.IsDelete()) { if (uc.IsAccept()) { memo = uc.GetMemo(); } if (uc.IsDelete()) { memo = null; } row["LogNote"] = memo; dacTimebook.FindAdd(new object[] { d, _emp_id, 0 }, row); dacTimebook.SaveData(); dacCache.PutTimebook(); if (CueRequired) { ((CueWeek)this.ParentForm).Msg(); } } break; default: string toff = i.Text; if (toff.Equals("!12")) { toff = "12"; } row["ToffCode"] = toff; dacTimebook.FindAdd(new object[] { d, _emp_id, 0 }, row); dacTimebook.SaveData(); dacCache.PutTimebook(); if (CueRequired) { ((CueWeek)this.ParentForm).Msg(); } break; } }