private static object[] TakeInsert(RefTypeEntity refTypeEntity)
 {
     return(new object[]
     {
         "@RefTypeID", refTypeEntity.RefTypeId,
         "@RefTypeName", refTypeEntity.RefTypeName,
         "@FunctionID", refTypeEntity.FunctionId,
         "@RefTypeCategoryID ", refTypeEntity.RefTypeCategoryId,
         "@MasterTableName ", refTypeEntity.MasterTableName,
         "@DetailTableName ", refTypeEntity.DetailTableName,
         "@LayoutMaster ", refTypeEntity.LayoutMaster,
         "@LayoutDetail ", refTypeEntity.LayoutDetail,
         "@DefaultDebitAccountCategoryID ", refTypeEntity.DefaultDebitAccountCategoryId,
         "@DefaultDebitAccountID ", refTypeEntity.DefaultDebitAccountId,
         "@DefaultCreditAccountCategoryID ", refTypeEntity.DefaultCreditAccountCategoryId,
         "@DefaultCreditAccountID ", refTypeEntity.DefaultCreditAccountId,
         "@DefaultTaxAccountCategoryID ", refTypeEntity.DefaultTaxAccountCategoryId,
         "@DefaultTaxAccountID ", refTypeEntity.DefaultTaxAccountId,
         "@AllowDefaultSetting ", refTypeEntity.AllowDefaultSetting,
         "@Postable ", refTypeEntity.Postable,
         "@Searchable ", refTypeEntity.Searchable,
         "@SortOrder ", refTypeEntity.SortOrder,
         "@SubSystem ", refTypeEntity.SubSystem,
     });
 }
 /// <summary>
 ///     Takes the specified department.
 /// </summary>
 /// <param name="refTypeEntity">The department.</param>
 /// <returns></returns>
 private static object[] Take(RefTypeEntity refTypeEntity)
 {
     return(new object[]
     {
         "@RefTypeID", refTypeEntity.RefTypeId,
         "@DefaultCreditAccountCategoryID", refTypeEntity.DefaultCreditAccountCategoryId,
         "@DefaultCreditAccountID", refTypeEntity.DefaultCreditAccountId,
         "@DefaultDebitAccountCategoryID", refTypeEntity.DefaultDebitAccountCategoryId,
         "@DefaultDebitAccountID", refTypeEntity.DefaultDebitAccountId,
         "@DefaultTaxAccountCategoryID", refTypeEntity.DefaultTaxAccountCategoryId,
         "@DefaultTaxAccountID", refTypeEntity.DefaultTaxAccountId
     });
 }
 private static object[] TakeInsert(RefTypeEntity refTypeEntity)
 {
     return(new object[]
     {
         "@RefTypeID ", refTypeEntity.RefTypeID,
         "@RefTypeNo ", refTypeEntity.RefTypeNo,
         "@RefTypeCode ", refTypeEntity.RefTypeCode,
         "@RefTypeName ", refTypeEntity.RefTypeName,
         "@RefTypeCaption ", refTypeEntity.RefTypeCaption,
         "@FrmDetail ", refTypeEntity.FrmDetail,
         "@NameSpace ", refTypeEntity.NameSpace,
         "@SystemType ", refTypeEntity.SystemType,
         "@IsEnable ", refTypeEntity.IsEnable,
         "@ViewModel ", refTypeEntity.ViewModel,
     });
 }
Beispiel #4
0
        public RefTypeResponse InsertAccountDefaultConvert(RefTypeEntity refTypeEntity)
        {
            var response = new RefTypeResponse()
            {
                Acknowledge = AcknowledgeType.Success
            };

            try
            {
                if (!refTypeEntity.Validate())
                {
                    foreach (string error in refTypeEntity.ValidationErrors)
                    {
                        response.Message += error + Environment.NewLine;
                    }
                    response.Acknowledge = AcknowledgeType.Failure;
                    return(response);
                }

                var accountDefault = RefTypeDao.GetRefType(refTypeEntity.RefTypeId);
                if (accountDefault != null)
                {
                    if (accountDefault.RefTypeId == refTypeEntity.RefTypeId)
                    {
                        response.Acknowledge = AcknowledgeType.Failure;
                        response.Message     = @"Tài khoản " + refTypeEntity.RefTypeName.Trim() + @" đã tồn tại !";
                        return(response);
                    }
                }
                response.Message = RefTypeDao.InsertReftype(refTypeEntity);
                if (!string.IsNullOrEmpty(response.Message))
                {
                    response.Acknowledge = AcknowledgeType.Failure;
                    return(response);
                }
                response.RefTypeId = refTypeEntity.RefTypeId;
                return(response);
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                return(response);
            }
        }
        public List <RefTypeEntity> GetAccountsDefault(string connectionString)
        {
            List <RefTypeEntity> listAccount = new List <RefTypeEntity>();

            using (var context = new MISAEntity(connectionString))
            {
                var lstaccountDefault = context.RefTypes.ToList();
                foreach (var result in lstaccountDefault)
                {
                    var accountDefault = new RefTypeEntity();
                    accountDefault.RefTypeId                      = result.RefType1;
                    accountDefault.RefTypeName                    = result.RefTypeName;
                    accountDefault.FunctionId                     = result.FunctionID;
                    accountDefault.RefTypeCategoryId              = result.RefTypeCategory;
                    accountDefault.MasterTableName                = result.MasterTableName;
                    accountDefault.DetailTableName                = result.DetailTableName;
                    accountDefault.LayoutMaster                   = result.LayoutMaster;
                    accountDefault.LayoutDetail                   = result.LayoutDetail;
                    accountDefault.DefaultDebitAccountCategoryId  = result.DefaultDebitAccountCategoryID;
                    accountDefault.DefaultDebitAccountId          = result.DefaultDebitAccountID;
                    accountDefault.DefaultCreditAccountCategoryId = result.DefaultCreditAccountCategoryID;
                    accountDefault.DefaultCreditAccountId         = result.DefaultCreditAccountID;
                    accountDefault.DefaultTaxAccountCategoryId    = result.DefaultTaxAccountCategoryID;
                    accountDefault.DefaultTaxAccountId            = result.DefaultTaxAccountID;
                    accountDefault.AllowDefaultSetting            = result.AllowDefaultSetting;
                    accountDefault.Postable   = result.Postable;
                    accountDefault.Searchable = result.Searchable;
                    accountDefault.SortOrder  = result.SortOrder;
                    accountDefault.SubSystem  = result.SubSystem;

                    listAccount.Add(accountDefault);
                }
            }

            return(listAccount);
        }
Beispiel #6
0
        /// <summary>
        /// Updates the type of the reference.
        /// </summary>
        /// <param name="refTypeEntity">The reference type entity.</param>
        /// <returns></returns>
        public RefTypeResponse UpdateRefType(RefTypeEntity refTypeEntity)
        {
            var response = new RefTypeResponse {
                Acknowledge = AcknowledgeType.Success
            };

            try
            {
                if (!refTypeEntity.Validate())
                {
                    foreach (var error in refTypeEntity.ValidationErrors)
                    {
                        response.Message += error + Environment.NewLine;
                    }
                    response.Acknowledge = AcknowledgeType.Failure;
                    return(response);
                }
                using (var scope = new TransactionScope())
                {
                    response.Message = RefTypeDao.UpdateRefType(refTypeEntity);
                    if (!string.IsNullOrEmpty(response.Message))
                    {
                        response.Acknowledge = AcknowledgeType.Failure;
                        return(response);
                    }
                    scope.Complete();
                }
                response.RefTypeId = refTypeEntity.RefTypeId;
                return(response);
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                return(response);
            }
        }
        public string InsertReftype(RefTypeEntity refTypeEntity)
        {
            const string sql = @"uspInsert_RefType";

            return(Db.Update(sql, true, TakeInsert(refTypeEntity)));
        }
        /// <summary>
        /// Updates the type of the reference.
        /// </summary>
        /// <param name="refTypeEntity">The reference type entity.</param>
        /// <returns></returns>
        public string UpdateRefType(RefTypeEntity refTypeEntity)
        {
            const string sql = @"uspUpdate_RefType";

            return(Db.Update(sql, true, Take(refTypeEntity)));
        }
Beispiel #9
0
 internal static RefTypeModel FromDataTransferObject(RefTypeEntity entity)
 {
     return(entity == null ? null : AutoMapper.Mapper.Map <RefTypeEntity, RefTypeModel>(entity));
 }