Пример #1
0
        internal static RoutingFileModel Mapping(USR_TMMA_ROUTING_FILE o)
        {
            try
            {
                if (o != null)
                {
                    return(new RoutingFileModel()
                    {
                        RoutingFileID = o.RoutingFileID,
                        RecObjectName = o.RecObjectName,
                        UserSAP = o.UserSAP,
                        RoutingFilePath = o.RoutingFilePath,
                        RoutingFileVersion = o.RoutingFileVersion,
                        RoutingFileStatus = o.RoutingFileStatus,
                        ProductsTypeID = o.ProductsTypeID,
                        FileStatus = FileStatusDAL.GetFileStatus(o.RoutingFileStatus),
                        IsActive = o.IsActive == 1,
                        CreatedBy = o.CreatedBy,
                        CreatedDate = o.CreatedDate,
                        UpdatedBy = o.UpdatedBy,
                        UpdatedDate = o.UpdatedDate,
                        ValidDate = o.ValidDate
                    });
                }

                return(null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        public static ResponseModel UpdateStatusRoutingFile(int RoutingFileID, int RoutingFileStatus)
        {
            string action = "UpdateStatusRoutingFile(RoutingFileID, RoutingFileStatus)";

            try
            {
                using (UTMMABCDBEntities context = new UTMMABCDBEntities())
                {
                    USR_TMMA_ROUTING_FILE _obj = context.USR_TMMA_ROUTING_FILE.FirstOrDefault(o => o.RoutingFileID == RoutingFileID);


                    if (_obj != null)
                    {
                        _obj.RoutingFileStatus = RoutingFileStatus;
                        context.SaveChanges();
                        return(new ResponseModel()
                        {
                            Source = SOURCE,
                            Action = action,
                            Status = true,
                            Message = "Success"
                        });
                    }
                    return(new ResponseModel()
                    {
                        Source = SOURCE,
                        Action = action,
                        Status = false,
                        Message = "BOMFileID Not Exist"
                    });
                }
            }
            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
                });
            }
        }
Пример #3
0
        public static RoutingFileModel GetRoutingFile(int routingFileID)
        {
            ACTION = "GetRoutingFile(routingFileID)";

            try
            {
                using (UTMMABCDBEntities context = new UTMMABCDBEntities())
                {
                    USR_TMMA_ROUTING_FILE obj = context.USR_TMMA_ROUTING_FILE.Where(o => o.RoutingFileID == routingFileID).FirstOrDefault();
                    RoutingFileModel      m   = Mapping(obj);
                    return(m);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #4
0
        public static ResponseModel AddRoutingFile(RoutingFileModel m, ref int _newID)
        {
            ACTION = "AddRoutingFile(RoutingFileModel, out _newID)";
            _newID = 0;
            try
            {
                if (m != null)
                {
                    using (UTMMABCDBEntities context = new UTMMABCDBEntities())
                    {
                        USR_TMMA_ROUTING_FILE _obj = Mapping(m);

                        context.USR_TMMA_ROUTING_FILE.Add(_obj);

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

                            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
                });
            }
        }