Ejemplo n.º 1
0
        private void btnGetReason_Click(object sender, EventArgs e)
        {
            int           reasonIndex = 0;
            GetReasonForm getDateForm = new GetReasonForm()
            {
                Owner = this
            };

            if (getDateForm.ShowDialog() == DialogResult.OK)
            {
                reasonIndex = getDateForm.Reason;
                string response = SendMessage(String.Format("getreason {0} {1}", userId, reasonIndex));
                if (response.Equals("Wrong Input!"))
                {
                    rtbConsole.Text = response;
                }
                else
                {
                    if (!response.Equals("No data"))
                    {
                        String[] records = response.Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries);
                        rtbConsole.Text = "";
                        int counter = 1;
                        foreach (String current in records)
                        {
                            String[] currentParams = current.Split(new char[] { '#' }, StringSplitOptions.RemoveEmptyEntries);
                            rtbConsole.Text += String.Format("{0}. Value: {1}, Spend for: {2}, On: {3}{4}", counter++, currentParams[0], reasons[reasonIndex], currentParams[1], Environment.NewLine);
                        }
                    }
                    else
                    {
                        rtbConsole.Text = String.Format("{0} you dont have entered records for {1}.", userName, reasons[reasonIndex]);
                    }
                }
            }
        }
 private void buttonTransfer_Click(object sender, EventArgs e)
 {
     GetReasonForm f = new GetReasonForm("ת��");
     f.ShowDialog();
     if (f.ret != 0)
     {
         string sTyp = f.sTyp;
         string sDept = f.sDept;
         string sMan = f.sEmpNam;
         string sAddr = f.sAddr;
         string sReason = f.sReason;
         List<string> listAssId = new List<string>();
         for (int j = 0; j < listView1.Items.Count; j++)
         {
             string sAssId = listView1.Items[j].SubItems[(int)Index.assid].Text;
             listAssId.Add(sAssId);
         }
         string sErr;
         bool bOK = AssChange(sTyp, sDept, sMan, sAddr, sReason, listAssId, out sErr);
         if (bOK)
         {
             MessageBox.Show("�����ɹ���");
             buttonClear_Click(null, null);
         }
         else
         {
             MessageBox.Show("����ʧ�ܣ�\r\n" + sErr);
         }
     }
 }
        private void buttonClear_Click(object sender, EventArgs e)
        {
            if (tabControl1.SelectedIndex == (int)Page.onepcs)//���ζ�ȡ
            {
                textBoxTid.Text = "";
                textBoxEpc.Text = "";
                labelMsg.Text = "";
            }
            else if (tabControl1.SelectedIndex == (int)Page.inv) //ѭ����ȡ
            {
                listView1.Items.Clear();
            }
            else if (tabControl1.SelectedIndex == (int)Page.sync)//ͬ��
            {
            }
            else if (tabControl1.SelectedIndex == (int)Page.check)//�̵�
            {
                CheckOptForm checkoptform = new CheckOptForm();
                int nIndex = listView2.Items.IndexOf(listView2.FocusedItem);
                if (checkoptform.ShowDialog() == DialogResult.OK)
                {
                    string sErr;
                    bool bOK = false;
                    if (checkoptform.sOptTyp == "�ֶ��̵�")
                    {
                        bOK = checkAss(nIndex, checkoptform.sOptTyp, out sErr);
                       if (bOK)
                       {
                           MessageBox.Show("�����ɹ���");
                       }
                       else
                       {
                           MessageBox.Show("����ʧ�ܣ�\r\n" + sErr);
                       }
                    }
                    else if (checkoptform.sOptTyp == "����" || checkoptform.sOptTyp == "��ʧ")
                    {
                        GetReasonForm f = new GetReasonForm(checkoptform.sOptTyp);
                        f.ShowDialog();
                        if (f.ret != 0)
                        {
                            string sTyp = f.sTyp;
                            string sDept = f.sDept;
                            string sMan = f.sEmpNam;
                            string sAddr = f.sAddr;
                            string sReason = f.sReason;
                            List<string> listAssId = new List<string>();
                            string sAssId = listView2.Items[nIndex].SubItems[2].Text;
                            listAssId.Add(sAssId);
                            bOK = AssChange(sTyp, sDept, sMan, sAddr, sReason, listAssId, out sErr);
                            if (bOK)
                            {
                                bOK = checkAss(nIndex, checkoptform.sOptTyp, out sErr);
                            }

                            if (bOK)
                            {
                                MessageBox.Show("�����ɹ���");
                            }
                            else
                            {
                                MessageBox.Show("����ʧ�ܣ�\r\n" + sErr);
                            }
                        }//GetReasonForm
                    }//f.sOptTyp
                }//f.ShowDialog()
            }//tabControl1.SelectedIndex
        }