Exemple #1
0
        public CenterModel Add(CenterModel newCenterModel)
        {
            try
            {
                center cen = new center();

                cen.address = newCenterModel.Address;
                cen.name    = newCenterModel.Name;
                cen.phone   = newCenterModel.Phone;
                if (newCenterModel.ConsultantId != 0)
                {
                    cen.consultant_id = newCenterModel.ConsultantId;
                }

                _unitOfWork.AddAction(cen, DataActions.Add);
                _unitOfWork.Save();
                newCenterModel.Id = cen.center_id;

                return(newCenterModel);
            }
            catch (RepositoryException rex)
            {
                string msg    = rex.Message;
                string reason = rex.StackTrace;
                throw new FaultException <LCFault>
                          (new LCFault(msg), reason);
            }
            catch (Exception ex)
            {
                string msg    = ex.Message;
                string reason = ex.StackTrace;
                throw new FaultException <LCFault>
                          (new LCFault(msg), reason);
            }
        }
Exemple #2
0
        /// <summary>
        /// 创建班级信息
        /// </summary>
        /// <param name="newClassEditModel">需要创建的班级信息</param>
        public ClassEditModel Add(ClassEditModel newClassEditModel)
        {
            try
            {
                classes classentity = new classes();

                classentity.class_name = newClassEditModel.Name;
                classentity.class_type = newClassEditModel.TypeId;
                classentity.end_date   = newClassEditModel.EndDate;
                classentity.last_count = newClassEditModel.LastCount;
                classentity.start_date = newClassEditModel.StartDate;
                classentity.is_active  = newClassEditModel.IsActive;

                _unitOfWork.AddAction(classentity, DataActions.Add);
                _unitOfWork.Save();
                newClassEditModel.Id = classentity.class_id;

                return(newClassEditModel);
            }
            catch (RepositoryException rex)
            {
                string msg    = rex.Message;
                string reason = rex.StackTrace;
                throw new FaultException <LCFault>
                          (new LCFault(msg), reason);
            }
            catch (Exception ex)
            {
                string msg    = ex.Message;
                string reason = ex.StackTrace;
                throw new FaultException <LCFault>
                          (new LCFault(msg), reason);
            }
        }
Exemple #3
0
 /// <summary>
 /// 添加设备类型
 /// </summary>
 /// <param name="newEquipmentType">需要添加的设备类型</param>
 public EquipmentTypeEditModel Add(EquipmentTypeEditModel newEquipmentType)
 {
     try
     {
         if (CheckCodeExists(newEquipmentType.EditEquipmentType.EquipmentTypeCode))
         {
             throw new FaultException<AisinoMesFault>(new AisinoMesFault("添加失败"), "该编号已存在,不能重复添加");
         }
         if (CheckNameExists(newEquipmentType.EditEquipmentType.Name))
         {
             throw new FaultException<AisinoMesFault>(new AisinoMesFault("添加失败"), "该名称已存在,不能重复添加");
         }
         _unitOfWork.AddAction(newEquipmentType.EditEquipmentType, DataActions.Add);
         _unitOfWork.Save();
         return newEquipmentType;
     }
     catch (RepositoryException rex)
     {
         string msg = rex.Message;
         string reason = rex.StackTrace;
         throw new FaultException<AisinoMesFault>
         (new AisinoMesFault(msg), reason);
     }
     catch (Exception ex)
     {
         string msg = ex.Message;
         string reason = ex.StackTrace;
         throw new FaultException<AisinoMesFault>
         (new AisinoMesFault(msg), reason);
     }
 }
Exemple #4
0
        /// <summary>
        /// 添加模块
        /// </summary>
        /// <param name="newModule">需要添加的模块信息</param>
        public ModuleEditModel Add(ModuleEditModel newModule)
        {
            try
            {
                if (CheckCodeExists(newModule.ModuleCode))
                {
                    throw new FaultException<LCFault>(new LCFault("模块添加失败"), "该模块编号已存在,不能重复添加");
                }
                SysModule sysModule = new SysModule();
                sysModule.ModuleCode = newModule.ModuleCode;
                sysModule.Name = newModule.Name;
                sysModule.Remark = newModule.Name;
                sysModule.Stopped = newModule.Stopped;
                _unitOfWork.AddAction(sysModule, DataActions.Add);
                _unitOfWork.Save();

                return newModule;
            }
            catch (RepositoryException rex)
            {
                string msg = rex.Message;
                string reason = rex.StackTrace;
                throw new FaultException<LCFault>
                (new LCFault(msg), reason);
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                string reason = ex.StackTrace;
                throw new FaultException<LCFault>
                (new LCFault(msg), reason);
            }
        }
Exemple #5
0
        /// <summary>
        /// 创建会籍顾问信息
        /// </summary>
        /// <param name="newUserModel">需要创建的会籍顾问信息</param>
        public ConsultantModel Add(ConsultantModel newConsultantModel)
        {
            try
            {
                consultant consul = new consultant();

                consul.abbreviation    = newConsultantModel.abbreviation;
                consul.name            = newConsultantModel.Name;
                consul.commission_rate = newConsultantModel.CommissionRate;

                _unitOfWork.AddAction(consul, DataActions.Add);
                _unitOfWork.Save();

                newConsultantModel.Id = consul.consultant_id;

                return(newConsultantModel);
            }
            catch (RepositoryException rex)
            {
                string msg    = rex.Message;
                string reason = rex.StackTrace;
                throw new FaultException <LCFault>
                          (new LCFault(msg), reason);
            }
            catch (Exception ex)
            {
                string msg    = ex.Message;
                string reason = ex.StackTrace;
                throw new FaultException <LCFault>
                          (new LCFault(msg), reason);
            }
        }
Exemple #6
0
        /// <summary>
        /// 创建教室信息
        /// </summary>
        /// <param name="newUserModel">需要创建的教室信息</param>
        public ClassroomModel Add(ClassroomModel newClassroomModel)
        {
            try
            {
                center_classrooms classroom = new center_classrooms();

                classroom.center_id      = newClassroomModel.CenterId;
                classroom.classroom_name = newClassroomModel.Name;
                classroom.upper_limit    = newClassroomModel.UpperLimit;

                _unitOfWork.AddAction(classroom, DataActions.Add);
                _unitOfWork.Save();
                newClassroomModel.Id = classroom.classroom_id;

                return(newClassroomModel);
            }
            catch (RepositoryException rex)
            {
                string msg    = rex.Message;
                string reason = rex.StackTrace;
                throw new FaultException <LCFault>
                          (new LCFault(msg), reason);
            }
            catch (Exception ex)
            {
                string msg    = ex.Message;
                string reason = ex.StackTrace;
                throw new FaultException <LCFault>
                          (new LCFault(msg), reason);
            }
        }
Exemple #7
0
 /// <summary>
 /// 删除一个角色
 /// </summary>
 /// <param name="delSysRole">要删除的角色</param>
 public void DelSysRole(SysRole delSysRole)
 {
     try
     {
         delSysRole.role_deleted = true;
         _unitOfWork.AddAction(delSysRole, DataActions.Update);
         ////删除所有该角色与权限的关系
         //IList<SysRoleRight> sysRoleRightList = _sysRoleRightDal.Find(s => s.role_id == delSysRole.id).Entities.ToList();
         //foreach (SysRoleRight srr in sysRoleRightList)
         //{
         //    _unitOfWork.AddAction(srr, DataActions.Delete);
         //}
         ////删除所有该角色与用户的关系
         //IList<SysRoleUser> sysRoleUserList = _sysRoleUserDal.Find(s => s.role_id == delSysRole.id).Entities.ToList();
         //foreach (SysRoleUser sru in sysRoleUserList)
         //{
         //    _unitOfWork.AddAction(sru, DataActions.Delete);
         //}
         _unitOfWork.Save();
     }
     catch (RepositoryException ex)
     {
         throw ex;
     }
 }
Exemple #8
0
        /// <summary>
        /// 创建教师信息
        /// </summary>
        /// <param name="newUserModel">需要创建的教师信息</param>
        public TeacherModel Add(TeacherModel newTeacherModel)
        {
            try
            {
                teacher teacherEntity = new teacher();

                teacherEntity.mobile   = newTeacherModel.Mobile;
                teacherEntity.name     = newTeacherModel.Name;
                teacherEntity.status   = newTeacherModel.StatusId;
                teacherEntity.UserCode = newTeacherModel.UserCode;

                _unitOfWork.AddAction(teacherEntity, DataActions.Add);
                _unitOfWork.Save();
                newTeacherModel.Id = teacherEntity.teacher_id;

                return(newTeacherModel);
            }
            catch (RepositoryException rex)
            {
                string msg    = rex.Message;
                string reason = rex.StackTrace;
                throw new FaultException <LCFault>
                          (new LCFault(msg), reason);
            }
            catch (Exception ex)
            {
                string msg    = ex.Message;
                string reason = ex.StackTrace;
                throw new FaultException <LCFault>
                          (new LCFault(msg), reason);
            }
        }
Exemple #9
0
        public WarehouseInOutRecord UpdateWarehouseInOutRecordWithStoreInfoAndBatchDetail(WarehouseStoreInfo warehouseStoreInfo, WarehouseStoreInfo outWarehouseStoreInfo, PlanTaskBatchDetail planTaskBatchDetail, string orgCode)
        {
            PlanTaskBatch planTaskBatch = planTaskBatchDetail.PlanTaskBatch;

            //如果是倒仓,则有出库storeinfo判定
            if (outWarehouseStoreInfo != null)
            {
                WarehouseInOutRecord outWarehouseInOutRecord = planTaskBatch.WarehouseInOutRecords.Where(t => t.warehouse_id == outWarehouseStoreInfo.warehouse_id).FirstOrDefault();
                if (outWarehouseInOutRecord == null)
                {
                    outWarehouseInOutRecord = this.AddWarehouseInOutRecordWithStoreInfoAndBatchDetail(outWarehouseStoreInfo, planTaskBatchDetail, true, orgCode, true);
                }
                else
                {
                    outWarehouseInOutRecord.record_count  += planTaskBatchDetail.weight;
                    outWarehouseInOutRecord.balance_count -= planTaskBatchDetail.weight;
                    outWarehouseInOutRecord.inout_datetime = planTaskBatchDetail.weight_time == null ? "" : planTaskBatchDetail.weight_time.Value.ToString("yyyyMMddHHmmss");
                    _unitOfWork.AddAction(outWarehouseInOutRecord, DAL.Enums.DataActions.Update);
                    AddWarehouseInOutRecordDetailWithInOutRecordAndBatchDetail(outWarehouseInOutRecord, planTaskBatchDetail);
                }
            }
            //是否需要判断批次已经完成,需要确认一下
            WarehouseInOutRecord warehouseInOutRecord = planTaskBatch.WarehouseInOutRecords.Where(t => t.warehouse_id == warehouseStoreInfo.warehouse_id).FirstOrDefault();

            if (warehouseInOutRecord == null)
            {
                //如果当前新增的批次明细所属计划批次还没有对应的出入库记录,则新增出入库记录
                warehouseInOutRecord = this.AddWarehouseInOutRecordWithStoreInfoAndBatchDetail(warehouseStoreInfo, planTaskBatchDetail, false, orgCode, false);
            }
            else
            {
                //更新出入库记录表,以及增加出入库明细表
                warehouseInOutRecord.record_count += planTaskBatchDetail.weight;
                if (planTaskBatch.PlanTask.Enrolment == null)
                {
                    warehouseInOutRecord.balance_count += planTaskBatchDetail.weight;
                }
                else
                {
                    if (planTaskBatch.PlanTask.Enrolment.inout_type == (int)InOutType.入库)
                    {
                        warehouseInOutRecord.balance_count += planTaskBatchDetail.weight;
                    }
                    else
                    {
                        warehouseInOutRecord.balance_count -= planTaskBatchDetail.weight;
                    }
                }
                warehouseInOutRecord.inout_datetime = planTaskBatchDetail.weight_time == null ? "" : planTaskBatchDetail.weight_time.Value.ToString("yyyyMMddHHmmss");
                _unitOfWork.AddAction(warehouseInOutRecord, DAL.Enums.DataActions.Update);
            }
            AddWarehouseInOutRecordDetailWithInOutRecordAndBatchDetail(warehouseInOutRecord, planTaskBatchDetail);
            return(warehouseInOutRecord);
        }
Exemple #10
0
 private void DelSubQTestItem(QualityIndex delSubQTestItem)
 {
     //if (delSubQTestItem.SubQualityTestItem != null || delSubQTestItem.SubQualityTestItem.Count != 0)
     //{
     //    foreach (QualityTestItem subQuality in delSubQTestItem.SubQualityTestItem)
     //    {
     //        DelSubQTestItem(subQuality);
     //    }
     //}
     _unitOfWork.AddAction(delSubQTestItem, DataActions.Delete);
 }
Exemple #11
0
        private void DeleteSubWarehGroup(WarehouseGroup delWarehGroup)
        {
            if (delWarehGroup.SubWarehouseGroup != null)
            {
                foreach (WarehouseGroup subGroup in delWarehGroup.SubWarehouseGroup)
                {
                    DeleteSubWarehGroup(subGroup);
                }
            }

            delWarehGroup.warehouse_group_deleted = true;
            _unitOfWork.AddAction(delWarehGroup, DataActions.Update);
        }
Exemple #12
0
 private void DeleteSubMenus(SysMenu delMenu)
 {
     //有子菜单,则调用自身删除
     if (delMenu.SubMenus != null)
     {
         List <SysMenu> subMenuList = delMenu.SubMenus.ToList();
         foreach (SysMenu sm in subMenuList)
         {
             DeleteSubMenus(sm);
         }
     }
     //删除自身
     _unitOfWork.AddAction(delMenu, DataActions.Delete);
 }
Exemple #13
0
 /// <summary>
 /// 内部车辆新增
 /// </summary>
 /// <param name="plantaskbatch"></param>
 /// <param name="planVehicleList"></param>
 public void AddPlanTaskBatchVehicle(PlanTaskBatch plantaskbatch, List <PlanTaskBatchVehicle> planVehicleList)
 {
     try
     {
         List <PlanTaskBatchVehicle> oldplanVehicleList = _planTaskBatchVehicleDal.Find(ss => ss.plantask_batch_number == plantaskbatch.plantask_batch_number).Entities.ToList();
         if (oldplanVehicleList != null && oldplanVehicleList.Count > 0)
         {
             foreach (PlanTaskBatchVehicle planvehicle in planVehicleList)
             {
                 //查找是否存在要保存的项
                 if (!oldplanVehicleList.Any(ss => ss.plantask_batch_number == planvehicle.plantask_batch_number && ss.vehicle_id == planvehicle.vehicle_id))
                 {
                     _unitOfWork.AddAction(planvehicle, DataActions.Add);
                 }
             }
         }
         else
         {
             foreach (PlanTaskBatchVehicle planvehicle in planVehicleList)
             {
                 _unitOfWork.AddAction(planvehicle, DataActions.Add);
             }
         }
     }
     catch (RepositoryException ex)
     {
         throw ex;
     }
 }
Exemple #14
0
 public void DelConsumerGoodTypeList(List <EquipmentConsumerType> delConsumerTypeList)
 {
     try
     {
         _unitOfWork.Actions.Clear();
         foreach (EquipmentConsumerType reasonType in delConsumerTypeList)
         {
             _unitOfWork.AddAction(reasonType, DataActions.Delete);
         }
         _unitOfWork.Save();
     }
     catch (RepositoryException ex)
     {
         throw new AisinoMesServiceException("批量删除耗材类别信息失败!", ex);
     }
 }
Exemple #15
0
        public SysRight DeleteSysRight(SysRight delSysRight)
        {
            SysRight sysRight = null;

            try
            {
                delSysRight.right_deleted = true;
                _unitOfWork.AddAction(delSysRight, DataActions.Update);
                _unitOfWork.Save();
            }
            catch (RepositoryException ex)
            {
                throw new AisinoMesServiceException("删除权限信息失败!", ex);
            }
            return(sysRight);
        }
Exemple #16
0
 public void DeleteMaintReasonTypeList(List <EquipmentMaintReasonType> lstDelReasonType)
 {
     try
     {
         _unitOfWork.Actions.Clear();
         foreach (EquipmentMaintReasonType reasonType in lstDelReasonType)
         {
             _unitOfWork.AddAction(reasonType, DataActions.Delete);
         }
         _unitOfWork.Save();
     }
     catch (RepositoryException ex)
     {
         throw new AisinoMesServiceException("批量删除维护原因类别信息失败!", ex);
     }
 }
Exemple #17
0
 public void DelWarehTranDetailList(List <WarehouseTransactionDetail> warehTranDetailList)
 {
     _unitOfWork.Actions.Clear();
     foreach (WarehouseTransactionDetail warehTranDetail in warehTranDetailList)
     {
         _unitOfWork.AddAction(warehTranDetail, DataActions.Delete);
     }
     _unitOfWork.Save();
 }
Exemple #18
0
        public void SaveWarehouseLocations(List <WarehouseLocation> warehouseLocationList)
        {
            try
            {
                List <WarehouseLocation> oldLocation = FindAllWarehouseLocation().ToList();

                if (oldLocation != null && oldLocation.Count > 0)
                {
                    foreach (WarehouseLocation warehouseLocation in warehouseLocationList)
                    {
                        //查找选择的位置信息是否已存在
                        if (!oldLocation.Any(d => d.id == warehouseLocation.id))
                        {
                            _unitOfWork.AddAction(warehouseLocation, DataActions.Add);
                        }
                        else
                        {
                            _unitOfWork.AddAction(warehouseLocation, DataActions.Update);
                        }
                    }
                }
                else
                {
                    foreach (WarehouseLocation warehouseLocation in warehouseLocationList)
                    {
                        _unitOfWork.AddAction(warehouseLocation, DataActions.Add);
                    }
                }

                ////查找之前选择的菜单是否已删除
                //if (oldLocation != null)
                //{
                //    //原有单头所含明细不为空,则需要判断是否有删除项
                //    foreach (WarehouseLocation warehouseLocation in oldLocation.Where(x => !warehouseLocationList.Any(u => u.id == x.id)).ToList())
                //    {
                //        _unitOfWork.AddAction(warehouseLocation, DataActions.Delete);
                //    }

                //}
                _unitOfWork.Save();
            }
            catch (RepositoryException ex)
            {
                throw new AisinoMesServiceException("保存仓库位置信息失败!", ex);
            }
        }
Exemple #19
0
        public void UpdateBorLineSection(int borLineId, List <BorLineSection> lstBorLineSection)
        {
            try
            {
                List <BorLineSection> oldBorLineSection = _borLineSectionDal.Find(rm => rm.bor_line_id == borLineId).Entities.ToList();

                if (oldBorLineSection != null && oldBorLineSection.Count > 0)
                {
                    foreach (BorLineSection borLineSection in lstBorLineSection)
                    {
                        //查找选择的工段是否已存在
                        if (!oldBorLineSection.Any(d => d.bor_line_id == borLineSection.bor_line_id && d.bor_section_id == borLineSection.bor_section_id))
                        {
                            _unitOfWork.AddAction(borLineSection, DataActions.Add);
                        }
                        //查找选择的工段是否已存在,如果存在,但是序号不同
                        if (oldBorLineSection.Any(d => d.bor_section_id == borLineSection.bor_section_id && d.bor_line_id == borLineSection.bor_line_id) && !oldBorLineSection.Any(d => d.seq == borLineSection.seq))
                        {
                            _unitOfWork.AddAction(borLineSection, DataActions.Update);
                        }
                    }
                }
                else
                {
                    foreach (BorLineSection borLineSection in lstBorLineSection)
                    {
                        _unitOfWork.AddAction(borLineSection, DataActions.Add);
                    }
                }

                //查找之前选择的工段是否已删除
                if (oldBorLineSection != null)
                {
                    //原有路线所含工段不为空,则需要判断是否有删除项
                    foreach (BorLineSection borLineSectionRemove in oldBorLineSection.Where(x => !lstBorLineSection.Any(u => u.bor_line_id == x.bor_line_id && u.bor_section_id == x.bor_section_id)).ToList())
                    {
                        _unitOfWork.AddAction(borLineSectionRemove, DataActions.Delete);
                    }
                }
                _unitOfWork.Save();
            }
            catch (RepositoryException ex)
            {
                throw new AisinoMesServiceException("更改工艺路线所含工段失败!", ex);
            }
        }
Exemple #20
0
        /// <summary>
        /// 添加菜单
        /// </summary>
        /// <param name="newMenu">需要添加的菜单业务模型</param>
        /// <param name="isRoot">是否新增根菜单
        /// 默认为不是根菜单,则校验是否已经赋值根菜单;同时在该根菜单下的节点最右侧增加
        /// 如果是根菜单,则要判定系统是否已经存在根菜单</param>
        public MenuEditModel Add(MenuEditModel newMenu, bool isRoot)
        {
            try
            {
                if (CheckCodeExists(newMenu.MenuCode))
                {
                    throw new FaultException<LCFault>(new LCFault("菜单添加失败"), "该菜单编号已存在,不能重复添加");
                }
                if (CheckNameExists(newMenu.Name))
                {
                    throw new FaultException<LCFault>(new LCFault("菜单添加失败"), "该菜单名称已存在,不能重复添加");
                }
                int layer = this.GetMenuByCode(newMenu.ParentCode).Layer.Value;

                SysMenu sysMenu = new SysMenu();

                sysMenu.MenuCode = newMenu.MenuCode;
                sysMenu.Name = newMenu.Name;
                sysMenu.DisplayName = newMenu.DisplayName;
                sysMenu.Remark = newMenu.Remark;
                sysMenu.ShowIndex = newMenu.ShowIndex;
                sysMenu.ModuleCode = newMenu.ModuleCode;
                sysMenu.ParentCode = newMenu.ParentCode;
                sysMenu.FunctionCode = newMenu.FunctionCode;
                sysMenu.Type = newMenu.Type;
                sysMenu.Layer = layer + 1;

                _unitOfWork.AddAction(sysMenu, DataActions.Add);
                _unitOfWork.Save();
                return newMenu;
            }
            catch (RepositoryException rex)
            {
                string msg = rex.Message;
                string reason = rex.StackTrace;
                throw new FaultException<LCFault>
                (new LCFault(msg), reason);
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                string reason = ex.StackTrace;
                throw new FaultException<LCFault>
                (new LCFault(msg), reason);
            }
        }
Exemple #21
0
        public void UpdateBorSectionEquip(int borSectionId, List <BorSectionEquipment> lstBorSectionEquip)
        {
            try
            {
                List <BorSectionEquipment> oldBorSectionEquip = _borSectionEquipmentDal.Find(rm => rm.bor_section_id == borSectionId).Entities.ToList();

                if (oldBorSectionEquip != null && oldBorSectionEquip.Count > 0)
                {
                    foreach (BorSectionEquipment borSectionEquip in lstBorSectionEquip)
                    {
                        //查找选择的设备是否已存在
                        if (!oldBorSectionEquip.Any(d => d.bor_section_id == borSectionEquip.bor_section_id && d.equipment_code == borSectionEquip.equipment_code))
                        {
                            _unitOfWork.AddAction(borSectionEquip, DataActions.Add);
                        }
                        //查找选择的设备是否已存在,如果存在,但是序号不同
                        if (oldBorSectionEquip.Any(d => d.bor_section_id == borSectionEquip.bor_section_id && d.equipment_code == borSectionEquip.equipment_code) && !oldBorSectionEquip.Any(d => d.seq == borSectionEquip.seq))
                        {
                            _unitOfWork.AddAction(borSectionEquip, DataActions.Update);
                        }
                    }
                }
                else
                {
                    foreach (BorSectionEquipment borSectionEquip in lstBorSectionEquip)
                    {
                        _unitOfWork.AddAction(borSectionEquip, DataActions.Add);
                    }
                }

                //查找之前选择的设备是否已删除
                if (oldBorSectionEquip != null)
                {
                    //原有工段所含设备不为空,则需要判断是否有删除项
                    foreach (BorSectionEquipment borSectionEquipRemove in oldBorSectionEquip.Where(x => !lstBorSectionEquip.Any(u => u.bor_section_id == x.bor_section_id && u.equipment_code == x.equipment_code)).ToList())
                    {
                        _unitOfWork.AddAction(borSectionEquipRemove, DataActions.Delete);
                    }
                }
                _unitOfWork.Save();
            }
            catch (RepositoryException ex)
            {
                throw new AisinoMesServiceException("更改工段所含设备失败!", ex);
            }
        }
Exemple #22
0
        public BorGroupMaster DeleteBorGroupMaster(BorGroupMaster delBorGroupMaster)
        {
            BorGroupMaster borGroupMaster = null;

            try
            {
                delBorGroupMaster.bor_group_deleted = true;
                _unitOfWork.AddAction(delBorGroupMaster, DataActions.Update);
                borGroupMaster = delBorGroupMaster;
                _unitOfWork.Save();
            }
            catch (RepositoryException ex)
            {
                throw new AisinoMesServiceException("删除品号组信息失败!", ex);
            }
            return(borGroupMaster);
        }
Exemple #23
0
        ///
        /// <param name="delManTeam"></param>
        public ManTeam DeleteManTeam(ManTeam delManTeam)
        {
            ManTeam returnManTeam = null;

            try
            {
                //删除班组下的所有成员
                foreach (ManTeamUser manTeamUser in delManTeam.ManTeamUsers)
                {
                    _unitOfWork.AddAction(manTeamUser, DataActions.Delete);
                }

                _unitOfWork.AddAction(delManTeam, DataActions.Delete);

                _unitOfWork.Save();


                returnManTeam = delManTeam;
            }
            catch (RepositoryException ex)
            {
                throw ex;
            }
            return(returnManTeam);
        }
Exemple #24
0
        /// <summary>
        /// 添加方法
        /// </summary>
        /// <param name="newFunction">需要添加的方法</param>
        public FunctionEditModel Add(FunctionEditModel newFunction)
        {

            try
            {
                if (CheckCodeExists(newFunction.FunctionCode))
                {
                    throw new FaultException<LCFault>(new LCFault("方法添加失败"), "该方法编号已存在,不能重复添加");
                }
                Repository<SysFunction> sysFunctionEiditModelDal = _unitOfWork.GetRepository<SysFunction>();

                SysFunction sysFunction = new SysFunction();
                sysFunction.FunctionCode = newFunction.FunctionCode;
                sysFunction.Name = newFunction.Name;
                sysFunction.Remark = newFunction.Remark;
                sysFunction.Type = newFunction.Type;
                sysFunction.Assembly = newFunction.Assembly;
                sysFunction.ClassName = newFunction.ClassName;
                sysFunction.OperationCode = newFunction.OperationCode;
                sysFunction.OperationName = newFunction.OperationName;
                sysFunction.Params = newFunction.Params;
                sysFunction.ModuleCode = newFunction.ModuleCode;

                _unitOfWork.AddAction(sysFunction, DataActions.Add);
                _unitOfWork.Save();

                return newFunction;
            }
            catch (RepositoryException rex)
            {
                string msg = rex.Message;
                string reason = rex.StackTrace;
                throw new FaultException<LCFault>
                (new LCFault(msg), reason);
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                string reason = ex.StackTrace;
                throw new FaultException<LCFault>
                (new LCFault(msg), reason);
            }
        }
Exemple #25
0
        /// <summary>
        /// 更新用户对象
        /// </summary>
        /// <param name="newUserModel">需要更新的用户领域对象</param>
        public UserEditModel Update(UserEditModel newUserModel)
        {
            try
            {
                Repository<SysUser> sysUserDal = _unitOfWork.GetRepository<SysUser>();
                SysUser sysUser = sysUserDal.GetObjectByKey(newUserModel.UserCode).Entity;
                if (sysUser != null)
                {
                    sysUser.Birthday = newUserModel.Birthday;
                    sysUser.Email = newUserModel.Email;
                    sysUser.IsLeader = newUserModel.IsLeader;
                    sysUser.LoginName = newUserModel.LoginName;
                    sysUser.Mobile = newUserModel.Mobile;
                    sysUser.Name = newUserModel.Name;
                    sysUser.NeedChangePassword = newUserModel.NeedChangePassword;
                    sysUser.OfficialPhone = newUserModel.OfficialPhone;
                    sysUser.Password = newUserModel.Password;
                    sysUser.Position = newUserModel.Position;
                    sysUser.Remark = newUserModel.Remark;
                    sysUser.Sex = newUserModel.Sex;
                    sysUser.Stopped = newUserModel.Stopped;
                }
                _unitOfWork.AddAction(sysUser, DataActions.Update);
                _unitOfWork.Save();

                return newUserModel;
            }
            catch (RepositoryException rex)
            {
                string msg = rex.Message;
                string reason = rex.StackTrace;
                throw new FaultException<LCFault>
                (new LCFault(msg), reason);
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                string reason = ex.StackTrace;
                throw new FaultException<LCFault>
                (new LCFault(msg), reason);
            }
        }
Exemple #26
0
        public void UpdateDayDefaultWarehouse(List <DayDefaultWarehouse> dayDefaultWarehouseList, DateTime selectDate, int inoutType)
        {
            try
            {
                IEnumerable <DayDefaultWarehouse> oldDefaultWarehouse = _dayDefaultWarehouseDal.Find(rm => rm.default_day == selectDate && rm.inout_type == inoutType).Entities;

                if (oldDefaultWarehouse != null)
                {
                    foreach (DayDefaultWarehouse dayDefaultWarehouse in dayDefaultWarehouseList)
                    {
                        //查找选择的仓库是否已经存在
                        if (!oldDefaultWarehouse.Any(d => d.default_warehouse == dayDefaultWarehouse.default_warehouse))
                        {
                            _unitOfWork.AddAction(dayDefaultWarehouse, DataActions.Add);
                        }
                    }
                }
                else
                {
                    foreach (DayDefaultWarehouse dayDefaultWarehouse in dayDefaultWarehouseList)
                    {
                        _unitOfWork.AddAction(dayDefaultWarehouse, DataActions.Add);
                    }
                }

                //查找之前选择的仓库是否已删除
                if (oldDefaultWarehouse != null)
                {
                    //原有单头所含明细不为空,则需要判断是否有删除项
                    foreach (DayDefaultWarehouse dayDefaultWarehouse in oldDefaultWarehouse.Where(x => !dayDefaultWarehouseList.Any(u => u.default_warehouse == x.default_warehouse && u.default_day == x.default_day)).ToList())
                    {
                        _unitOfWork.AddAction(dayDefaultWarehouse, DataActions.Delete);
                    }
                }
                _unitOfWork.Save();
            }
            catch (RepositoryException ex)
            {
                throw new AisinoMesServiceException("配置选择日默认入库仓失败!", ex);
            }
        }
Exemple #27
0
        public void UpdateBorGroupDetail(int borGroupId, List <BorGroupDetail> lstBorGroupDetail)
        {
            try
            {
                List <BorGroupDetail> oldBorGroupDetail = _borGroupDetailDal.Find(rm => rm.bor_group_id == borGroupId).Entities.ToList();

                if (oldBorGroupDetail != null && oldBorGroupDetail.Count > 0)
                {
                    foreach (BorGroupDetail borGroupDetail in lstBorGroupDetail)
                    {
                        //查找选择的货品是否已存在
                        if (!oldBorGroupDetail.Any(d => d.bor_group_id == borGroupDetail.bor_group_id && d.goods_kind == borGroupDetail.goods_kind))
                        {
                            _unitOfWork.AddAction(borGroupDetail, DataActions.Add);
                        }
                    }
                }
                else
                {
                    foreach (BorGroupDetail borGroupDetail in lstBorGroupDetail)
                    {
                        _unitOfWork.AddAction(borGroupDetail, DataActions.Add);
                    }
                }

                //查找之前选择的货品是否已删除
                if (oldBorGroupDetail != null)
                {
                    //原有品号组所含货品不为空,则需要判断是否有删除项
                    foreach (BorGroupDetail borGroupDetailRemove in oldBorGroupDetail.Where(x => !lstBorGroupDetail.Any(u => u.bor_group_id == x.bor_group_id && u.goods_kind == x.goods_kind)).ToList())
                    {
                        _unitOfWork.AddAction(borGroupDetailRemove, DataActions.Delete);
                    }
                }
                _unitOfWork.Save();
            }
            catch (RepositoryException ex)
            {
                throw new AisinoMesServiceException("更改品号组所含货品失败!", ex);
            }
        }
Exemple #28
0
 private void DelSubWarehInvcls(WarehouseInvcls delWarehInvcls)
 {
     if (delWarehInvcls.SubWarehouseInvcls != null)
     {
         foreach (WarehouseInvcls invcls in delWarehInvcls.SubWarehouseInvcls)
         {
             DelSubWarehInvcls(invcls);
         }
     }
     delWarehInvcls.invcls_deleted = true;
     _unitOfWork.AddAction(delWarehInvcls, DataActions.Update);
 }
Exemple #29
0
        public PlanTaskBatchAdjust AddPlantaskAdjustWithWarehouseInfor(PlanTaskBatchAdjust newplanAdjust, string OrgDepCode)
        {
            PlanTaskBatchAdjust rtnplantaskbatchAdjust = null;

            try
            {
                _unitOfWork.Actions.Clear();
                int billId = _sysBillNoService.GetBillNoID("MAN", "PAN");
                newplanAdjust.plantask_batch_adjust_number = _sysBillNoService.GetBillNo(billId, OrgDepCode);
                newplanAdjust.adjust_time = _sPGetSysDateTimeService.GetSysDateTime();
                _unitOfWork.AddAction(newplanAdjust, DataActions.Add);

                //_warehouseStoreInfoService.UpdateWarehouseStoreInfoWithPlanTaskBatchAdjust(newplanAdjust);
                _unitOfWork.Save();
            }
            catch (RepositoryException ex)
            {
                throw ex;
            }
            return(rtnplantaskbatchAdjust);
        }
Exemple #30
0
        public BorSection DeleteBorSection(BorSection delBorSection)
        {
            BorSection borSection = null;

            try
            {
                delBorSection.bor_section_deleted = true;
                _unitOfWork.AddAction(delBorSection, DataActions.Update);
                borSection = delBorSection;
                //删除路线工段表中对应的工段记录
                List <BorLineSection> borLineSectionLst = _borLineSectionDal.Find(d => d.bor_section_id == delBorSection.id).Entities.ToList();
                foreach (BorLineSection borLineSection in borLineSectionLst)
                {
                    _unitOfWork.AddAction(borLineSection, DataActions.Delete);
                }

                //删除工段设备表中对应的工段记录
                List <BorSectionEquipment> borSectionEquipmentLst = _borSectionEquipmentDal.Find(d => d.bor_section_id == delBorSection.id).Entities.ToList();
                foreach (BorSectionEquipment borSectionEquipment in borSectionEquipmentLst)
                {
                    _unitOfWork.AddAction(borSectionEquipment, DataActions.Delete);
                }
                _unitOfWork.Save();
            }
            catch (RepositoryException ex)
            {
                throw new AisinoMesServiceException("删除工段信息失败!", ex);
            }
            return(borSection);
        }