/// <summary>
        /// Deletes the grid.
        /// </summary>
        protected override void DeleteGrid()
        {
            AccountingObjectModel row = gridView.GetRow(gridView.FocusedRowHandle) as AccountingObjectModel;

            if (row != null)
            {
                switch (row.AccountingObjectCategoryId)
                {
                case 0:
                    new VendorPresenter(null).Delete(int.Parse(PrimaryKeyValue));
                    break;

                case 2:
                    new AccountingObjectPresenter(null).Delete(int.Parse(PrimaryKeyValue));
                    break;

                case 3:
                    new CustomerPresenter(null).Delete(int.Parse(PrimaryKeyValue));
                    break;
                }
            }
            else
            {
                throw new Exception("Xóa đối tượng không thành công!");
            }
        }
コード例 #2
0
        private void cboAccountingObjectCategory_EditValueChanged(object sender, EventArgs e)
        {
            var dt = ((AccountingObjectCategoryModel)cboAccountingObjectCategory.GetSelectedDataRow()).AccountingObjectCategoryCode;

            switch (dt)
            {
            case "NCC":
            {
                cboAccount.EditValue = "331";
                break;
            }

            case "KH":
            {
                cboAccount.EditValue = "131";
                break;
            }

            default:
                cboAccount.EditValue = "<<Tất cả>>";
                break;
            }
            var _accountingObjectCategoryId        = (string)cboAccountingObjectCategory.EditValue;
            List <AccountingObjectModel> _ListObjs = new List <AccountingObjectModel>();

            foreach (var item in bindingSource.Cast <AccountingObjectModel>().Where(p => (_accountingObjectCategoryId == "ALL" || p.AccountingObjectCategoryId == _accountingObjectCategoryId) && !string.IsNullOrEmpty(p.AccountingObjectCategoryId)).ToList())
            {
                AccountingObjectModel _obj = new AccountingObjectModel();

                foreach (PropertyInfo info in item.GetType().GetProperties())
                {
                    info.SetValue(_obj, info.GetValue(item, null), null);
                }
                _ListObjs.Add(_obj);
            }
            grdAccountingObject.DataSource = null;
            grdAccountingObject.DataSource = _ListObjs;
            grdAccountingObject.Refresh();
            gridviewAccountingObject.RefreshData();
        }
コード例 #3
0
        public int Save()
        {
            var accountingObject = new AccountingObjectModel();

            accountingObject.AccountingObjectId         = View.AccountingObjectId;
            accountingObject.AccountingObjectCode       = View.AccountingObjectCode;
            accountingObject.AccountingObjectCategoryId = 1;
            accountingObject.Type            = View.Type;
            accountingObject.FullName        = View.FullName;
            accountingObject.Address         = View.Address;
            accountingObject.TaxCode         = View.TaxCode;
            accountingObject.BankAcount      = View.BankAcount;
            accountingObject.BankName        = View.BankName;
            accountingObject.BankId          = View.BankId;
            accountingObject.ContactName     = View.ContactName;
            accountingObject.ContactAddress  = View.ContactAddress;
            accountingObject.ContactIdNumber = View.ContactIdNumber;
            accountingObject.IssueDate       = View.IssueDate;
            accountingObject.IssueAddress    = View.IssueAddress;
            accountingObject.IsActive        = View.IsActive;

            return(accountingObject.AccountingObjectId == 0 ? Model.InsertAccountingObject(accountingObject) : Model.UpdateAccountingObject(accountingObject));
        }
コード例 #4
0
 internal static AccountingObjectEntity ToDataTransferObject(AccountingObjectModel model)
 {
     return(model == null ? null : AutoMapper.Mapper.Map <AccountingObjectModel, AccountingObjectEntity>(model));
 }
        /// <summary>
        /// Saves this instance.
        /// </summary>
        /// <returns></returns>
        public string Save()
        {
            var accountingObject = new AccountingObjectModel
            {
                AccountingObjectId         = View.AccountingObjectId,
                AccountingObjectCode       = View.AccountingObjectCode,
                AccountingObjectCategoryId = View.AccountingObjectCategoryId,
                AccountingObjectName       = View.AccountingObjectName,
                Address                       = View.Address,
                Tel                           = View.Tel,
                Fax                           = View.Fax,
                Website                       = View.Website,
                BankAccount                   = View.BankAccount,
                BankName                      = View.BankName,
                CompanyTaxCode                = View.CompanyTaxCode,
                BudgetCode                    = View.BudgetCode,
                AreaCode                      = View.AreaCode,
                Description                   = View.Description,
                ContactName                   = View.ContactName,
                ContactTitle                  = View.ContactTitle,
                ContactSex                    = View.ContactSex,
                ContactMobile                 = View.ContactMobile,
                ContactEmail                  = View.ContactEmail,
                ContactOfficeTel              = View.ContactOfficeTel,
                ContactHomeTel                = View.ContactHomeTel,
                ContactAddress                = View.ContactAddress,
                IsEmployee                    = View.IsEmployee,
                IsPersonal                    = View.IsPersonal,
                IdentificationNumber          = View.IdentificationNumber,
                IssueDate                     = View.IssueDate,
                IssueBy                       = View.IssueBy,
                DepartmentId                  = View.DepartmentId,
                SalaryScaleId                 = View.SalaryScaleId,
                Insured                       = View.Insured,
                LabourUnionFee                = View.LabourUnionFee,
                FamilyDeductionAmount         = View.FamilyDeductionAmount,
                IsActive                      = View.IsActive,
                ProjectId                     = View.ProjectId,
                IsCustomerVendor              = View.IsCustomerVendor,
                SalaryCoefficient             = View.SalaryCoefficient,
                NumberFamilyDependent         = View.NumberFamilyDependent,
                EmployeeTypeId                = View.EmployeeTypeId,
                SalaryForm                    = View.SalaryForm,
                SalaryPercentRate             = View.SalaryPercentRate,
                SalaryAmount                  = View.SalaryAmount,
                IsPayInsuranceOnSalary        = View.IsPayInsuranceOnSalary,
                InsuranceAmount               = View.InsuranceAmount,
                IsUnEmploymentInsurance       = View.IsUnEmploymentInsurance,
                RefTypeAO                     = View.RefTypeAO,
                SalaryGrade                   = View.SalaryGrade,
                CustomField1                  = View.CustomField1,
                CustomField2                  = View.CustomField2,
                CustomField3                  = View.CustomField3,
                CustomField4                  = View.CustomField4,
                CustomField5                  = View.CustomField5,
                IsPaidInsuranceForPayrollItem = View.IsPaidInsuranceForPayrollItem,
                IsBornLeave                   = View.IsBornLeave,
                TaxDepartmentName             = View.TaxDepartmentName,
                TreasuryName                  = View.TreasuryName,
                BudgetChapterId               = View.BudgetChapterId,
                BudgetItemId                  = View.BudgetItemId,
                OrganizationFeeCode           = View.OrganizationFeeCode,
                OrganizationManageFee         = View.OrganizationManageFee,
                TreasuryManageFee             = View.TreasuryManageFee,
                AccountingObjectBanks         = View.AccountingObjectBanks
            };

            if (accountingObject.AccountingObjectBanks == null)
            {
                accountingObject.AccountingObjectBanks = new List <BankModel>();
            }
            if (View.AccountingObjectId == null)
            {
                return(Model.AddAccountingObject(accountingObject));
            }
            return(Model.UpdateAccountingObject(accountingObject));
        }