Exemplo n.º 1
0
        private VnsMaLoaiKhoan GetObjectFromControl()
        {
            VnsMaLoaiKhoan _tmp = new VnsMaLoaiKhoan();

            _tmp.MaChuong = txtMaChuong.Text;
            _tmp.Ma       = txtMa.Text;
            _tmp.Ten      = txtTenLoaiKhoan.Text;
            VnsMaLoaiKhoan cha = new VnsMaLoaiKhoan();

            cha = (VnsMaLoaiKhoan)ComboHelper.GetSelectData(grlDmLoaiKhoan);
            if (cha == null)
            {
                _tmp.IdCha = new Guid();
                _tmp.MaCha = "";
            }
            else
            {
                _tmp.IdCha = cha.Id;
                _tmp.MaCha = cha.Ma;
            }

            _tmp.MaHang  = txtMaHang.Text;
            _tmp.MoTa    = txtMoTa.Text;
            _tmp.ChiTiet = VnsCheck.IsNullGuid(grlDmLoaiKhoan.EditValue) ? 0 : 1;
            return(_tmp);
        }
Exemplo n.º 2
0
        private void ReloadData(FormUpdate status, VnsMaLoaiKhoan tmp)
        {
            switch (status)
            {
            case FormUpdate.Insert:
                lstDanhMuc.Add(tmp);
                if (tmp.ChiTiet == 0)
                {
                    lstBind.Add(tmp);
                }
                break;

            case FormUpdate.Update:
                SelectObject = tmp;
                break;

            case FormUpdate.Delete:
                lstDanhMuc.Remove(SelectObject);
                break;
            }


            gctDonVi.DataSource = lstDanhMuc;
            gctDonVi.RefreshDataSource();

            grlDmLoaiKhoan.Refresh();
        }
Exemplo n.º 3
0
 private void SetObjectToControl(VnsMaLoaiKhoan objDonvi)
 {
     this.txtMa.EditValue           = objDonvi.Ma;
     this.txtTenLoaiKhoan.EditValue = objDonvi.Ten;
     this.txtMaChuong.EditValue     = objDonvi.MaChuong;
     this.grlDmLoaiKhoan.EditValue  = objDonvi.IdCha;
     this.txtMaHang.EditValue       = objDonvi.MaHang;
     this.txtMoTa.EditValue         = objDonvi.MoTa;
 }
Exemplo n.º 4
0
        private void gvDonVi_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            if (gvDonVi.FocusedRowHandle < 0)
            {
                return;
            }
            SelectObject = (VnsMaLoaiKhoan)gvDonVi.GetRow(gvDonVi.FocusedRowHandle);

            if (SelectObject == null)
            {
                return;
            }

            FormStatus = FormUpdate.Update;
            SetObjectToControl(SelectObject);
        }
Exemplo n.º 5
0
        private void SaveData()
        {
            VnsMaLoaiKhoan tmp = new VnsMaLoaiKhoan();

            tmp = GetObjectFromControl();

            switch (FormStatus)
            {
            case FormUpdate.Insert:
                VnsMaLoaiKhoanService.Save(tmp);
                break;

            case FormUpdate.Update:
                tmp.Id = SelectObject.Id;
                VnsMaLoaiKhoanService.SaveOrUpdate(tmp);
                break;
            }

            ReloadData(FormStatus, tmp);
        }