Exemplo n.º 1
0
        public static ResponseModel UpdateStatusBOMFile(int BOMFileID, int BOMFileStatus)
        {
            string action = "UpdateStatusBOMFile(BOMFileModel)";

            try
            {
                using (UTMMABCDBEntities context = new UTMMABCDBEntities())
                {
                    USR_TMMA_BOM_FILE _obj = context.USR_TMMA_BOM_FILE.FirstOrDefault(o => o.BOMFileID == BOMFileID);


                    if (_obj != null)
                    {
                        _obj.BOMFileStatus = BOMFileStatus;
                        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
                });
            }
        }
Exemplo n.º 2
0
        public static ResponseModel UpdateStatusAssignMaterialToRoutingFile(int AssignMaterialToRoutingFileID, int AssignMaterialToRoutingFileStatus)
        {
            string action = "UpdateStatusAssignMaterialToRoutingFile(AssignMaterialToRoutingFileID, AssignMaterialToRoutingFileStatus)";

            try
            {
                using (UTMMABCDBEntities context = new UTMMABCDBEntities())
                {
                    USR_TMMA_ASSIGN_MATERIAL_TO_ROUTING_FILE _obj = context.USR_TMMA_ASSIGN_MATERIAL_TO_ROUTING_FILE.FirstOrDefault(o => o.AssignMaterialToRoutingFileID == AssignMaterialToRoutingFileID);


                    if (_obj != null)
                    {
                        _obj.AssignMaterialToRoutingFileStatus = AssignMaterialToRoutingFileStatus;
                        context.SaveChanges();
                        return(new ResponseModel()
                        {
                            Source = SOURCE,
                            Action = action,
                            Status = true,
                            Message = "Success"
                        });
                    }
                    return(new ResponseModel()
                    {
                        Source = SOURCE,
                        Action = action,
                        Status = false,
                        Message = "AssignMaterialToRoutingFileID 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
                });
            }
        }
Exemplo n.º 3
0
        public static ResponseModel AddBOMFile(BOMFileModel m, ref int _newID)
        {
            string action = "AddBOMFile(BOMFileModel, out _newID)";

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

                        context.USR_TMMA_BOM_FILE.Add(_obj);

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

                            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
                });
            }
        }
Exemplo n.º 4
0
        public static ResponseModel AddUser(UserModel user)
        {
            string action = "AddUser(UserModel)";

            try
            {
                if (user != null)
                {
                    using (UTMMABCDBEntities context = new UTMMABCDBEntities())
                    {
                        USR_TMMA_USER _obj = Mapping(user);

                        context.USR_TMMA_USER.Add(_obj);

                        if (context.SaveChanges() > 0)
                        {
                            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
                });
            }
        }