Example #1
0
            /// <summary>
            /// Insert Prodcuto File Manager Information
            /// </summary>
            /// <param name="data">Product FileManager INformaation</param>
            /// <returns>Product File Manager ID</returns>
            public static Tuple <ErrorObject, int> ProductFileManager(tblProductFileManager data)
            {
                erros = new ErrorObject();
                try
                {
                    using (EileenGaldamezEntities db = new EileenGaldamezEntities())
                    {
                        int propertyFind = db.tblProductFileManager.Count();
                        if (propertyFind > 0)
                        {
                            data.id = db.tblProductFileManager.Max(s => s.id);
                        }
                        else
                        {
                            data.id = 1;
                        }
                        db.tblProductFileManager.Add(data);
                        result = db.SaveChanges();

                        if (result > 0)
                        {
                            return(new Tuple <ErrorObject, int>(erros.IfError(false), data.id));
                        }
                        else
                        {
                            return(new Tuple <ErrorObject, int>(erros.IfError(false), result));
                        }
                    }
                }
                catch (Exception ex)
                {
                    erros.InfoError(ex);
                    return(new Tuple <ErrorObject, int>(erros, 0));
                }
            }
Example #2
0
            /// <summary>
            /// Return Affected Row Or Error If Exist
            /// </summary>
            /// <param name="request">Employee Information</param>
            /// <returns>Affected Row Or Error If Exist</returns>
            public static GetProductFileManagerResponse ProductFileManager(GetProductFileManagerResponse request)
            {
                GetProductFileManagerResponse response = new GetProductFileManagerResponse();

                response.Error = new Handler.ErrorObject();

                try
                {
                    tblProductFileManager bussines = new tblProductFileManager()
                    {
                        idFileManager = request.ProductFileManager.idFileManager,
                        idProduct     = request.ProductFileManager.idProduct,
                        createDate    = DateTime.Now,
                        upDateDate    = null,
                        deleteDate    = null,
                        state         = "Active"
                    };

                    var result = ProductFileManagerData.Insert.ProductFileManager(bussines);
                    if (result.Item1.Error)
                    {
                        response.Error.InfoError(result.Item1);
                    }
                    else
                    {
                        response.Message = result.Item2.ToString();
                    }
                }
                catch (Exception ex)
                {
                    response.Error.InfoError(ex);
                }

                return(response);
            }