private void btnAdd_Click(object sender, EventArgs e) { var data = ShiftService.GetListShiftHistoryByUserid(userid, 0).ToList().FirstOrDefault(); if (data != null) { frmMessager frm = new frmMessager("Warning", "Only one working period can be used. To create a new working period, please end the current."); frm.ShowDialog(); //if (frm.DialogResult == System.Windows.Forms.DialogResult.OK) //{ // UserLoginModel.ShiffID = data.ShiftHistoryID; //} } else { frmNewShift frm = new frmNewShift(); frm.ShowDialog(); if (frm.DialogResult == System.Windows.Forms.DialogResult.OK) { addOnDutyList("On Duty", 1); frm.Close(); } } }