Ejemplo n.º 1
0
        private void btn_Click(object sender, EventArgs e)/*เมื่อมีการ click ปุ่มการทำงาน*/
        {
            switch(NewFrm){

                case "Supplier" ://เรียก Dialog ข้อมูลผู้ขาย
                    Dialog.frmDialogSearchSupplier Supplier;
                    String[] spSupplier = NewTxt.Text.Split(']');
                    if (spSupplier.Length < 2)
                    {
                        Supplier = new Dialog.frmDialogSearchSupplier(NewTxt.Text);
                    }
                    else
                    {
                        Supplier = new Dialog.frmDialogSearchSupplier(spSupplier[1]);
                    }
                    Supplier.ShowDialog();
                    if (Supplier.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Supplier.GetSuplierId() + "] " + Supplier.GetSuplierName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "Branch"://เรียก Dialog ข้อมูลสาขา
                    Dialog.frmDialogSearchBranch Branch;
                    String[] spBranch = NewTxt.Text.Split(']');
                    if (spBranch.Length < 2)
                    {
                        Branch = new Dialog.frmDialogSearchBranch(NewTxt.Text);
                    }
                    else
                    {
                        Branch = new Dialog.frmDialogSearchBranch(spBranch[1]);
                    }
                    Branch.ShowDialog();
                    if (Branch.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Branch.GetBranchId() + "] " + Branch.GetBranchName();

                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "Shipper"://เรียก Dialog ข้อมูลขนส่ง
                    Dialog.frmDialogSearchShipper Shipper;
                    String[] spShipper = NewTxt.Text.Split(']');
                    if (spShipper.Length < 2)
                    {
                        Shipper = new Dialog.frmDialogSearchShipper(NewTxt.Text);
                    }
                    else
                    {
                        Shipper = new Dialog.frmDialogSearchShipper(spShipper[1]);
                    }
                    Shipper.ShowDialog();
                    if (Shipper.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Shipper.GetShipperId() + "] " + Shipper.GetShipperName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "Employer"://เรียก Dialog ข้อมูลเรือนจำ
                    Dialog.frmDialogSearchEmployer Employer;
                    String[] spEmployer = NewTxt.Text.Split(']');
                    if (spEmployer.Length < 2)
                    {
                        Employer = new Dialog.frmDialogSearchEmployer(NewTxt.Text);
                    }
                    else
                    {
                        Employer = new Dialog.frmDialogSearchEmployer(spEmployer[1]);
                    }
                    Employer.ShowDialog();
                    if (Employer.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Employer.GetEmployerId() + "] " + Employer.GetEmployerName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "CardFormula"://เรียก Dialog ข้อมูลเรือนจำ
                    ProductionNew.DialogSelectFormula SelectFormula;
                    String[] spSelectFormula = NewTxt.Text.Split(']');
                    if (spSelectFormula.Length < 2)
                    {
                        SelectFormula = new ProductionNew.DialogSelectFormula(NewTxt.Text);
                    }
                    else
                    {
                        SelectFormula = new ProductionNew.DialogSelectFormula(spSelectFormula[1]);
                    }
                    SelectFormula.ShowDialog();
                    if (SelectFormula.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + SelectFormula.GetFmId() + "] " + SelectFormula.GetFmName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "Product"://เรียก Dialog ข้อมูลรายการสินค้า
                    Dialog.frmDialogSearchProduct Product;
                    String[] spProduct = NewTxt.Text.Split(']');
                    if (spProduct.Length < 2)
                    {
                        Product = new Dialog.frmDialogSearchProduct(NewTxt.Text);
                    }
                    else
                    {
                        Product = new Dialog.frmDialogSearchProduct(spProduct[1]);
                    }
                    Product.ShowDialog();
                    if (Product.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Product.GetProductId() + "] " + Product.GetProductName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "Customer"://เรียก Dialog ข้อมูลลูกค้า
                    Dialog.frmDialogSearchCustomer Customer;
                    String[] spCustomer = NewTxt.Text.Split(']');
                    if (spCustomer.Length < 2)
                    {
                        Customer = new Dialog.frmDialogSearchCustomer(NewTxt.Text);
                    }
                    else
                    {
                        Customer = new Dialog.frmDialogSearchCustomer(spCustomer[1]);
                    }
                    Customer.ShowDialog();
                    if (Customer.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Customer.GetCustomerId() + "] " + Customer.GetCustomerName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "CustomerInv"://เรียก Dialog ข้อมูลลูกค้าต่างประเทศ
                    SalePosNew.DialogCustomerInv CustomerInv;
                    String[] spCustomerInv = NewTxt.Text.Split(']');
                    if (spCustomerInv.Length < 2)
                    {
                        CustomerInv = new SalePosNew.DialogCustomerInv(NewTxt.Text,2);
                    }
                    else
                    {
                        CustomerInv = new SalePosNew.DialogCustomerInv(spCustomerInv[1],2);
                    }
                    CustomerInv.ShowDialog();
                    if (CustomerInv.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + CustomerInv.GetCustomerId() + "] " + CustomerInv.GetCustomerName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "CustomerTHA"://เรียก Dialog ข้อมูลลูกค้าเฉพาะลูกค้าไทย
                    SalePosNew.DialogCustomerInv CustomerTHA;
                    String[] spCustomerTHA = NewTxt.Text.Split(']');
                    if (spCustomerTHA.Length < 2)
                    {
                        CustomerTHA = new SalePosNew.DialogCustomerInv(NewTxt.Text, 1);
                    }
                    else
                    {
                        CustomerTHA = new SalePosNew.DialogCustomerInv(spCustomerTHA[1], 1);
                    }
                    CustomerTHA.ShowDialog();
                    if (CustomerTHA.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + CustomerTHA.GetCustomerId() + "] " + CustomerTHA.GetCustomerName();
                    }
                    SendKeys.Send("{TAB}");
                    break;

                case "Stock"://เรียก Dialog ข้อมูลคลังสินค้า
                    Dialog.frmDialogSearchStocks Stock;
                    String[] spStock = NewTxt.Text.Split(']');
                    if (spStock.Length < 2)
                    {
                        if (notInList != "")
                        {
                            Stock = new Dialog.frmDialogSearchStocks(NewTxt.Text, notInList,stock);
                        }
                        else 
                        {
                            Stock = new Dialog.frmDialogSearchStocks(NewTxt.Text,stock);
                        }
                    }
                    else
                    {
                        if (notInList != "")
                        {
                            Stock = new Dialog.frmDialogSearchStocks(spStock[1], notInList,stock);
                        }
                        else
                        {
                            Stock = new Dialog.frmDialogSearchStocks(spStock[1],stock);
                        }
                    }
                    Stock.ShowDialog();
                    if (Stock.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Stock.GetStockId() + "] " + Stock.GetStockName();
                        SendKeys.Send("{TAB}");
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "FormuLar"://เรียก Dialog ข้อมูลสูตรผลิต
                    Dialog.frmDialogFormular FormuLar;
                    String[] spFormuLar = NewTxt.Text.Split(']');
                    if (spFormuLar.Length < 2)
                    {
                        FormuLar = new Dialog.frmDialogFormular(NewTxt.Text);
                    }
                    else
                    {
                        FormuLar = new Dialog.frmDialogFormular(spFormuLar[1]);
                    }
                    FormuLar.ShowDialog();
                    if (FormuLar.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + FormuLar.getFormularId() + "]" + FormuLar.getFormularName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "NettingFail"://เรียก Dialog ข้อมูลประเภาสินค้าที่เสีย
                    ProductionNew.frmNettingFail NettingFail;
                    String[] spNettingFail = NewTxt.Text.Split(']');
                    if (spNettingFail.Length < 2)
                    {
                        NettingFail = new ProductionNew.frmNettingFail(NewTxt.Text);
                    }
                    else
                    {
                        NettingFail = new ProductionNew.frmNettingFail(spNettingFail[1]);
                    }
                    NettingFail.ShowDialog();
                    if (NettingFail.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + NettingFail.getCateId() + "]" + NettingFail.getCateName();
                        SendKeys.Send("{TAB}");
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "Material"://เรียก Dialog ข้อมูลวัตถุดิบ
                    Dialog.frmDialogCateNet Material;
                    String[] spMaterial = NewTxt.Text.Split(']');
                    if (spMaterial.Length < 2)
                    {
                        Material = new Dialog.frmDialogCateNet(NewTxt.Text);
                    }
                    else
                    {
                        Material = new Dialog.frmDialogCateNet(spMaterial[1]);
                    }
                    Material.toolStripButton5.Enabled = true;
                    Material.ShowDialog();
                    if (Material.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Material.getMidString() + "]" + Material.getMnameString();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "ACustomer"://เรียก Dialog ข้อมูลคลังสินค้า
                    StockAsiaDrink.DialogSearchCOStock ACustomer;
                    String[] spACustomer = NewTxt.Text.Split(']');
                    if (spACustomer.Length < 2)
                    {
                        ACustomer = new StockAsiaDrink.DialogSearchCOStock(NewTxt.Text);
                    }
                    else
                    {
                        ACustomer = new StockAsiaDrink.DialogSearchCOStock(spACustomer[1]);
                    }
                    ACustomer.ShowDialog();
                    if (ACustomer.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + ACustomer.GetCustomerId() + "] " + ACustomer.GetCustomerName();
                    }
                    SendKeys.Send("{TAB}");
                    break;

                case "BranchReceive"://เรียก Dialog ข้อมูลสาขาที่รับ
                    Dialog.frmDialogSearchBranch br;
                    String[] spBr = NewTxt.Text.Split(']');
                    if (spBr.Length < 2)
                    {
                        br = new Dialog.frmDialogSearchBranch(NewTxt.Text, Class.DBConnString.sDb);
                    }
                    else
                    {
                        br = new Dialog.frmDialogSearchBranch(spBr[1], Class.DBConnString.sDb);
                    }
                    br.ShowDialog();
                    if (br.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + br.GetBranchId() + "] " + br.GetBranchName();
                    }
                    SendKeys.Send("{TAB}");
                    break;

                case "AShipper"://เรียก Dialog ข้อมูลขนส่ง
                    Dialog.frmDialogSearchShipper AShipper;
                    String[] spAShipper = NewTxt.Text.Split(']');
                    if (spAShipper.Length < 2)
                    {
                        AShipper = new Dialog.frmDialogSearchShipper(NewTxt.Text);
                    }
                    else
                    {
                        AShipper = new Dialog.frmDialogSearchShipper(spAShipper[1]);
                    }
                    AShipper.ShowDialog();
                    if (AShipper.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + AShipper.GetShipperId() + "] " + AShipper.GetShipperName();
                    }
                    SendKeys.Send("{TAB}");
                    break;

                case "username"://เรียก Dialog ข้อมูลขนส่ง
                    Requirement .DialogUserName  username;
                    String[] spusername = NewTxt.Text.Split(']');
                    if (spusername.Length < 2)
                    {
                        username = new Requirement.DialogUserName(NewTxt.Text);
                    }
                    else
                    {
                        username = new Requirement.DialogUserName(spusername[1]);
                    }
                    username.ShowDialog();
                    if (username.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + username.GetUserName() + "] " + username.GetName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "usernameAll"://เรียก Dialog ข้อมูลขนส่ง
                    Requirement.DialogUserNameAll usernameAll;
                    String[] spusernameAll = NewTxt.Text.Split(']');
                    if (spusernameAll.Length < 2)
                    {
                        usernameAll = new Requirement.DialogUserNameAll(NewTxt.Text);
                    }
                    else
                    {
                        usernameAll = new Requirement.DialogUserNameAll(spusernameAll[1]);
                    }
                    usernameAll.ShowDialog();
                    if (usernameAll.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + usernameAll.GetUserName() + "] " + usernameAll.GetName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "Req"://เรียก Dialog ข้อมูลขนส่ง
                    Requirement.DialogReq  Req;
                    String[] spReq = NewTxt.Text.Split(']');
                    if (spReq.Length < 2)
                    {
                        Req = new Requirement.DialogReq(NewTxt.Text);
                    }
                    else
                    {
                        Req = new Requirement.DialogReq(spReq[1]);
                    }
                    Req.ShowDialog();
                    if (Req.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Req.GetReqId() + "] " + Req.GetTitle();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                // 7/5/58 test frmSentConsignmentnew
                case "ASid"://เรียก Dialog ข้อมูลใบเบิก
                    Dialog.frmDialogSearchRequis ASid;
                    String[] spASid = NewTxt.Text.Split(']');
                    if (spASid.Length < 2)
                    {
                        ASid = new Dialog.frmDialogSearchRequis(NewTxt.Text);
                    }
                    else
                    {
                        ASid = new Dialog.frmDialogSearchRequis(spASid[1]);
                    }
                    ASid.ShowDialog();
                    if (ASid.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + ASid.GetShipperId() + "] " + ASid.GetShipperName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                // end 7/5/58 test frmSentConsignmentnew
                case "ProductAsiadrink"://เรียก Dialog ข้อมูลรายการสินค้าของสต็อกย่อย 
                    Dialog.frmDialogSearchProductStockAsiadrink ProductAsiadrink;
                    String[] spProductAsiadrink = NewTxt.Text.Split(']');
                    if (spProductAsiadrink.Length < 2)
                    {
                        ProductAsiadrink = new Dialog.frmDialogSearchProductStockAsiadrink(NewTxt.Text);
                    }
                    else
                    {
                        ProductAsiadrink = new Dialog.frmDialogSearchProductStockAsiadrink(spProductAsiadrink[1]);
                    }
                    ProductAsiadrink.ShowDialog();
                    if (ProductAsiadrink.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + ProductAsiadrink.GetProductId() + "] " + ProductAsiadrink.GetProductName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "TRCustomer"://เรียก Dialog ข้อมูลลูกค้า
                    Transf.DialogSearchTRCustomer TRCustomer;
                    String[] SRCustomer = NewTxt.Text.Split(']');
                    if (SRCustomer.Length < 2)
                    {
                        TRCustomer = new Transf.DialogSearchTRCustomer(NewTxt.Text);
                    }
                    else
                    {
                        TRCustomer = new Transf.DialogSearchTRCustomer(SRCustomer[1]);
                    }
                    TRCustomer.ShowDialog();
                    if (TRCustomer.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + TRCustomer.GetCustomerId() + "] " + TRCustomer.GetCustomerName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                // end 7/5/58 test frmSentConsignmentnew
                case "testfunction"://เรียก Dialog ข้อมูลสาขา
                    StockAsiaDrink.DialogSearchBranch ProductAsiadrink1;
                    String[] spProductAsiadrink1 = NewTxt.Text.Split(']');
                    if (spProductAsiadrink1.Length < 2)
                    {
                        ProductAsiadrink1 = new StockAsiaDrink.DialogSearchBranch(NewTxt.Text);
                    }
                    else
                    {
                        ProductAsiadrink1 = new StockAsiaDrink.DialogSearchBranch(spProductAsiadrink1[1]);
                    }
                    ProductAsiadrink1.ShowDialog();
                    if (ProductAsiadrink1.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + ProductAsiadrink1.GetProductId() + "] " + ProductAsiadrink1.GetProductName();
                    }
                    SendKeys.Send("{TAB}");
                    break;

                case "TRCustomer2"://เรียก Dialog ข้อมูลธนาคาร
                    StockAsiaDrink.DialogSearchBank TRCustomer2;
                    String[] SRCustomer2 = NewTxt.Text.Split(']');
                    if (SRCustomer2.Length < 2)
                    {
                        TRCustomer2 = new StockAsiaDrink.DialogSearchBank(NewTxt.Text);
                    }
                    else
                    {
                        TRCustomer2 = new StockAsiaDrink.DialogSearchBank(SRCustomer2[1]);
                    }
                    TRCustomer2.ShowDialog();
                    if (TRCustomer2.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + TRCustomer2.GetCustomerId() + "] " + TRCustomer2.GetCustomerName();
                        //NewTxt.Text = TRCustomer2.GetCustomerId();
                    }
                    SendKeys.Send("{TAB}");
                    break;

                case "DialogDeposit"://เรียก Dialog ข้อมูลมัดจำ
                    SalePosNew.DialogDeposit DialogDeposit;
                    //String[] SRDialogDeposit = NewTxt.Text.Split(']');
                    String SRDialogDeposit = NewTxt.Text;
                    DialogDeposit = new SalePosNew.DialogDeposit(SRDialogDeposit, notInList);
                    DialogDeposit.ShowDialog();
                    if (DialogDeposit.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = DialogDeposit.GetCustomerId();
                    }
                    SendKeys.Send("{TAB}");
                    break;

                case "ProductCallToReport"://เรียก Dialog ข้อมูลสินค้าในคลังสินค้าย่อย
                    StockAsiaDrink.DialogSearchProductReport ProductCallToReport;
                    String[] SRProductCallToReport = NewTxt.Text.Split(']');
                    if (SRProductCallToReport.Length < 2)
                    {
                        ProductCallToReport = new StockAsiaDrink.DialogSearchProductReport(NewTxt.Text);
                    }
                    else
                    {
                        ProductCallToReport = new StockAsiaDrink.DialogSearchProductReport(SRProductCallToReport[1]);
                    }
                    ProductCallToReport.ShowDialog();
                    if (ProductCallToReport.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + ProductCallToReport.GetCustomerId() + "] " + ProductCallToReport.GetCustomerName();
                        //NewTxt.Text = TRCustomer2.GetCustomerId();
                    }
                    SendKeys.Send("{TAB}");
                    break;

                case "DialogSaleVat"://เรียก Dialog ข้อมูลการขาย
                    SalePosNew.DialogSaleVat DialogSaleVat;
                    String[] spDialogSaleVat = NewTxt.Text.Split(' ');
                    if (spDialogSaleVat.Length < 2)
                    {
                        DialogSaleVat = new SalePosNew.DialogSaleVat(NewTxt.Text);
                    }
                    else
                    {
                        DialogSaleVat = new SalePosNew.DialogSaleVat(spDialogSaleVat[1]);
                    }
                    DialogSaleVat.ShowDialog();
                    if (DialogSaleVat.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "" + DialogSaleVat.GetCustomerId() + "";
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "Employee"://เรียก Dialog ข้อมูลรายการพนักงาน
                    Dialog.frmDialogSearchEmployee Employee;
                    String[] spEmployee = NewTxt.Text.Split(']');
                    if (spEmployee.Length < 2)
                    {
                        Employee = new Dialog.frmDialogSearchEmployee(NewTxt.Text);
                    }
                    else
                    {
                        Employee = new Dialog.frmDialogSearchEmployee(spEmployee[1]);
                    }
                    Employee.ShowDialog();
                    if (Employee.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Employee.GetEmployeeId() + "] " + Employee.GetEmployeeName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "Week"://เรียก Dialog ข้อมูลสัปดาห์
                    DataAnalysis.DialogWeek DialogWeek;
                    String SDialogWeek = NewTxt.Text;
                    DialogWeek = new DataAnalysis.DialogWeek(NewTxt.Text);
                    DialogWeek.StartPosition = FormStartPosition.CenterScreen;
                    DialogWeek.ShowDialog();
                    if (DialogWeek.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = DialogWeek.GetData();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "productTranfer"://เรียก Dialog ข้อมูลรายการแจ้งโอนเงินเรือนจำ
                    Dialog.DialogProductTranfer productTranfer;
                    String[] SProductTranfer = NewTxt.Text.Split(']');
                    if (SProductTranfer.Length < 2)
                    {
                        productTranfer = new Dialog.DialogProductTranfer(NewTxt.Text);
                    }
                    else
                    {
                        productTranfer = new Dialog.DialogProductTranfer(SProductTranfer[1]);
                    }
                    productTranfer.ShowDialog();
                    if (productTranfer.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text ="[" + productTranfer.returnVal() + "]";
                    }
                    SendKeys.Send("{TAB}");
                    break;
                //case "ProductCustomer":
                //    SalePosNew.DialogProductCustomer ProductCustomer;
                //    String[] spProductCustomer = NewTxt.Text.Split(' ');
                //    if (spProductCustomer.Length < 2)
                //    {
                //        ProductCustomer = new SalePosNew.DialogProductCustomer(NewTxt.Text);
                //    }
                //    else
                //    {
                //        ProductCustomer = new SalePosNew.DialogProductCustomer(spProductCustomer[1]);
                //    }
                //    ProductCustomer.ShowDialog();
                //    if (ProductCustomer.DialogResult == DialogResult.OK)
                //    {
                //        NewTxt.Text = "" + ProductCustomer.GetCustomerId() + "";
                //    }
                //    SendKeys.Send("{TAB}");
                //    break;
/*
                case "Shipping":
                    Dialog.DialogSearchShipping BillSale;
                    String[] spBillSale = NewTxt.Text.Split(']');
                    if (spBillSale.Length < 2)
                    {
                        BillSale = new Dialog.DialogSearchShipping(NewTxt.Text);
                    }
                    else
                    {
                        BillSale = new Dialog.DialogSearchShipping(spBillSale[1]);
                    }
                    BillSale.ShowDialog();
                    if (BillSale.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = BillSale.GetBillSaleId();

                    }
                    SendKeys.Send("{TAB}");
                    break;
  */              
            }
        }
Ejemplo n.º 2
0
        private void btn_Click(object sender, EventArgs e)
        {
            //if ()
            //{
                
            //}
            switch (NewFrm)
            {
                //case "ProductCallToReport":
                //    StockAsiaDrink.DialogSearchProductReport ProductCallToReport;
                //    String[] spProductCallToReport = NewTxt.Text.Split(']');
                //    if (spProductCallToReport.Length < 2)
                //    {
                //        ProductCallToReport = new StockAsiaDrink.DialogSearchProductReport(NewTxt.Text);
                //    }
                //    else
                //    {
                //        ProductCallToReport = new StockAsiaDrink.DialogSearchProductReport(spProductCallToReport[1]);
                //    }
                //    ProductCallToReport.ShowDialog();
                //    if (ProductCallToReport.DialogResult == DialogResult.OK)
                //    {
                //        NewTxt.Text = "[" + ProductCallToReport.GetCustomerId() + "] " + ProductCallToReport.GetCustomerName();
                //    }
                //    SendKeys.Send("{TAB}");
                //    break;

                case "Supplier"://เรียก Dialog ข้อมูลผู้ขาย
                    Dialog.frmDialogSearchSupplier Supplier;
                    String[] spSupplier = NewTxt.Text.Split(']');
                    if (spSupplier.Length < 2)
                    {
                        Supplier = new Dialog.frmDialogSearchSupplier(NewTxt.Text);
                    }
                    else
                    {
                        Supplier = new Dialog.frmDialogSearchSupplier(spSupplier[1]);
                    }
                    Supplier.ShowDialog();
                    if (Supplier.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Supplier.GetSuplierId() + "] " + Supplier.GetSuplierName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "Branch"://เรียก Dialog ข้อมูลสาขา
                    Dialog.frmDialogSearchBranch Branch;
                    String[] spBranch = NewTxt.Text.Split(']');
                    if (spBranch.Length < 2)
                    {
                        Branch = new Dialog.frmDialogSearchBranch(NewTxt.Text);
                    }
                    else
                    {
                        Branch = new Dialog.frmDialogSearchBranch(spBranch[1]);
                    }
                    Branch.ShowDialog();
                    if (Branch.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Branch.GetBranchId() + "] " + Branch.GetBranchName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "Shipper"://เรียก Dialog ข้อมูลขนส่ง
                    Dialog.frmDialogSearchShipper Shipper;
                    String[] spShipper = NewTxt.Text.Split(']');
                    if (spShipper.Length < 2)
                    {
                        Shipper = new Dialog.frmDialogSearchShipper(NewTxt.Text);
                    }
                    else
                    {
                        Shipper = new Dialog.frmDialogSearchShipper(spShipper[1]);
                    }
                    Shipper.ShowDialog();
                    if (Shipper.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Shipper.GetShipperId() + "] " + Shipper.GetShipperName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "Employer"://เรียก Dialog ข้อมูลเรือนจำ
                    Dialog.frmDialogSearchEmployer Employer;
                    String[] spEmployer = NewTxt.Text.Split(']');
                    if (spEmployer.Length < 2)
                    {
                        Employer = new Dialog.frmDialogSearchEmployer(NewTxt.Text);
                    }
                    else
                    {
                        Employer = new Dialog.frmDialogSearchEmployer(spEmployer[1]);
                    }
                    Employer.ShowDialog();
                    if (Employer.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Employer.GetEmployerId() + "] " + Employer.GetEmployerName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "CardFormula"://เรียก Dialog ข้อมูลเรือนจำ
                    ProductionNew.DialogSelectFormula SelectFormula;
                    String[] spSelectFormula = NewTxt.Text.Split(']');
                    if (spSelectFormula.Length < 2)
                    {
                        SelectFormula = new ProductionNew.DialogSelectFormula(NewTxt.Text);
                    }
                    else
                    {
                        SelectFormula = new ProductionNew.DialogSelectFormula(spSelectFormula[1]);
                    }
                    SelectFormula.ShowDialog();
                    if (SelectFormula.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + SelectFormula.GetFmId() + "] " + SelectFormula.GetFmName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "Product"://เรียก Dialog ข้อมูลรายการสินค้า
                    Dialog.frmDialogSearchProduct Product;
                    String[] spProduct = NewTxt.Text.Split(']');
                    if (spProduct.Length < 2)
                    {
                        Product = new Dialog.frmDialogSearchProduct(NewTxt.Text);
                    }
                    else
                    {
                        Product = new Dialog.frmDialogSearchProduct(spProduct[1]);
                    }
                    Product.ShowDialog();
                    if (Product.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Product.GetProductId() + "] " + Product.GetProductName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                case "Customer"://เรียก Dialog ข้อมูลลูกค้า
                    Dialog.frmDialogSearchCustomer Customer;
                    String[] spCustomer = NewTxt.Text.Split(']');
                    if (spCustomer.Length < 2)
                    {
                        Customer = new Dialog.frmDialogSearchCustomer(NewTxt.Text);
                    }
                    else
                    {
                        Customer = new Dialog.frmDialogSearchCustomer(spCustomer[1]);
                    }
                    Customer.ShowDialog();
                    if (Customer.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + Customer.GetCustomerId() + "] " + Customer.GetCustomerName();
                    }
                    SendKeys.Send("{TAB}");
                    break;

                case "ACustomer"://เรียก Dialog ข้อมูลลูกค้า
                    Dialog.frmDialogSearchCustomer ACustomer;
                    String[] spACustomer = NewTxt.Text.Split(']');
                    if (spACustomer.Length < 2)
                    {
                        ACustomer = new Dialog.frmDialogSearchCustomer(NewTxt.Text);
                    }
                    else
                    {
                        ACustomer = new Dialog.frmDialogSearchCustomer(spACustomer[1]);
                    }
                    ACustomer.ShowDialog();
                    if (ACustomer.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + ACustomer.GetCustomerId() + "] " + ACustomer.GetCustomerName();
                    }
                    SendKeys.Send("{TAB}");
                    break;

                case "BranchReceive"://เรียก Dialog ข้อมูลสาขารับ
                    Dialog.frmDialogSearchBranch br;
                    String[] spBr = NewTxt.Text.Split(']');
                    if (spBr.Length < 2)
                    {
                        br = new Dialog.frmDialogSearchBranch(NewTxt.Text, Class.DBConnString.sDb);
                    }
                    else
                    {
                        br = new Dialog.frmDialogSearchBranch(spBr[1], Class.DBConnString.sDb);
                    }
                    br.ShowDialog();
                    if (br.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + br.GetBranchId() + "] " + br.GetBranchName();
                    }
                    SendKeys.Send("{TAB}");
                    break;

                case "AShipper"://เรียก Dialog ข้อมูลขนส่ง
                    Dialog.frmDialogSearchShipper AShipper;
                    String[] spAShipper = NewTxt.Text.Split(']');
                    if (spAShipper.Length < 2)
                    {
                        AShipper = new Dialog.frmDialogSearchShipper(NewTxt.Text);
                    }
                    else
                    {
                        AShipper = new Dialog.frmDialogSearchShipper(spAShipper[1]);
                    }
                    AShipper.ShowDialog();
                    if (AShipper.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + AShipper.GetShipperId() + "] " + AShipper.GetShipperName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                // 7/5/58 test frmSentConsignmentnew
                case "ASid"://เรียก Dialog ข้อมูลใบเบิก
                    Dialog.frmDialogSearchRequis ASid;
                    String[] spASid = NewTxt.Text.Split(']');
                    if (spASid.Length < 2)
                    {
                        ASid = new Dialog.frmDialogSearchRequis(NewTxt.Text);
                    }
                    else
                    {
                        ASid = new Dialog.frmDialogSearchRequis(spASid[1]);
                    }
                    ASid.ShowDialog();
                    if (ASid.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + ASid.GetShipperId() + "] " + ASid.GetShipperName();
                    }
                    SendKeys.Send("{TAB}");
                    break;
                // end 7/5/58 test frmSentConsignmentnew 
                case "ProductAsiadrink"://เรียก Dialog ข้อมูลรายการสินค้าในคลังย่อย
                    Dialog.frmDialogSearchProductStockAsiadrink ProductAsiadrink;
                    String[] spProductAsiadrink = NewTxt.Text.Split(']');
                    if (spProductAsiadrink.Length < 2)
                    {
                        ProductAsiadrink = new Dialog.frmDialogSearchProductStockAsiadrink(NewTxt.Text);
                    }
                    else
                    {
                        ProductAsiadrink = new Dialog.frmDialogSearchProductStockAsiadrink(spProductAsiadrink[1]);
                    }
                    ProductAsiadrink.ShowDialog();
                    if (ProductAsiadrink.DialogResult == DialogResult.OK)
                    {
                        NewTxt.Text = "[" + ProductAsiadrink.GetProductId() + "] " + ProductAsiadrink.GetProductName();
                    }
                    SendKeys.Send("{TAB}");
                    break;

            }
        }