示例#1
0
文件: Index.cs 项目: dovanduy/Library
        public override void Event_ModifyIndexItem(IndexListVM indexListVM, IndexItemVM indexItem, ICommonWithId icommonWithId)
        {
            base.Event_ModifyIndexItem(indexListVM, indexItem, icommonWithId);

            CashTrx cashTrx = icommonWithId as CashTrx;

            cashTrx.IsNullThrowException("Unable to unbox cashTrx");

            //get current user's PersonId first...
            Person person = UserBiz.GetPersonFor(UserId);

            if (person.IsNull())
            {
                indexItem.AllowDelete = false;
                indexItem.AllowEdit   = false;
            }
            else
            if (person.Id == cashTrx.PersonToId)
            {
                indexItem.AllowDelete = true;
                indexItem.AllowEdit   = false;
            }
            else
            {
                indexItem.AllowDelete = false;
                indexItem.AllowEdit   = false;
            }
        }
示例#2
0
文件: Fix.cs 项目: dovanduy/Library
        public override void Fix(ControllerCreateEditParameter parm)
        {
            UserId.IsNullOrWhiteSpaceThrowException("User is not logged in");
            CashTrx paymentTrx = parm.Entity as CashTrx;

            paymentTrx.IsNullThrowException("Unable to unbox payment trx");


            if (paymentTrx.DocNumber == 0)
            {
                paymentTrx.DocNumber = GetNextDocNumber();
            }

            if (parm.Entity.Name.IsNullOrWhiteSpace())
            {
                parm.Entity.Name = UserName;
                parm.Entity.Name = parm.Entity.MakeUniqueName();
            }

            if (paymentTrx.PersonFromId.IsNullOrEmpty())
            {
                paymentTrx.PersonFromId = null;
            }

            paymentTrx.PersonToId.IsNullOrWhiteSpaceThrowException("You must declare who you are paying.");

            Person personTo = PersonBiz.Find(paymentTrx.PersonToId);

            personTo.IsNullThrowException("personTo");
            paymentTrx.PersonTo = personTo;

            base.Fix(parm);
        }
示例#3
0
        public override ICommonWithId Factory()
        {
            CashTrx paymentTrx = base.Factory() as CashTrx;

            paymentTrx.CashTypeEnum = CashTypeENUM.Unknown;

            return(paymentTrx as ICommonWithId);
        }