void timer1_Tick(object sender, EventArgs e) { if (status != 1 || status == 2) { return; } timer1.Stop(); entity1 = new AndonAlertEntity() { ANDON_ALERT_CONTENT = afterandonBtntext, ANDON_ALERT_TIME = DateTime.Now, ANDON_TYPE_CODE = "A", ANSWER_FLAG = "N", COMPANY_CODE = LoginInfo.CompanyInfo.COMPANY_CODE, EMPLOYEE_CODE = LoginInfo.UserInfo.USER_ID, LOCATION_CODE = LoginInfo.StationInfo.RMES_ID, PLINE_CODE = LoginInfo.ProductLineInfo.RMES_ID, REPORT_FLAG = "Y", STOP_FLAG = "1", TEAM_CODE = LoginInfo.TeamInfo.TEAM_CODE }; AndonFactory.SaveAndonAlert(entity1); btnAndon.Text = afterandonBtntext; btnAndon.BackColor = Color.MediumVioletRed; status = 2; //throw new NotImplementedException(); }
private void btnAndon_Click(object sender, EventArgs e) { switch (status) { case 0: // normal status int menuheight = ctmenuAndon.Height; ctmenuAndon.Width = btnAndon.Width; ctmenuAndon.Show(btnAndon, new Point(0, 0)); break; case 1: // prepare andon call, can be canceled timer1.Stop(); status = 0; entity1 = null; btnAndon.Text = currentBtnText; btnAndon.BackColor = SystemColors.Control; label1.Visible = false; break; case 2: // calling, can be canceled, but it should be canceld by others who has the privilage. timer1.Stop(); status = 0; entity1.ANSWER_FLAG = "Y"; entity1.ANDON_ANSWER_TIME = DateTime.Now; entity1.REPORT_FLAG = "N"; entity1.MATERIAL_CODE = "-1"; AndonFactory.SaveAndonAlert(entity1); entity1 = null; btnAndon.BackColor = SystemColors.Control; btnAndon.Text = currentBtnText; label1.Visible = false; break; default: status = 0; timer1.Stop(); entity1 = null; break; } }