Esempio n. 1
0
            /// <summary>
            /// Insert FileManager
            /// </summary>
            /// <param name="data">FileManger Information</param>
            /// <returns></returns>
            public static Tuple <ErrorObject, int> FileManager(tblFileManager data)
            {
                erros = new ErrorObject();
                try
                {
                    using (EileenGaldamezEntities db = new EileenGaldamezEntities())
                    {
                        int propertyFind = db.tblFileManager.Count();
                        if (propertyFind > 0)
                        {
                            data.id = db.tblFileManager.Max(s => s.id);
                        }
                        else
                        {
                            data.id = 1;
                        }
                        db.tblFileManager.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));
                }
            }
Esempio n. 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 GetFileManagerResponse FileManager(GetFileManagerResponse request)
            {
                GetFileManagerResponse response = new GetFileManagerResponse();

                response.Error = new Handler.ErrorObject();

                try
                {
                    tblFileManager bussines = new tblFileManager()
                    {
                        id         = request.FileManager.id,
                        fileFile   = request.FileManager.fileFile,
                        fileName   = request.FileManager.fileName,
                        fileSize   = request.FileManager.fileSize,
                        fileType   = request.FileManager.fileType,
                        fileDetail = request.FileManager.fileDetail,
                        createDate = DateTime.Now,
                        upDateDate = null,
                        deleteDate = null,
                        state      = "Active"
                    };

                    var result = FileManagerData.Insert.FileManager(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);
            }