예제 #1
0
        /// <summary>
        /// 删除菜单
        /// </summary>
        /// <param name="deleteMenu">被删除的菜单</param>
        /// <param name="updataList">被删除菜单的子菜单</param>
        /// <returns></returns>
        public bool DeleteMenuTransaction(MenuInfo deleteMenu, List <MenuInfo> updataList)
        {
            List <MenuInfo> deleteList = new List <MenuInfo>();

            deleteList.Add(deleteMenu);

            //获取角色菜单
            List <RoleMenuRelationship> itemList = BaseEntityFac.GetEntityByField <RoleMenuRelationship>("MenuInfoId", deleteMenu.MenuInfoId);


            bool rel = BaseEntityFac.TransactionOPEntitys <RoleMenuRelationship>((cn, transaction) =>
            {
                bool result = false;
                result      = BaseEntityFac.TransactionOPEntitysAdd <RoleMenuRelationship>(cn, transaction, EOPType.Delete, itemList);

                result = BaseEntityFac.TransactionOPEntitysAdd <MenuInfo>(cn, transaction, EOPType.Delete, deleteList);

                result = BaseEntityFac.TransactionOPEntitysAdd <MenuInfo>(cn, transaction, EOPType.Update, updataList);


                return(result);
            }

                                                                                 );

            return(rel);
        }
예제 #2
0
        /// <summary>
        /// 插入新工序计划到数据库
        /// </summary>
        /// <param name="itemList"></param>
        /// <param name="CEmployeeNum"></param>
        /// <param name="CEmployeeName"></param>
        /// <returns></returns>
        public static bool InsertProcessWorkPlan(List <ClassWorkPlan> itemList, string CEmployeeNum, string CEmployeeName)
        {
            bool result = false;

            if (itemList != null && itemList.Count > 0)
            {
                List <ProductionOrderVersion> povList = new List <ProductionOrderVersion>();
                //遍历更新
                itemList.ForEach(x =>
                {
                    x.CEmployeeName = CEmployeeName;
                    x.CEmployeeNum  = CEmployeeNum;
                    x.CreateTime    = BaseEntityFac.GetServerTime();

                    ProductionOrderVersion pov = povList.Find(y => y.ProductionOrderVersionNumber == x.ProductionOrderVersionNumber);

                    if (pov == null)
                    {
                        string ProductionOrderVersionNumber    = x.ProductionOrderVersionNumber;
                        List <ProductionOrderVersion> tempList = BaseEntityFac.GetEntityByField <ProductionOrderVersion>
                                                                     (m => m.ProductionOrderVersionNumber == ProductionOrderVersionNumber);

                        if (tempList != null && tempList.Count > 0)
                        {
                            povList.AddRange(tempList);
                        }
                    }
                });

                povList.ForEach(x =>
                {
                    x.IsAPS = (int)WhetherValue.Yes;
                });

                return(BaseEntityFac.TransactionOPEntitys <ClassWorkPlan>((cn, transaction) =>
                {
                    bool res = false;
                    res = BaseEntityFac.TransactionOPEntitysAdd <ClassWorkPlan>(cn, transaction, EOPType.Insert, itemList);

                    res = BaseEntityFac.TransactionOPEntitysAdd <ProductionOrderVersion>(cn, transaction, EOPType.Update, povList);

                    return res;
                }));
            }

            return(result);
        }
예제 #3
0
        /// <summary>
        /// 保存角色跟菜单项的关系
        /// </summary>
        /// <param name="RoleInfoId"></param>
        /// <param name="insertItem"></param>
        /// <returns></returns>
        public bool SaveRoleMenuRelationship(string RoleInfoId, List <RoleMenuRelationship> insertItem)
        {
            BaseBusinessObject _BaseBusinessObject = new BaseBusinessObject();

            List <RoleMenuRelationship> itemDel = _BaseBusinessObject.GetEntityByField <RoleMenuRelationship>("RoleInfoId", RoleInfoId);


            bool rel = BaseEntityFac.TransactionOPEntitys <RoleMenuRelationship>((cn, transaction) =>
            {
                bool result = false;

                result = BaseEntityFac.TransactionOPEntitysAdd <RoleMenuRelationship>(cn, transaction, EOPType.Delete, itemDel);
                result = BaseEntityFac.TransactionOPEntitysAdd <RoleMenuRelationship>(cn, transaction, EOPType.Insert, insertItem);


                return(result);
            }

                                                                                 );

            return(rel);
        }
예제 #4
0
        /// <summary>
        /// 删除未使用的生产计划,如果该计划对应生产料单,则作废料单。
        /// </summary>
        /// <param name="itemList"></param>
        /// <returns></returns>
        public static bool DeleteNotUsedPlan(List <ClassWorkPlan> itemList, string CEmployeeNum, string CEmployeeName)
        {
            bool result = false;
            List <ClassReceiveMaterialPlan> crmpList = new List <ClassReceiveMaterialPlan>();

            foreach (var item in itemList)
            {
                string ClassWorkPlanId = item.ClassWorkPlanId;
                List <ClassReceiveMaterialPlan> crmpTempList = BaseEntityFac.GetEntityByField <ClassReceiveMaterialPlan>
                                                                   (x => x.ClassWorkPlanId == ClassWorkPlanId);

                if (crmpTempList != null && crmpTempList.Count > 0)
                {
                    //去掉重复料单记录
                    crmpTempList.ForEach(x =>
                    {
                        ClassReceiveMaterialPlan temp = crmpList.Find(y => y.ClassReceiveMaterialPlanId == x.ClassReceiveMaterialPlanId);

                        if (temp == null)
                        {
                            crmpList.Add(temp);
                        }
                    });
                }
            }

            BaseEntityFac.TransactionOPEntitys <ClassWorkPlan>((cn, transaction) =>
            {
                result = BaseEntityFac.TransactionOPEntitysAdd <ClassWorkPlan>(cn, transaction, EOPType.Insert, itemList);

                // res = BaseEntityFac.TransactionOPEntitysAdd<ProductionOrderVersion>(cn, transaction, EOPType.Update, povList);

                return(result);
            });


            return(result);
        }