Exemple #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool ret = true;

            //Insert ������
            //Check �����Թ���
            if (txtCode.Text == "")
            {
                Appz.OpenWarningDialog("��سҡ�͡�����Թ���");
            }
            //Check �����Թ���
            if (txtProductDetail.Text == "")
            {
                Appz.OpenWarningDialog("��سҡ�͡�����Թ���");
            }
            //Check ����ҳ�����
            if (txtStandard.Text == "")
            {
                Appz.OpenWarningDialog("��سҡ�͡����ҳ�����");
                return;
            }
            //Check ����ҳ����ش
            if (txtMinimum.Text == "")
            {
                Appz.OpenWarningDialog("��سҡ�͡����ҳ����ش");
                return;
            }
            //Check ����ҳ�٧�ش
            if (txtMaximum.Text == "")
            {
                Appz.OpenWarningDialog("��سҡ�͡����ҳ�٧�ش");
                return;
            }

            // Check ����ҳ����ش < ����ҳ����� < ����ҳ�٧�ش 
            if ((Convert.ToDouble(txtMinimum.Text) > Convert.ToDouble(txtStandard.Text)) || (Convert.ToDouble(txtMinimum.Text) > Convert.ToDouble(txtMaximum.Text)) || (Convert.ToDouble(txtStandard.Text) > Convert.ToDouble(txtMaximum.Text)))
            {
                Appz.OpenWarningDialog("�������ö����¡���� ��س��к�  ����ҳ����ش < ����ҳ����� < ����ҳ�٧�ش");
                return;
            }

            //Check �ӹǹ����͡㹪�ͧ����ҳ�٧�ش��ͧ���¡��� 100,000,000.00
            if (Convert.ToDouble(txtMaximum.Text) > 10000000.00)
            {
                Appz.OpenWarningDialog("��س��кبӹǹ����� 0.00 � 9,999,999,999.99 ");
                return;
            }

            //Check �ӹǹ����͡㹪�ͧ����ҳ����ش��ͧ���¡��� 100,000,000.00
            if (Convert.ToDouble(txtMinimum.Text) > 10000000.00)
            {
                Appz.OpenWarningDialog("��س��кبӹǹ����� 0.00 � 9,999,999,999.99 ");
                return;
            }


            //Check �ӹǹ����͡㹪�ͧ����ҳ������ͧ���¡��� 100,000,000.00
            if (Convert.ToDouble(txtStandard.Text) > 10000000.00)
            {
                Appz.OpenWarningDialog("��س��кبӹǹ����� 0.00 � 9,999,999,999.99 ");
                return;
            }

            btnSearchProduct.Enabled = false;
            //update ������
            if (!this.txtCode.Enabled)
            {
                ControlStockData CsData = new ControlStockData();
                ControlStockFlow csFlow = new ControlStockFlow();

                CsData.LOID = Convert.ToDouble(txtPMLoid.Text.Trim());
                CsData.STANDARD = txtStandard.Text;
                CsData.MINIMUM = txtMinimum.Text;
                CsData.MAXIMUM = txtMaximum.Text;
                CsData.WAREHOUSE = Convert.ToDouble(this.txtWHLoid.Text);
                ret = csFlow.UpdateData(txtPMLoid.Text.Trim(), CsData);

                if (!ret)
                    Appz.OpenErrorDialog(csFlow.ErrorMessage);
                else
                {
                    Appz.OpenInformationDialog("�ѹ�֡���������º����");
                    LoadData();
                }
            }
            else
            {
                ControlStockData CsData = new ControlStockData();
                ControlStockFlow csFlow = new ControlStockFlow();

                CsData.PRODUCT = Convert.ToDouble(txtPLoid.Text);
                CsData.WAREHOUSE = Convert.ToDouble(txtWHLoid.Text);
                CsData.STANDARD = txtStandard.Text;
                CsData.MINIMUM = txtMinimum.Text;
                CsData.MAXIMUM = txtMaximum.Text;
                ret = csFlow.InsertData(Appz.CurrentUserData.UserID.ToString(), CsData);

                if (!ret)
                    Appz.OpenErrorDialog(csFlow.ErrorMessage);
                else
                {
                    txtPMLoid.Text = csFlow.GetLoid.ToString();
                    txtCode.Enabled = false;
                    Appz.OpenInformationDialog("�ѹ�֡���������º����");
                    LoadData();
                }
                   
             }

        }
Exemple #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (Appz.OpenQuestionDialog("��ͧ���ź�������������?") == DialogResult.OK)
            {
                bool ret = true;
                ControlStockData CsData = new ControlStockData();
                ControlStockFlow csFlow = new ControlStockFlow();
                CsData.LOID = Convert.ToDouble(txtPMLoid.Text);
                ret = csFlow.DeleteData("test", CsData);

                if (!ret)
                    MessageBox.Show(csFlow.ErrorMessage);
                else
                    LoadData();
            }
            btnSearchProduct.Enabled = false;
        }