コード例 #1
0
 /// <summary>
 /// Updates the RawMaterialQC record in the database that is represented by the RawMaterialQCModel.
 /// </summary>
 /// <param name="model">The RawMaterialQCModel representing the RawMaterialQC record.</param>
 public void UpdateRawMaterialQCModel(TPO.Model.RawMaterials.RawMaterialQCModel model)
 {
     using (RawMaterialsRepository repo = new RawMaterialsRepository())
     {
         TPO.DL.Models.RawMaterialQC entity = repo.GetRawMaterialQCByID(model.ID);
         if (entity != null)
         {
             entity = Bind(model, entity);
             repo.SaveChanges();
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Gets a RawMaterialQCModel representing the RawMaterialQC record indicated by the provided ID.
        /// The RawMaterialQCModel returns also includes configuration data for the various test available.
        /// </summary>
        /// <param name="id">The ID of the RawMaterialQC record in the database.</param>
        /// <returns>A RawMaterialQCModel</returns>
        public RawMaterialQCModel GetRawMaterialQCModelByRawMaterialQCID(int id)
        {
            RawMaterialQCModel model = null;

            using (RawMaterialsRepository repo = new RawMaterialsRepository())
            {
                TPO.DL.Models.RawMaterialQC entity = repo.GetRawMaterialQCByID(id);
                if (entity != null)
                {
                    model = Bind(entity, new RawMaterialQCModel());
                    RawMaterialTest testBL   = new RawMaterialTest();
                    Int32           rawMatID = 0;

                    TPO.DL.Models.RawMaterialReceived rawMaterialReceived =
                        new TPOMVCApplicationEntities().RawMaterialReceiveds.Where(w => w.ID == model.RawMaterialReceivedID).First();

                    model.QCConfiguration = testBL.GetQCConfigurationByRawMaterial(rawMaterialReceived.RawMaterial.ID);
                }
            }

            return(model);
        }