Ejemplo n.º 1
0
        void txtMa_Dt_Tu_Validating(object sender, CancelEventArgs e)
        {
            string strValue = txtMa_Dt_Tu.Text.Trim();
            bool   bRequire = false;

            frmDoiTuong frmLookup = new frmDoiTuong();
            DataRow     drLookup  = Lookup.ShowLookup(frmLookup, "LIDOITUONG", "Ma_Dt", strValue, bRequire, "", "");

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

            if (drLookup == null)
            {
                lbtMa_Dt_Tu.Text = string.Empty;
            }
            else
            {
                txtMa_Dt_Tu.Text = ((string)drLookup["Ma_Dt"]).Trim();
                lbtMa_Dt_Tu.Text = ((string)drLookup["Ten_Dt"]).Trim();
            }

            dicName.SetValue(lbtMa_Dt_Tu.Name, lbtMa_Dt_Tu.Text);
        }
Ejemplo n.º 2
0
        public override void EnterProcess()
        {
            if (bdsDoiTuongNh.Position < 0)
            {
                return;
            }

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

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

                    //Hien thi lookup danh muc doi tuong
                    frmDoiTuong frm = new frmDoiTuong();
                    frm.bLastLookupProcess = true;
                    frm.MdiParent          = this.MdiParent;
                    frm.strMa_Nh_Dt        = ((string)(drCurrent["Ma_Nh_Dt"])).Trim();

                    Lookup.ShowLookup(frm, "LIDOITUONG", "Ma_Dt", strValue, bRequire, strKeyFilter);

                    if (!frm.bIsEnter)
                    {
                        return;
                    }

                    this.drLookup = frm.drLookup;
                    this.Close();
                }
            }
            else
            {
                //Hien thi danh muc doi tuong binh thuong khi nhan Enter
                drCurrent = ((DataRowView)bdsDoiTuongNh.Current).Row;
                if ((Boolean)(drCurrent["Nh_Cuoi"]) == true)
                {
                    frmDoiTuong frmEdit = new frmDoiTuong();

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

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