示例#1
0
        // Internal constructor
        internal Material(ShaderLayout layout, ShaderProgram program, MaterialInput input, MaterialOutput output)
        {
            // Assign objects
            Layout  = layout;
            Program = program;
            Layout.IncRefCount();
            Program.IncRefCount();
            Input  = input;
            Output = output;

            // Validate vertex inputs
            if (input.Vertices.Count > 0)
            {
                uint vmask = 0;
                foreach (var vd in input.Vertices)
                {
                    if ((vmask & vd.LocationMask) != 0)
                    {
                        throw new ArgumentException("Duplicate vertex location in descriptions", nameof(input));
                    }
                    vmask |= vd.LocationMask;
                }
                if (vmask != Layout.VertexLocationMask)
                {
                    throw new ArgumentException(
                              $"Missing vertex location in material descriptions ({vmask:X8} != {Layout.VertexLocationMask:X8})",
                              nameof(input));
                }
            }

            // Validate outputs
            if (output.BlendStates.Count != layout.FragmentOutputs.Count)
            {
                throw new ArgumentException("Output count mismatch", nameof(output));
            }
        }
示例#2
0
        public void Delete(string mn, string p, string userId)
        {
            var existingData = _repository.GetByID(mn, p);

            //existingData.CHANGED_BY = userId;
            //existingData.CHANGED_DATE = DateTime.Now;
            _repository.Update(existingData);

            var changes = new CHANGES_HISTORY
            {
                FORM_TYPE_ID  = Core.Enums.MenuList.MaterialMaster,
                FORM_ID       = existingData.STICKER_CODE,
                FIELD_NAME    = "IS_DELETED",
                MODIFIED_BY   = userId,
                MODIFIED_DATE = DateTime.Now,
                NEW_VALUE     = true.ToString()
            };

            _changesHistoryBll.AddHistory(changes);

            var output = new MaterialOutput();

            try
            {
                _uow.SaveChanges();
                output.Success    = true;
                output.materialId = existingData.STICKER_CODE;
            }
            catch (Exception exception)
            {
                _logger.Error(exception);
                output.Success      = false;
                output.ErrorCode    = ExceptionCodes.BaseExceptions.unhandled_exception.ToString();
                output.ErrorMessage = EnumHelper.GetDescription(ExceptionCodes.BaseExceptions.unhandled_exception);
            }
        }
示例#3
0
 /// <summary>
 /// Describes a new material from a shader program and a specific set of vertex descriptions.
 /// </summary>
 /// <param name="shader">The shader program to process the material with.</param>
 /// <param name="input">The vertex input topology for the material.</param>
 public Material(Shader shader, MaterialInput input, MaterialOutput output)
     : this(shader.Layout, shader.Program, input, output)
 {
 }
示例#4
0
        public MaterialOutput Save(MaterialDto data, string userId)
        {
            bool isNew     = false;
            var  origin    = _repository.Get(x => x.STICKER_CODE == data.STICKER_CODE && x.WERKS == data.WERKS, null, includeTables).SingleOrDefault();
            var  originDto = AutoMapper.Mapper.Map <MaterialDto>(origin);

            bool isApprovalExist;
            //var edited = AutoMapper.Mapper.Map<ZAIDM_EX_MATERIAL>(model);
            //AutoMapper.Mapper.Map(model, data);
            MASTER_DATA_APPROVAL approvalData = new MASTER_DATA_APPROVAL();

            if (originDto != null)
            {
                data.MODIFIED_BY   = userId;
                data.MODIFIED_DATE = DateTime.Now;
                data.CREATED_DATE  = origin.CREATED_DATE;
                data.CREATED_BY    = origin.CREATED_BY;

                //data.MATERIAL_UOM = origin.MATERIAL_UOM;

                data = _masterDataAprovalBLL.MasterDataApprovalValidation((int)Enums.MenuList.MaterialMaster, userId, originDto,
                                                                          data, out isApprovalExist, out approvalData);
                var tempNewData = AutoMapper.Mapper.Map <ZAIDM_EX_MATERIAL>(data);
                data = AutoMapper.Mapper.Map <MaterialDto>(tempNewData);

                if (data.CLIENT_DELETION != (originDto.CLIENT_DELETION.HasValue ? originDto.CLIENT_DELETION : false))
                {
                    _zaidmExMaterialService.ClientDeletion(data, userId);
                }

                if (data.PLANT_DELETION != (originDto.PLANT_DELETION.HasValue ? originDto.PLANT_DELETION.Value : false))
                {
                    _zaidmExMaterialService.PlantDeletion(data, userId);
                }

                SetChanges(originDto, data, userId);
            }
            else
            {
                data.CREATED_BY      = userId;
                data.CREATED_DATE    = DateTime.Now;
                data.CLIENT_DELETION = false;
                data.PLANT_DELETION  = false;
                isNew = true;
            }

            var dataToSave = AutoMapper.Mapper.Map <ZAIDM_EX_MATERIAL>(data);

            var output = new MaterialOutput();

            try
            {
                if (!isNew)
                {
                    //foreach (var matUom1 in dataToSave.MATERIAL_UOM)
                    //{

                    //    var materialUom = _repositoryUoM.Get(x => x.STICKER_CODE == matUom1.STICKER_CODE
                    //                                              && x.WERKS == matUom1.WERKS
                    //                                              && x.MEINH == matUom1.MEINH).FirstOrDefault();
                    //    _repositoryUoM.Detach(materialUom);
                    //    //if (materialUom != null && materialUom)
                    //    //{
                    //    //    matUom1.MATERIAL_UOM_ID = materialUom.MATERIAL_UOM_ID;
                    //    //}
                    //}
                    dataToSave.MATERIAL_UOM = null;

                    _repository.InsertOrUpdate(dataToSave);

                    _uow.SaveChanges();
                }
                else
                {
                    _masterDataAprovalBLL.MasterDataApprovalValidation((int)Enums.MenuList.MaterialMaster, userId,
                                                                       new MaterialDto(), data, out isApprovalExist, out approvalData, true);
                }
                _masterDataAprovalBLL.SendEmailWorkflow(approvalData.APPROVAL_ID);
                output.Success    = true;
                output.materialId = data.STICKER_CODE;
            }
            catch (BLLException ex)
            {
                _logger.Error(ex);
                output.Success      = false;
                output.ErrorCode    = ex.Code;
                output.ErrorMessage = ex.Message;
            }
            catch (Exception exception)
            {
                _logger.Error(exception);
                output.Success      = false;
                output.ErrorCode    = ExceptionCodes.BaseExceptions.unhandled_exception.ToString();
                output.ErrorMessage = EnumHelper.GetDescription(ExceptionCodes.BaseExceptions.unhandled_exception);
            }

            return(output);
        }