Exemple #1
0
        public FBEntity ReSubmitT_FB_EXTENSIONALORDER(T_FB_EXTENSIONALORDER entity)
        {
            FBEntityBLL bll         = this;
            FBEntity    fbOldEntity = GetFBEntityByEntityKey(entity.EntityKey);


            var master  = fbOldEntity.Entity as T_FB_EXTENSIONALORDER;
            var details = fbOldEntity.GetRelationFBEntities(typeof(T_FB_EXTENSIONORDERDETAIL).Name);

            details.ForEach(item =>
            {
                bll.InnerRemove(item.Entity);
            });

            master.INNERORDERID = string.Empty;
            master.CHECKSTATES  = (int)CheckStates.Approving;
            master.TOTALMONEY   = entity.TOTALMONEY;

            var             result     = master.ToFBEntity();
            List <FBEntity> listDetail = entity.T_FB_EXTENSIONORDERDETAIL.ToList().CreateList(item =>
            {
                T_FB_EXTENSIONORDERDETAIL detail = new T_FB_EXTENSIONORDERDETAIL();
                detail.EXTENSIONORDERDETAILID    = Guid.NewGuid().ToString();

                detail.APPLIEDMONEY          = item.APPLIEDMONEY;
                detail.CHARGETYPE            = item.CHARGETYPE;
                detail.CREATEDATE            = DateTime.Now;
                detail.CREATEUSERID          = item.CREATEUSERID;
                detail.REMARK                = item.REMARK;
                detail.T_FB_SUBJECT          = item.T_FB_SUBJECT;
                detail.UPDATEUSERID          = item.UPDATEUSERID;
                detail.USABLEMONEY           = item.USABLEMONEY;
                detail.T_FB_EXTENSIONALORDER = entity;

                FBEntity fbEntityDetail      = detail.ToFBEntity();
                fbEntityDetail.FBEntityState = FBEntityState.Added;
                return(fbEntityDetail);
            });

            result.AddFBEntities <T_FB_EXTENSIONORDERDETAIL>(listDetail);

            result.FBEntityState = FBEntityState.ReSubmit;
            SaveT_FB_EXTENSIONALORDER(result);
            return(result);
        }