IT Story/C# & WPF

Barcode input processing and window status change processing

Hoyami7 2022. 6. 23. 20:57
반응형
void ReciveBarCode(string ReciveData)
        {
            if (CommonUtils.BarCodeStat) return;
            
            
            string CardID = ReciveData.Remove(ReciveData.Length - 2, 2);

            string Que = "Select no from TB_Member Where EducardNum = '" + CardID + "'";
            DataTable dt = PLAcaDBManager.GetQueryData(Que);

            if (dt != null)
            {
                int MemberKey = 0;
                foreach (DataRow row in dt.Rows)
                    MemberKey = Convert.ToInt32(row["no"]);

                wndMonthlyDayTest wms = new wndMonthlyDayTest(MemberKey);
                if (wms.ShowDialog() == DialogResult.OK)
                {
                    XtraMessageBox.Show("출석처리가 완료되었습니다.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                wms.Close();
            }
            else UtilManager.ShowWaitDialog("등록되어 있지않은 회원입니다."); //XtraMessageBox.Show("등록되어 있지않은 회원입니다.", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

        private void ucInfoWindow1_OnChangeState()
        {
            if (ucInfoWindow1.UseInfoWindow)
            {
                pnlInfo.Height = 140;
                spInfo.Visible = true;
            }
            else
            {
                pnlInfo.Height = 30;
                spInfo.Visible = false;
            }
        }

        bool _blogout = false;
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (!_blogout)
                {
                    if (XtraMessageBox.Show(this, "프로그램을 종료하시겠습니까?", "종료 확인", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                    {
                        e.Cancel = true;
                        return;
                    }

                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    CommonUtils.plcomm.Close();
                }
                else
                {
                    _blogout = false;
                    this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                }
            }
            catch (Exception ee)
            {
                TraceManager.AddLog(string.Format("{0}r\n{1}", ee.StackTrace, ee.Message));
                System.Diagnostics.Debug.WriteLine(string.Format("{0}r\n{1}", ee.StackTrace, ee.Message));
            }
반응형