Esempio n. 1
0
        public bool UpdateData(string userID, ControlStockData data)
        {
            bool ret = true;

            ProductMinMaxDAL oDAL = new ProductMinMaxDAL();

                oDAL.GetDataByLOID(data.LOID, null);
 
                oDAL.STANDARD = Convert.ToDouble(data.STANDARD);
                oDAL.MINIMUM = Convert.ToDouble(data.MINIMUM);
                oDAL.MAXIMUM = Convert.ToDouble(data.MAXIMUM);

                ret = oDAL.UpdateCurrentData(userID, null);

                if (!ret)
                {
                    _error = oDAL.ErrorMessage;
                }
         
            return ret;
        }
Esempio n. 2
0
        public bool InsertData(string userID, ControlStockData data)
        {
            Boolean ret = true;
            ProductMinMaxDAL oDAL = new ProductMinMaxDAL();

            oDAL.PRODUCT = Convert.ToInt32(data.PRODUCT);
            oDAL.WAREHOUSE = Convert.ToInt32(data.WAREHOUSE);
            oDAL.STANDARD = Convert.ToDouble(data.STANDARD);
            oDAL.MINIMUM = Convert.ToDouble(data.MINIMUM);
            oDAL.MAXIMUM = Convert.ToDouble(data.MAXIMUM);
            oDAL.ACTIVE = Convert.ToInt32(data.ACTIVE);

            ret = oDAL.InsertCurrentData(userID, null);

            if (ret == false)
                _error = oDAL.ErrorMessage;
            else
                _LOID = oDAL.LOID;

            return ret;

        }
Esempio n. 3
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();
                }
                   
             }

        }
Esempio n. 4
0
        public bool DeleteData(string userID, ControlStockData data)
        {
            bool ret = true;
            ProductMinMaxDAL oDAL = new ProductMinMaxDAL();

            oDAL.LOID = Convert.ToDouble(data.LOID);

            ret = oDAL.DeleteCurrentData(null);

            if (ret == false)
                _error = oDAL.ErrorMessage;

            return ret;

        }
Esempio n. 5
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;
        }