예제 #1
0
        private void bottonAdd_Click(object sender, EventArgs e)
        {
            if (!validateForm())
            {
                return;
            }
            readData();
            int productID = conDB.addProduct();

            Debug.WriteLine(productID);
            if (productID == 0)
            {
                MessageBox.Show("ชื่อสินค้า \"" + nameTH.Text + "\" มีการเพิ่มเข้ามาแล้ว\nกรุณาตรวจสอบ");
                nameTH.Focus();
            }
            else
            {
                clearData();
                if (fRMMain.oldPage == "UCAddCustomerClem")
                {
                    fRMMain.addCustomerClem.productName.Text = nameTH.Text;
                    fRMMain.addCustomerClem.productName.Focus();
                }
                else if (fRMMain.oldPage == "UCAddEmployeeClem")
                {
                    fRMMain.addEmployeeClem.productName.Text = nameTH.Text;
                    fRMMain.addEmployeeClem.productName.Focus();
                }
                fRMMain.changPage();
            }
        }
예제 #2
0
        private void readData()
        {
            conDB.customer_id = 0;
            if (productName.SelectedText == "")
            {
                conDB.product_name_th     = productName.Text.Trim();
                conDB.product_name_en     = "";
                conDB.product_price       = 0;
                conDB.product_value       = "";
                conDB.product_date_create = convertDT.convert(DateTime.Now);
                conDB.product_date_stamp  = convertDT.convert(DateTime.Now);
                conDB.product_id          = conDB.addProduct();
            }

            if (companyName.SelectedIndex < 0)
            {
                conDB.company_name_th     = companyName.Text.Trim();
                conDB.company_name_en     = "";
                conDB.company_adddress    = "";
                conDB.company_phone       = "";
                conDB.company_email       = "";
                conDB.company_date_create = convertDT.convert(DateTime.Now);
                conDB.company_date_stamp  = convertDT.convert(DateTime.Now);
                conDB.company_id          = conDB.addCompany();
            }

            if (productType.SelectedIndex < 0)
            {
                conDB.product_type_name_th     = productType.Text.Trim();
                conDB.product_type_name_en     = "";
                conDB.product_type_date_create = convertDT.convert(DateTime.Now);
                conDB.product_type_date_stamp  = convertDT.convert(DateTime.Now);
                conDB.product_type_id          = conDB.addProductType();
            }

            conDB.product_name = productName.Text.Trim();
            conDB.serial       = serial.Text.Trim();
            conDB.address      = "";
            conDB.phone        = "";
            conDB.status       = status.Text;
            conDB.date_create  = convertDT.convert(DateTime.Now);
            conDB.date_product = convertDT.convert(dtProductEndDate.DateTime);
            conDB.date_stamp   = convertDT.convert(DateTime.Now);
            conDB.chargebacks  = 0;
            conDB.warranty     = "";
            conDB.symptom      = symptom.Text.Trim();
            conDB.equipment    = equipment.Text.Trim();
            conDB.detail       = detail.Text.Trim();

            if (fRMMain.typeOfEmployeeClem == "add")
            {
                conDB.in_document_number_id = conDB.getNewIDClemOfMonth(clemType);
            }
            else
            {
                conDB.in_document_number_id = conDB.getNewIDClemOfMonth(clemType);
            }
            conDB.in_document_number        = convertDT.convert(DateTime.Now);
            conDB.in_document_number_string = inDocumentNumber.Text;

            conDB.out_document_number      = outDocumentNumber.Text.Trim();
            conDB.in_serial_clem           = "";
            conDB.out_serial_clem          = "";
            conDB.clem_type                = clemType;
            conDB.customer_clem            = "";
            conDB.employee_receive_clem    = "";
            conDB.employee_clem            = employeeClem.Text.Trim();
            conDB.company_receive_clem     = companyReceiveClem.Text.Trim();
            conDB.company_return           = companyReturn.Text.Trim();
            conDB.employee_receive_product = employeeReceiveProduct.Text.Trim();
            conDB.employee_return          = "";
            conDB.customer_receive_product = "";
        }