Ejemplo n.º 1
0
        public int AuditingNoAgree(int AppCode)
        {
            int num = 0;

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                connection.Open();
                SqlTransaction transaction = connection.BeginTransaction();
                try
                {
                    try
                    {
                        num = new DocumentFileBLL().UpdateAuditingNoAgree(AppCode, transaction);
                        transaction.Commit();
                    }
                    catch (SqlException exception)
                    {
                        transaction.Rollback();
                        connection.Close();
                        throw exception;
                    }
                    return(num);
                }
                finally
                {
                    connection.Close();
                }
            }
            return(num);
        }
Ejemplo n.º 2
0
        public int Insert(DocumentFileModel ObjModel)
        {
            int num = 0;

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                connection.Open();
                SqlTransaction transaction = connection.BeginTransaction();
                try
                {
                    try
                    {
                        num = new DocumentFileBLL().Insert(ObjModel, transaction);
                        transaction.Commit();
                    }
                    catch (SqlException exception)
                    {
                        transaction.Rollback();
                        connection.Close();
                        throw exception;
                    }
                    return(num);
                }
                finally
                {
                    connection.Close();
                }
            }
            return(num);
        }
Ejemplo n.º 3
0
        public List <DocumentFileModel> GetDocumentFileList(string SortColumns, int StartRecord, int MaxRecords, int CodeEqual, string OperationTypeEqual, string ApplyUserCodeEqual, string ApplyDepartmentCodeEqual, DateTime ApplyDateTimeEqual, string FileCodeEqual, int FileTemplateCodeEqual, string FileTemplateCodeStrEqual, string SubjectEqual, string ContentEqual, string RemarkEqual, string ArchiveTypeEqual, string ArchiveStateEqual, DateTime ArchiveDatetimeEqual, string AuditingStateEqual, DateTime AuditingDatetimeEqual, DateTime CreateDateEqual, string CreateUserCodeEqual, DateTime LastModifyDatetimeEqual, string LastModifyByUserCodeEqual, string DeleteFlagEqual, int CountsEqual, int LeavesEqual)
        {
            List <DocumentFileModel> models        = new List <DocumentFileModel>();
            DocumentFileQueryModel   objQueryModel = new DocumentFileQueryModel();

            objQueryModel.StartRecord               = StartRecord;
            objQueryModel.MaxRecords                = MaxRecords;
            objQueryModel.SortColumns               = SortColumns;
            objQueryModel.CodeEqual                 = CodeEqual;
            objQueryModel.OperationTypeEqual        = OperationTypeEqual;
            objQueryModel.ApplyUserCodeEqual        = ApplyUserCodeEqual;
            objQueryModel.ApplyDepartmentCodeEqual  = ApplyDepartmentCodeEqual;
            objQueryModel.ApplyDateTimeEqual        = ApplyDateTimeEqual;
            objQueryModel.FileCodeEqul              = FileCodeEqual;
            objQueryModel.FileTemplateCodeEqual     = FileTemplateCodeEqual;
            objQueryModel.FileTemplateCodeIn        = FileTemplateCodeStrEqual;
            objQueryModel.SubjectEqual              = SubjectEqual;
            objQueryModel.ContentEqual              = ContentEqual;
            objQueryModel.RemarkEqual               = RemarkEqual;
            objQueryModel.ArchiveTypeEqual          = ArchiveTypeEqual;
            objQueryModel.ArchiveStateEqual         = ArchiveStateEqual;
            objQueryModel.AuditingStateEqual        = AuditingStateEqual;
            objQueryModel.AuditingDatetimeEqual     = AuditingDatetimeEqual;
            objQueryModel.CreateDateEqual           = CreateDateEqual;
            objQueryModel.CreateUserCodeEqual       = CreateUserCodeEqual;
            objQueryModel.LastModifyDatetimeEqual   = LastModifyDatetimeEqual;
            objQueryModel.LastModifyByUserCodeEqual = LastModifyByUserCodeEqual;
            objQueryModel.DeleteFlagEqual           = DeleteFlagEqual;
            objQueryModel.CountsEqual               = CountsEqual;
            objQueryModel.LeavesEqual               = LeavesEqual;
            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    models = new DocumentFileBLL().GetModels(objQueryModel, connection);
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(models);
        }
Ejemplo n.º 4
0
        public DocumentFileModel GetDocumentFile(int Code)
        {
            DocumentFileModel model = new DocumentFileModel();

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    model = new DocumentFileBLL().GetModel(Code, connection);
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(model);
        }
Ejemplo n.º 5
0
        public List <DocumentFileModel> GetDocumentFileListOne(int Code)
        {
            List <DocumentFileModel> list = new List <DocumentFileModel>();

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    DocumentFileBLL ebll = new DocumentFileBLL();
                    list.Add(ebll.GetModel(Code, connection));
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(list);
        }
Ejemplo n.º 6
0
        public List <DocumentFileModel> GetDocumentFileList(DocumentFileQueryModel QueryModel)
        {
            List <DocumentFileModel> models = new List <DocumentFileModel>();

            using (SqlConnection connection = new SqlConnection(FunctionRule.GetConnectionString()))
            {
                try
                {
                    connection.Open();
                    if (QueryModel == null)
                    {
                        QueryModel = new DocumentFileQueryModel();
                    }
                    models = new DocumentFileBLL().GetModels(QueryModel, connection);
                    connection.Close();
                }
                catch (SqlException exception)
                {
                    throw exception;
                }
            }
            return(models);
        }
Ejemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string ImageR    = Request.QueryString["ID"];
        string widthR    = Request.QueryString["W"];
        string heightR   = Request.QueryString["H"];
        string imageName = "";
        int    width     = 0;
        int    height    = 0;
        int    Image     = 0;

        if (string.IsNullOrEmpty(ImageR) || string.IsNullOrEmpty(widthR) || string.IsNullOrEmpty(heightR))
        {
            return;
        }

        try
        {
            width  = Convert.ToInt32(widthR);
            height = Convert.ToInt32(heightR);
            Image  = Convert.ToInt32(ImageR);
        }
        catch (Exception exc)
        {
            log.Error("Ocurrió un error al obtener los datos enviados para el ResizeImage. " + exc);
        }

        if (width == 0 || height == 0)
        {
            return;
        }

        int widthWM  = (int)(width / 3);
        int heightWM = (int)(height / 3);

        Bitmap bmp = null;

        if (string.IsNullOrEmpty(ImageR))
        {
            System.Drawing.Image imgDefault = System.Drawing.Image.FromFile(Server.MapPath("~/Images/Home.png"));
            imageName = "Magri_Turismo";
            bmp       = new Bitmap(imgDefault);
        }
        else
        {
            DocumentFile theOfferImage = DocumentFileBLL.GetDocumentFile(Image);

            if (theOfferImage == null)
            {
                return;
            }

            string   pathImage = theOfferImage.FileStoragePath;
            FileInfo fileImage = new FileInfo(pathImage);

            if (fileImage.Exists)
            {
                imageName = theOfferImage.Name + theOfferImage.Extension;
                System.Drawing.Image img = System.Drawing.Image.FromFile(pathImage);
                if (img != null)
                {
                    bmp = ImageUtilities.CreateThumbnail(img, width, height);
                }
            }
        }

        if (bmp == null)
        {
            return;
        }

        //Bitmap bmpImage = ImageUtilities.CreateThumbnail(bmp, width, height);

        //if (bmpImage == null)
        //    return;

        decimal quality = Math.Max(0, Math.Min(100, ImageUtilities.getQuality(width, height)));

        ImageCodecInfo[]  Info   = ImageCodecInfo.GetImageEncoders();
        EncoderParameters Params = new EncoderParameters(1);

        Params.Param[0] = new EncoderParameter(Encoder.Quality, Convert.ToInt64(quality));

        int type = 1;

        if (ImageR.Equals("1"))
        {
            type = 4;
        }

        Response.ContentType = Info[type].MimeType;
        Response.AddHeader("Content-Disposition", "attachment;Filename=\"" + imageName + "\"");
        using (MemoryStream stream = new MemoryStream())
        {
            bmp.Save(stream, Info[type], Params);
            stream.WriteTo(Response.OutputStream);
        }
    }