Exemple #1
0
        void txtMa_CCDC_Validating(object sender, CancelEventArgs e)
        {
            string strValue = txtMa_CCDC.Text.Trim();
            bool   bRequire = true;

            frmCtCCDC frmLookup = new frmCtCCDC();
            DataRow   drLookup  = Lookup.ShowLookup(frmLookup, "ASCCDC", "Ma_CCDC", strValue, bRequire, "");

            if (bRequire && drLookup == null)
            {
                e.Cancel = true;
            }

            if (drLookup == null)
            {
                lbtTen_CCDC.Text = string.Empty;
                lbtTen_CCDC.Text = string.Empty;
            }
            else
            {
                txtMa_CCDC.Text  = ((string)drLookup["Ma_CCDC"]).Trim();
                lbtTen_CCDC.Text = ((string)drLookup["Ten_CCDC"]).Trim();
            }

            dicName.SetValue(lbtTen_CCDC.Name, lbtTen_CCDC.Text);

            if ((((txtTextLookup)sender).AutoFilter != null) && ((txtTextLookup)sender).AutoFilter.Visible)
            {
                ((txtTextLookup)sender).AutoFilter.Visible = false;
                this.SelectNextControl(this.ActiveControl, true, true, true, true);
            }
        }
Exemple #2
0
        public override void  EnterProcess()
        {
            if (bdsDmNhCCDC.Position < 0)
            {
                return;
            }

            if (isLookup && EnterValid())
            {
                if (bEnterFinish)
                {
                    this.drLookup = ((DataRowView)bdsDmNhCCDC.Current).Row;
                    this.Close();
                }
                else
                {
                    drCurrent = ((DataRowView)bdsDmNhCCDC.Current).Row;

                    string strValue     = this.strLookupValue;
                    bool   bRequire     = this.bLookupRequire;
                    string strKeyFilter = "Ma_Nh_Ts ='" + ((string)(drCurrent["Ma_Nh_Ts"])).Trim() + "'";

                    //Hien thi lookup danh muc doi tuong
                    frmCtCCDC frm = new frmCtCCDC();
                    frm.bLastLookupProcess = true;
                    frm.MdiParent          = this.MdiParent;

                    Lookup.ShowLookup(frm, "ASCCDC", "Ma_CCDC", strValue, bRequire, strKeyFilter);

                    if (!frm.bIsEnter)
                    {
                        return;
                    }

                    this.drLookup = frm.drLookup;
                    this.Close();
                }
            }
            else
            {
                //Hien thi danh muc CCDC binh thuong khi nhan Enter
                drCurrent = ((DataRowView)bdsDmNhCCDC.Current).Row;
                if ((string)(drCurrent["Nh_Cuoi"]) == "1")
                {
                    frmCtCCDC frmEdit = new frmCtCCDC();

                    frmEdit.MdiParent = this.MdiParent;
                    frmEdit.Load(((string)(drCurrent["Ma_Nh_Ts"])).Trim());

                    frmEdit.Show();
                    Common.AddFormOnCurentTab(frmEdit);
                }
            }
        }