Esempio n. 1
0
        private void frmEditCustomer_Load(object sender, EventArgs e)
        {
            using (IUnitOfWork uow = new UnitOfWork())
            {
                _objEditCompany = uow.CompanyRepository.Find(_objEditCompany.CompanyId);
                uow.Commit();
            }
            cbSex.SelectedIndex = 0;

            txtCompanyCode.Text            = _objEditCompany.CompanyCode;
            txtCompanyName.Text            = _objEditCompany.CompanyName;
            txtTaxCode.Text                = _objEditCompany.Taxcode;
            txtAddree.Text                 = _objEditCompany.Address;
            txtSwich.Text                  = _objEditCompany.SwiftCode;
            txtNoBrach.Text                = (_objEditCompany.Branch != 0) ? _objEditCompany.Branch.ToString() : string.Empty;
            txtStaft.Text                  = (_objEditCompany.NumberOfEmployee != null) ? _objEditCompany.Branch.ToString() : string.Empty;
            txtWebsite.Text                = _objEditCompany.Website;
            txtNote.Text                   = _objEditCompany.Note;
            txtTargertValue.Text           = (_objEditCompany.TagetValue != 0) ? _objEditCompany.TagetValue.ToString() : string.Empty;
            cbClassCustormer.SelectedValue = _objEditCompany.ClassId;
            PictureUtility.BindImage(PictureSgnature, _objEditCompany.Photo);
            PictureUtility.BindImage(PictureLogo, _objEditCompany.PictureLogo);
            txtAccount.Text = _objEditCompany.Accountant;
            txtAccount.Text = _objEditCompany.AccountantPhone;
            using (IUnitOfWork uow = new UnitOfWork())
            {
                _objMain = uow.DeputyRepository.FindMainDeputy(_objEditCompany.CompanyId);
            }
            Users  user    = UtilityFunction.GetUser(_objMain);
            string account = user != null ? user.UserName : "";

            using (IUnitOfWork uow = new UnitOfWork())
            {
                userEdit = uow.UsersRepository.IsExist(account);
            }
            if (_objMain == null)
            {
                return;
            }
            txtNameContact.Text = _objMain.DeputyName;
            txtEmail.Text       = _objMain.Email;
            txtPhone.Text       = _objMain.Phone;
            cbSex.SelectedIndex = _objMain.Sex ? 0 : 1;
            if (userEdit == null)
            {
                return;
            }
            txtAccount.Text = userEdit.UserName;
        }
Esempio n. 2
0
 private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     gridUtility1.SetRowColor();
     m_Deputy = gridUtility1.GetSelectedItem <Deputy>();
     if (m_Deputy == null)
     {
         return;
     }
     m_User = UtilityFunction.GetUser(m_Deputy);
     if (m_User == null)
     {
         return;
     }
     m_Deputy.User = m_User;
     InitializeForm(m_Deputy);
 }
Esempio n. 3
0
 private void gridView1_RowClick_1(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     gridUtility1.SetRowColor();
     m_Subsupplier = gridUtility1.GetSelectedItem <SubSupplier>();
     if (m_Subsupplier == null)
     {
         return;
     }
     m_User = UtilityFunction.GetUser(m_Subsupplier);
     if (m_User == null)
     {
         m_User = new Users();
     }
     m_Subsupplier.User = m_User;
     InitializeForm(m_Subsupplier);
 }
Esempio n. 4
0
        private void frmCreateProduct_Load(object sender, EventArgs e)
        {
            if (objEdit == null)
            {
                return;
            }
            txtNameContact.Text   = objEdit.DeputyName;
            txtPhone.Text         = objEdit.Phone;
            txtSkype.Text         = objEdit.Skype;
            txtEmail.Text         = objEdit.Email;
            txtNote.Text          = objEdit.Note;
            checkIsActive.Checked = objEdit.IsActive;
            txtDiaChi.Text        = objEdit.Address;
            cbSex.SelectedIndex   = (objEdit.Sex) ? 0 : 1;
            cbMain.Checked        = objEdit.IsMain;


            Users  user    = UtilityFunction.GetUser(objEdit);
            string account = user != null ? user.UserName : "";

            if (objEdit.IsMain == true)
            {
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    userEdit = uow.UsersRepository.IsExist(account);
                    Boolean ismainTemp = uow.DeputyRepository.CheckIsMain(objEdit.CompanyId);
                    if (ismainTemp == false)
                    {
                        disableMain = true;
                    }
                    else
                    {
                        disableMain = false;
                    }
                }
            }
            txtAccount.Text = userEdit.UserName;

            if (disableMain == true)
            {
                cbMain.AutoCheck = false;
            }
        }