public static ResponseModel AddRoutingWithMaterialFile(RoutingWithMaterialFileModel m, ref int _newID)
 {
     ACTION = "AddRoutingWithMaterialFile(RoutingWithMaterialFileModel)";
     try
     {
         _newID = 0;
         ResponseModel res = RoutingWithMaterialFileDAL.AddRoutingWithMaterialFile(m, ref _newID);
         return(new ResponseModel()
         {
             Action = ACTION,
             Source = SOURCE,
             Message = res.Message,
             Status = res.Status
         });
     }
     catch (Exception ex)
     {
         return(new ResponseModel()
         {
             Action = ACTION,
             Source = SOURCE,
             Message = ex.Message,
             Status = false
         });
     }
 }
Esempio n. 2
0
        internal static USR_TMMA_ROUTING_WITH_MATERIAL_FILE Mapping(RoutingWithMaterialFileModel o)
        {
            try
            {
                if (o != null)
                {
                    return(new USR_TMMA_ROUTING_WITH_MATERIAL_FILE()
                    {
                        RoutingWithMaterialFileID = o.RoutingWithMaterialFileID,
                        RecObjectName = o.RecObjectName,
                        UserSAP = o.UserSAP,
                        RoutingWithMaterialFilePath = o.RoutingWithMaterialFilePath,
                        RoutingWithMaterialFileVersion = o.RoutingWithMaterialFileVersion,
                        RoutingWithMaterialFileStatus = o.RoutingWithMaterialFileStatus,
                        ProductsTypeID = o.ProductsTypeID,
                        IsActive = o.IsActive ? 1 : 0,
                        CreatedBy = o.CreatedBy,
                        CreatedDate = o.CreatedDate,
                        UpdatedBy = o.UpdatedBy,
                        UpdatedDate = o.UpdatedDate
                    });
                }

                return(null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        public static RoutingWithMaterialFileModel GetRoutingWithMaterialFile(int routingWithMaterialFileID)
        {
            ACTION = "GetRoutingWithMaterialFile(routingWithMaterialFileID)";

            try
            {
                using (UTMMABCDBEntities context = new UTMMABCDBEntities())
                {
                    USR_TMMA_ROUTING_WITH_MATERIAL_FILE obj = context.USR_TMMA_ROUTING_WITH_MATERIAL_FILE.Where(o => o.RoutingWithMaterialFileID == routingWithMaterialFileID).FirstOrDefault();
                    RoutingWithMaterialFileModel        m   = Mapping(obj);
                    return(m);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 4
0
        public static RoutingWithMaterialFileModel GetRoutingWithMaterialFileLastVersion(int ProductsTypeID)
        {
            ACTION = "GetRoutingWithMaterialFileLastVersion()";
            try
            {
                using (UTMMABCDBEntities context = new UTMMABCDBEntities())
                {
                    var list = context.USR_TMMA_ROUTING_WITH_MATERIAL_FILE.Where(a => a.ProductsTypeID == ProductsTypeID).ToList();
                    var o    = list.Last();
                    RoutingWithMaterialFileModel m = Mapping(o);

                    return(m);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 5
0
 public ResponseModel AddRoutingWithMaterialFile(RoutingWithMaterialFileModel m, ref int _newID)
 {
     return(RoutingWithMaterialFileBLL.AddRoutingWithMaterialFile(m, ref _newID));
 }
Esempio n. 6
0
        public static ResponseModel AddRoutingWithMaterialFile(RoutingWithMaterialFileModel m, ref int _newID)
        {
            string action = "AddRoutingWithMaterialFile(RoutingWithMaterialFileModel, out _newID)";

            _newID = 0;
            try
            {
                if (m != null)
                {
                    using (UTMMABCDBEntities context = new UTMMABCDBEntities())
                    {
                        USR_TMMA_ROUTING_WITH_MATERIAL_FILE _obj = Mapping(m);

                        context.USR_TMMA_ROUTING_WITH_MATERIAL_FILE.Add(_obj);

                        if (context.SaveChanges() > 0)
                        {
                            _newID = _obj.RoutingWithMaterialFileID;

                            return(new ResponseModel()
                            {
                                Source = SOURCE,
                                Action = action,
                                Status = true,
                                Message = "Success"
                            });
                        }

                        return(new ResponseModel()
                        {
                            Source = SOURCE,
                            Action = action,
                            Status = false,
                            Message = "Fail"
                        });
                    }
                }

                return(new ResponseModel()
                {
                    Source = SOURCE,
                    Action = action,
                    Status = false,
                    Message = "Null"
                });
            }
            catch (DbEntityValidationException ex)
            {
                return(new ResponseModel()
                {
                    Source = SOURCE,
                    Action = action,
                    Status = false,
                    Message = ex.Message,
                    StackTrace = ex.StackTrace
                });
            }
            catch (Exception ex)
            {
                return(new ResponseModel()
                {
                    Source = SOURCE,
                    Action = action,
                    Status = false,
                    Message = ex.Message,
                    StackTrace = ex.StackTrace
                });
            }
        }