public void ShowLookupForm()
        {
            FrmLookup_LookupHide(null, null);

            frmLookup = new LookupForm();

            switch (lookupColName)
            {
            case QUOTATIONITEMS.PRODUCT_ID:
            {
                frmLookup.LookupColNames      = new string[] { PRODUCT.PRODUCT_NAME };
                frmLookup.SelectedPkValue     = editgrid[QUOTATIONITEMS.PRODUCT_ID, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                if (txt_party_id.Text != "")
                {
                    frmLookup.LookupList = CProduct_exten.GetforLookup(new DAL());
                    frmLookup.LoadLookupList();
                }
            }
            break;

            case QUOTATIONITEMS.SIZES_ID:

                frmLookup.LookupColNames      = new string[] { SIZES.SIZES_NAME };
                frmLookup.SelectedPkValue     = editgrid[QUOTATIONITEMS.SIZES_ID, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;
                frmLookup.LookupList          = CSizes_exten.GetforLookup(new DAL());
                frmLookup.LoadLookupList();

                break;

            default:
                throw new Exception("'" + lookupColName + "' Not Found");
            }
            frmLookup.LookupSelected += new EventHandler(FrmLookup_LookupSelected);
            frmLookup.AfterSelection += new EventHandler(FrmLookup_AfterSelection);
            frmLookup.LookupHide     += new EventHandler(FrmLookup_LookupHide);
            frmLookup.NewEntryNeeded += new LookupForm.NewEntryHandler(FrmLookup_NewEntryNeeded);
            frmLookup.Owner           = this.FindForm();
            //////////
            frmLookup.Show();
            //////////
            int vWidth     = frmLookup.GetAutoWidth();
            int vCellWidth = editgrid.Columns[lookupColName].Width;

            if (vWidth < vCellWidth)
            {
                vWidth = vCellWidth;
            }
            frmLookup.AutoFillLastColumn();

            int vHeight = frmLookup.GetAutoHeight();

            Rectangle screenRect = Global.GetScreenRect(editgrid);

            frmLookup.Bounds = Global.GetSnapRect(screenRect, vWidth, vHeight);
        }
Exemple #2
0
        public void ShowLookupForm()
        {
            FrmLookup_LookupHide(null, null);

            frmLookup = new LookupForm();

            switch (lookupColName)
            {
            //case INVOICEITEMS.PO_ID:
            //    {
            //        //if (Customise.Invoice_poid_dcid == true)
            //        //{

            //        //    frmLookup.LookupColNames = new string[] { PO.PO_NO, DC.DC_NO, DCITEMS.PRODUCT_ID, DCITEMS.QTY, DCITEMS.REFERED_QTY, POITEMS.PRICE };
            //        //    frmLookup.SelectedPkValue = editgrid[INVOICEITEMS.PO_ID, lookupRow].Value;
            //        //    frmLookup.AllowNewEntry = true;
            //        //    frmLookup.AllowEmptySelection = true;
            //        //    //
            //        //    if (txt_party_id.Text != "")
            //        //    {
            //        //        frmLookup.LookupList = CPo_lookup.LookupbyPono(txt_party_id.Text);

            //        //        //frmLookup.LookupList = CPo_lookup.LookupPObyPartyforInvoice(CParty_exten.GetId_Name(txt_party_id.Text));
            //        //        frmLookup.LoadLookupList();
            //        //    }
            //        //    //
            //        //}
            //    }
            //    break;
            //
            //case INVOICEITEMS.DC_ID:
            //    {
            //        if (Customise.Invoice_poid_dcid == true)
            //        {

            //            //frmLookup.LookupColNames = new string[] { DC.DC_NO, DCITEMS.PRODUCT_ID, DCITEMS.QTY, DCITEMS.REFERED_QTY, POITEMS.PRICE };
            //            //frmLookup.SelectedPkValue = editgrid[INVOICEITEMS.DC_ID, lookupRow].Value;
            //            //frmLookup.AllowNewEntry = true;
            //            //frmLookup.AllowEmptySelection = true;
            //            ////
            //            //if (txt_party_id.Text != "")
            //            //{
            //            //    if (editgrid[DCITEMS.PO_ID, lookupRow].Value != null)
            //            //    {
            //            //        if (editgrid[DCITEMS.PO_ID, lookupRow].Value.ToString() != "")
            //            //        {
            //            //            if (editgrid[DCITEMS.PO_ID, lookupRow].Value.ToString() != Core.Without_Po)
            //            //            { }
            //            //            else
            //            //            {
            //            //                frmLookup.LookupList = CDc_Lookup.LookupDC_Party_forInvoice(CParty_exten.GetId_Name(txt_party_id.Text));
            //            //                frmLookup.LoadLookupList();
            //            //            }
            //            //        }
            //            //        else
            //            //        {
            //            //            frmLookup.LookupList = CDc_Lookup.LookupDC_Party_forInvoice(CParty_exten.GetId_Name(txt_party_id.Text));
            //            //            frmLookup.LoadLookupList();
            //            //        }
            //            //    }
            //            //    else
            //            //    {
            //            //        frmLookup.LookupList = CDc_Lookup.LookupDC_Party_forInvoice(CParty_exten.GetId_Name(txt_party_id.Text));
            //            //        frmLookup.LoadLookupList();
            //            //    }
            //            //}
            //            //
            //        }
            //    }
            //    break;

            case INVOICEITEMS.PRODUCT_ID:
            {
                frmLookup.LookupColNames      = new string[] { PRODUCT.PRODUCT_NAME };
                frmLookup.SelectedPkValue     = editgrid[INVOICEITEMS.PRODUCT_ID, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;

                if (txt_party_id.Text != "")
                {
                    //if (Customise.Invoice_poid_dcid == true)
                    //{

                    //if (editgrid[DCITEMS.PO_ID, lookupRow].Value != null)
                    //{
                    //    if (editgrid[DCITEMS.DC_ID, lookupRow].Value != null)
                    //    {

                    //        if (editgrid[DCITEMS.PO_ID, lookupRow].Value.ToString() == Core.Without_Po)
                    //        {
                    //            if (editgrid[DCITEMS.DC_ID, lookupRow].Value.ToString() == Core.Without_Dc)
                    //            {
                    //                frmLookup.LookupList = CProduct_exten.GetforLookup(new DAL());
                    //                frmLookup.LoadLookupList();
                    //            }
                    //        }
                    //    }
                    //    else
                    //    {
                    //        frmLookup.LookupList = CProduct_exten.GetforLookup(new DAL());
                    //        frmLookup.LoadLookupList();
                    //    }
                    //}
                    //else
                    //{

                    //    frmLookup.LookupList = CProduct_exten.GetforLookup(new DAL());
                    //    frmLookup.LoadLookupList();
                    //    //}
                    //}

                    //if ((Customise.Invoice_pono_dcno == true) || (Customise.Invoice_Without_podc == true))
                    //{
                    frmLookup.LookupList = CProduct_exten.GetforLookup(new DAL());
                    frmLookup.LoadLookupList();
                    //}
                }
            }
            break;

            case INVOICEITEMS.SIZES_ID:

                frmLookup.LookupColNames      = new string[] { SIZES.SIZES_NAME };
                frmLookup.SelectedPkValue     = editgrid[INVOICEITEMS.SIZES_ID, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;
                frmLookup.LookupList          = CSizes_exten.GetforLookup(new DAL());
                frmLookup.LoadLookupList();

                break;

            case INVOICEITEMS.COLOURS_ID:

                frmLookup.LookupColNames      = new string[] { COLOURS.COLOURS_NAME };
                frmLookup.SelectedPkValue     = editgrid[INVOICEITEMS.COLOURS_ID, lookupRow].Value;
                frmLookup.AllowNewEntry       = true;
                frmLookup.AllowEmptySelection = true;
                frmLookup.LookupList          = CColours_exten.GetforLookup();
                frmLookup.LoadLookupList();

                break;


            default:
                throw new Exception("'" + lookupColName + "' Not Found");
            }
            frmLookup.LookupSelected += new EventHandler(FrmLookup_LookupSelected);
            frmLookup.AfterSelection += new EventHandler(FrmLookup_AfterSelection);
            frmLookup.LookupHide     += new EventHandler(FrmLookup_LookupHide);
            frmLookup.NewEntryNeeded += new LookupForm.NewEntryHandler(FrmLookup_NewEntryNeeded);
            frmLookup.Owner           = this.FindForm();
            //////////
            frmLookup.Show();
            //////////
            int vWidth     = frmLookup.GetAutoWidth();
            int vCellWidth = editgrid.Columns[lookupColName].Width;

            if (vWidth < vCellWidth)
            {
                vWidth = vCellWidth;
            }
            frmLookup.AutoFillLastColumn();

            int vHeight = frmLookup.GetAutoHeight();

            Rectangle screenRect = Global.GetScreenRect(editgrid);

            frmLookup.Bounds = Global.GetSnapRect(screenRect, vWidth, vHeight);
        }
Exemple #3
0
 void Txt_sizes_LookupUpdate(object sender, EventArgs e)
 {
     txt_sizes_id.LookupList = CSizes_exten.GetforLookup(new DAL());
 }