Пример #1
0
        private void CopyData(T_FB_PERSONMONEYASSIGNMASTER masterOld)
        {
            // 1复制主表
            var master = CopyMaster();

            var details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_PERSONMONEYASSIGNDETAIL).Name);

            // 复制每一个子表
            masterOld.T_FB_PERSONMONEYASSIGNDETAIL.ForEach(item =>
            {
                item.EntityKey = null;
                item.T_FB_PERSONMONEYASSIGNMASTER          = master;
                item.T_FB_PERSONMONEYASSIGNMASTERReference = null;
                item.PERSONBUDGETAPPLYDETAILID             = Guid.NewGuid().ToString();
                item.REMARK = string.Empty;
                item.T_FB_SUBJECT.T_FB_PERSONMONEYASSIGNDETAIL.Clear();
                item.T_FB_SUBJECT.T_FB_BUDGETACCOUNT.Clear();
                var fbEntityDetail           = item.ToFBEntity();
                fbEntityDetail.FBEntityState = FBEntityState.Added;
                details.Add(fbEntityDetail);

                master.T_FB_PERSONMONEYASSIGNDETAIL.Add(item);
            });

            decimal?sumMoney = details.Sum(item =>
            {
                return((item.Entity as T_FB_PERSONMONEYASSIGNDETAIL).BUDGETMONEY);
            });

            master.BUDGETMONEY = sumMoney;
        }
Пример #2
0
        /// <summary>
        /// 保存单据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void EditForm_Saving(object sender, SavingEventArgs e)
        {
            List <string> msgs = new List <string>();
            T_FB_PERSONMONEYASSIGNMASTER entCurr = this.OrderEntity.Entity as T_FB_PERSONMONEYASSIGNMASTER;

            if (string.IsNullOrWhiteSpace(entCurr.ASSIGNCOMPANYID) || string.IsNullOrWhiteSpace(entCurr.ASSIGNCOMPANYNAME))
            {
                msgs.Add("下拨公司不能为空");
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(msgs);
                return;
            }

            ObservableCollection <FBEntity> details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_PERSONMONEYASSIGNDETAIL).Name);

            ObservableCollection <FBEntity> list0 = new ObservableCollection <FBEntity>();


            details.ToList().ForEach(item =>
            {
                T_FB_PERSONMONEYASSIGNDETAIL detail = item.Entity as T_FB_PERSONMONEYASSIGNDETAIL;

                if (detail.BUDGETMONEY <= 0 || detail.BUDGETMONEY == null)
                {
                    string errorMessage = detail.OWNERNAME + "的下拨金额为零请删除";
                    msgs.Add(errorMessage);
                }
            });

            //明细为为0的不能提交
            if (details.ToList().Count <= 0)
            {
                msgs.Add("下拨明细不能为空");
            }
            if (msgs.Count > 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(msgs);
            }

            //删除多余的关联
            if (entCurr == null)
            {
                return;
            }

            if (entCurr.T_FB_PERSONMONEYASSIGNDETAIL == null)
            {
                return;
            }

            entCurr.T_FB_PERSONMONEYASSIGNDETAIL.Clear();
        }
Пример #3
0
        void OrderEntity_OrderPropertyChanged(object sender, OrderPropertyChangedArgs e)
        {
            T_FB_PERSONMONEYASSIGNMASTER entCurr = this.OrderEntity.Entity as T_FB_PERSONMONEYASSIGNMASTER;

            if (e.Result.Contains("Entity.AssignCompany"))
            {
                CompanyData comData = entCurr.AssignCompany as CompanyData;

                entCurr.ASSIGNCOMPANYNAME = comData.Text.ToString();
                entCurr.ASSIGNCOMPANYID   = comData.Value.ToString();
                GetOrderDetail();
            }
        }
Пример #4
0
        private T_FB_PERSONMONEYASSIGNMASTER CopyMaster()
        {
            T_FB_PERSONMONEYASSIGNMASTER entityNewly = this.OrderEntity.Entity as T_FB_PERSONMONEYASSIGNMASTER;

            if (entityNewly.T_FB_PERSONMONEYASSIGNDETAIL == null)
            {
                entityNewly.T_FB_PERSONMONEYASSIGNDETAIL = new ObservableCollection <T_FB_PERSONMONEYASSIGNDETAIL>();
            }

            entityNewly.T_FB_PERSONMONEYASSIGNDETAIL.Clear();
            entityNewly.PERSONMONEYASSIGNMASTERID = Guid.NewGuid().ToString();

            return(entityNewly);
        }
Пример #5
0
        void fbService_QueryFBEntitiesCompleted(object sender, QueryFBEntitiesCompletedEventArgs e)
        {
            try
            {
                if (e.Error == null)
                {
                    List <string> msgs = new List <string>();
                    try
                    {
                        this.OrderEntity.GetRelationFBEntities(typeof(T_FB_PERSONMONEYASSIGNDETAIL).Name).Clear();

                        if (e.Result.Count == 0)
                        {
                            this.OrderEntity.SetObjValue("Entity.BUDGETMONEY", 0);

                            CommonFunction.ShowErrorMessage("根据公司加载人员信息失败,请手动选择下拨人员");
                            return;
                        }

                        T_FB_PERSONMONEYASSIGNMASTER entlastest = e.Result[0].Entity as T_FB_PERSONMONEYASSIGNMASTER;
                        // 2. 复制上个月的单据数据到当前操作的新单据上
                        CopyData(entlastest);
                        //SortDetails();
                    }
                    catch (Exception ex)
                    {
                        msgs.Add(ex.ToString());
                    }

                    if (msgs.Count > 0)
                    {
                        CommonFunction.ShowErrorMessage(msgs);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                this.CloseProcess(false);
            }
        }
Пример #6
0
        /// <summary>
        /// 将指定的单据记录存储到我的单据
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public string SaveMyRecord(EntityObject entity)
        {
            string strTemp = string.Empty;

            try
            {
                if (entityTypeList.Count() == 0)
                {
                    InitEntityTypeList();
                }

                if (!entityTypeList.Contains(entity.GetType().Name))
                {
                    return(strTemp);
                }

                if (entity.GetType().Name == typeof(T_FB_PERSONMONEYASSIGNMASTER).Name)
                {
                    T_FB_PERSONMONEYASSIGNMASTER tempEntity = entity as T_FB_PERSONMONEYASSIGNMASTER;
                    if (tempEntity.APPLIEDTYPE.Equal(1) && tempEntity.APPLIEDTYPE.Equal(2) && tempEntity.APPLIEDTYPE.Equal(3))
                    {
                        return(strTemp);
                    }
                }

                if (entity.GetType().Name == typeof(T_FB_CHARGEAPPLYMASTER).Name)
                {
                    T_FB_CHARGEAPPLYMASTER entTemp = entity as T_FB_CHARGEAPPLYMASTER;
                    if (entTemp.CHARGEAPPLYMASTERCODE.ToUpper().StartsWith("CLBX"))
                    {
                        return(strTemp);
                    }
                }

                SMT.SaaS.BLLCommonServices.Utility.SubmitMyRecord <EntityObject>(entity);
            }
            catch (Exception ex)
            {
                strTemp = ex.ToString();
            }
            return(strTemp);
        }
Пример #7
0
        /// <summary>
        /// 获取T_FB_PERSONMONEYASSIGNMASTER信息
        /// </summary>
        /// <param name="strPersonmoneyAssignMasterId">主键索引</param>
        /// <returns></returns>
        public T_FB_PERSONMONEYASSIGNMASTER GetPersonmoneyAssignMasterByID(string strPersonmoneyAssignMasterId)
        {
            if (string.IsNullOrEmpty(strPersonmoneyAssignMasterId))
            {
                return(null);
            }

            PersonmoneyAssignMasterDAL dalPersonmoneyAssignMaster = new PersonmoneyAssignMasterDAL();
            StringBuilder strFilter = new StringBuilder();
            List <string> objArgs   = new List <string>();

            if (!string.IsNullOrEmpty(strPersonmoneyAssignMasterId))
            {
                strFilter.Append(" PERSONMONEYASSIGNMASTERID == @0");
                objArgs.Add(strPersonmoneyAssignMasterId);
            }

            T_FB_PERSONMONEYASSIGNMASTER entRd = dalPersonmoneyAssignMaster.GetPersonmoneyAssignMasterRdByMultSearch(strFilter.ToString(), objArgs.ToArray());

            return(entRd);
        }
Пример #8
0
 public static T_FB_PERSONMONEYASSIGNMASTER CreateT_FB_PERSONMONEYASSIGNMASTER(string pERSONMONEYASSIGNMASTERID, global::System.DateTime bUDGETARYMONTH, decimal eDITSTATES, decimal cHECKSTATES, string oWNERID, string oWNERPOSTID, string oWNERDEPARTMENTID, string oWNERCOMPANYID, string cREATEUSERID, global::System.DateTime cREATEDATE, string cREATECOMPANYID, string cREATEDEPARTMENTID, string cREATEPOSTID, string uPDATEUSERID, global::System.DateTime uPDATEDATE)
 {
     T_FB_PERSONMONEYASSIGNMASTER t_FB_PERSONMONEYASSIGNMASTER = new T_FB_PERSONMONEYASSIGNMASTER();
     t_FB_PERSONMONEYASSIGNMASTER.PERSONMONEYASSIGNMASTERID = pERSONMONEYASSIGNMASTERID;
     t_FB_PERSONMONEYASSIGNMASTER.BUDGETARYMONTH = bUDGETARYMONTH;
     t_FB_PERSONMONEYASSIGNMASTER.EDITSTATES = eDITSTATES;
     t_FB_PERSONMONEYASSIGNMASTER.CHECKSTATES = cHECKSTATES;
     t_FB_PERSONMONEYASSIGNMASTER.OWNERID = oWNERID;
     t_FB_PERSONMONEYASSIGNMASTER.OWNERPOSTID = oWNERPOSTID;
     t_FB_PERSONMONEYASSIGNMASTER.OWNERDEPARTMENTID = oWNERDEPARTMENTID;
     t_FB_PERSONMONEYASSIGNMASTER.OWNERCOMPANYID = oWNERCOMPANYID;
     t_FB_PERSONMONEYASSIGNMASTER.CREATEUSERID = cREATEUSERID;
     t_FB_PERSONMONEYASSIGNMASTER.CREATEDATE = cREATEDATE;
     t_FB_PERSONMONEYASSIGNMASTER.CREATECOMPANYID = cREATECOMPANYID;
     t_FB_PERSONMONEYASSIGNMASTER.CREATEDEPARTMENTID = cREATEDEPARTMENTID;
     t_FB_PERSONMONEYASSIGNMASTER.CREATEPOSTID = cREATEPOSTID;
     t_FB_PERSONMONEYASSIGNMASTER.UPDATEUSERID = uPDATEUSERID;
     t_FB_PERSONMONEYASSIGNMASTER.UPDATEDATE = uPDATEDATE;
     return t_FB_PERSONMONEYASSIGNMASTER;
 }
Пример #9
0
 public void AddToT_FB_PERSONMONEYASSIGNMASTER(T_FB_PERSONMONEYASSIGNMASTER t_FB_PERSONMONEYASSIGNMASTER)
 {
     base.AddObject("T_FB_PERSONMONEYASSIGNMASTER", t_FB_PERSONMONEYASSIGNMASTER);
 }
Пример #10
0
        private void CopyData(T_FB_PERSONMONEYASSIGNMASTER masterOld)
        {
            // 1复制主表
            var master = CopyMaster();

            var details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_PERSONMONEYASSIGNDETAIL).Name);

            // 复制每一个子表
            masterOld.T_FB_PERSONMONEYASSIGNDETAIL.ForEach(item =>
            {
                item.EntityKey = null;
                item.T_FB_PERSONMONEYASSIGNMASTER = master;
                item.T_FB_PERSONMONEYASSIGNMASTERReference = null;
                item.PERSONBUDGETAPPLYDETAILID = Guid.NewGuid().ToString();
                item.REMARK = string.Empty;
                item.T_FB_SUBJECT.T_FB_PERSONMONEYASSIGNDETAIL.Clear();
                item.T_FB_SUBJECT.T_FB_BUDGETACCOUNT.Clear();
                var fbEntityDetail = item.ToFBEntity();
                fbEntityDetail.FBEntityState = FBEntityState.Added;
                details.Add(fbEntityDetail);

                master.T_FB_PERSONMONEYASSIGNDETAIL.Add(item);
            });

            decimal? sumMoney = details.Sum(item =>
            {
                return (item.Entity as T_FB_PERSONMONEYASSIGNDETAIL).BUDGETMONEY;
            });
            master.BUDGETMONEY = sumMoney;
        }