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

            Debug.WriteLine(customerID);
            if (customerID == 0)
            {
                MessageBox.Show("ชื่อลูกค้า \"" + nameTH.Text + "\" มีการเพิ่มเข้ามาแล้ว\nกรุณาตรวจสอบ");
                nameTH.Focus();
            }
            else
            {
                clearData();
                fRMMain.addCustomerClem.companyName.Text = nameTH.Text;
                fRMMain.addCustomerClem.companyName.Focus();
                fRMMain.changPage();
            }
        }
예제 #2
0
        private void readData()
        {
            if (customerName.SelectedIndex < 0)
            {
                conDB.name_th = customerName.Text.Trim();
                conDB.name_en = "";
                conDB.address = address.Text.Trim();
                conDB.phone   = phone.Text.Trim();
                conDB.email   = "";
                conDB.customer_date_create = convertDT.convert(DateTime.Now);
                conDB.customer_date_stamp  = convertDT.convert(DateTime.Now);
                conDB.customer_id          = conDB.addCustomer();
            }

            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      = address.Text.Trim();
            conDB.phone        = phone.Text.Trim();
            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);
            if (radioButtonInWarranty.Checked)
            {
                conDB.warranty    = "ในประกัน";
                conDB.chargebacks = 0;
            }
            else
            {
                conDB.warranty    = "นอกประกัน";
                conDB.chargebacks = double.Parse(textEditChargebacks.Text);
            }
            conDB.symptom   = symptom.Text.Trim();
            conDB.equipment = equipment.Text.Trim();
            conDB.detail    = detail.Text.Trim();

            if (fRMMain.typeOfCustomerClem == "add")
            {
                conDB.in_document_number_id = conDB.getNewIDClemOfMonth(clemType);
            }
            else
            {
                conDB.in_document_number_id = inDocumentNumberID;
            }
            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           = inSerialClem.Text.Trim();
            conDB.out_serial_clem          = outSerialClem.Text.Trim();
            conDB.clem_type                = clemType;
            conDB.customer_clem            = customerClem.Text.Trim();
            conDB.employee_receive_clem    = employeeReceiveClem.Text.Trim();
            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          = employeeReturn.Text.Trim();
            conDB.customer_receive_product = customerReceiveProduct.Text.Trim();
        }