private void ThemKhachAo()
        {
            DanhBaKhachAo objKhachAo = new DanhBaKhachAo(string.Empty, string.Empty, string.Empty);
            frmKhachAo    frm        = new frmKhachAo(objKhachAo, true);// them moi

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                objKhachAo = frm.GetKhachAo();
                //Insert DataBase
                if (StringTools.TrimSpace(objKhachAo.Name).Length <= 0)
                {
                    return;
                }

                if (StringTools.TrimSpace(objKhachAo.Address).Length <= 0)
                {
                    return;
                }

                if (StringTools.TrimSpace(objKhachAo.PhoneNumber).Length < 8)
                {
                    return;
                }
                if (!objKhachAo.Insert())
                {
                    new MessageBox.MessageBoxBA().Show("Lỗi thêm mới khách ảo");
                    return;
                }
                else
                {
                    //Load lai grid
                    LoadListKhachAo();
                }
            }
        }
Example #2
0
        private void ThemKhachAo()
        {
            try
            {
                DanhBaKhachAo objKhachAo = new DanhBaKhachAo(string.Empty, string.Empty, string.Empty);
                frmKhachAo    frm        = new frmKhachAo(objKhachAo, true);// them moi
                frm.ShowDialog(this);
                if (frm.IsSuccess)
                {
                    objKhachAo = frm.GetKhachAo();
                    if (StringTools.TrimSpace(objKhachAo.Name).Length <= 0)
                    {
                        return;
                    }

                    if (StringTools.TrimSpace(objKhachAo.Address).Length <= 0)
                    {
                        return;
                    }

                    if (StringTools.TrimSpace(objKhachAo.PhoneNumber).Length < 8)
                    {
                        return;
                    }
                    if (!objKhachAo.Insert())
                    {
                        new MessageBox.MessageBoxBA().Show("Lỗi thêm mới khách ảo");
                    }
                    else
                    {
                        LoadListKhachAo();
                    }
                }
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("ThemKhachAo: ", ex);
            }
        }