public response GenerateImgThumbNails(ThumbNailSizes[] tSizes) { response toReturn = new response(true, "", null, null, new List <Error>()); foreach (ThumbNailSizes tSize in tSizes) { if (tSize.thumbNailType == ThumbNailType.Small) { this.SMALL_ICON = ThumbNails.GenerateImgThumbNail(this, tSize); } if (tSize.thumbNailType == ThumbNailType.Medium) { this.MEDIUM_ICON = ThumbNails.GenerateImgThumbNail(this, tSize); } } toReturn = this.Update(); return(toReturn); }
/// <summary> /// Metoda pentru stergerea Documentului scanat curent /// </summary> /// <returns>SOCISA.response = new object(bool = status, string = error message, int = id-ul cheie returnat)</returns> public response Delete() { DocumentScanat tmp = new DocumentScanat(authenticatedUserId, connectionString, Convert.ToInt32(this.ID)); response toReturn = new response(false, "", null, null, new List <Error>());; ArrayList _parameters = new ArrayList(); _parameters.Add(new MySqlParameter("_ID", this.ID)); DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "DOCUMENTE_SCANATEsp_soft_delete", _parameters.ToArray()); toReturn = da.ExecuteDeleteQuery(); /* * if (toReturn.Status && _deleteFile) * FileManager.DeleteFile(this.CALE_FISIER, this.DENUMIRE_FISIER, this.EXTENSIE_FISIER); */ if (toReturn.Status) { try { ThumbNails.DeleteThumbNail(tmp); tmp = null; } catch { } } if (toReturn.Status) { /* * try * { * if (System.Web.HttpContext.Current.Request.Params["SEND_MESSAGE"] != null && Convert.ToBoolean(System.Web.HttpContext.Current.Request.Params["SEND_MESSAGE"])) * Mesaje.GenerateAndSendMessage(this.ID, DateTime.Now, "Document sters", Convert.ToInt32(System.Web.HttpContext.Current.Session["AUTHENTICATED_ID"]), (int)Mesaje.Importanta.Low); * } * catch { } */ try { Dosar d = new Dosar(authenticatedUserId, connectionString, this.ID_DOSAR); d.UpdateCounterDocumente(-1); } catch (Exception exp) { LogWriter.Log(exp); } } return(toReturn); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); // Put user code to initialize the page here if (Context != null) { int?categoryId = SubtextContext.RequestContext.GetIdFromRequest(); ImageCollection ic = Repository.GetImagesByCategoryId(categoryId.Value, true /* activeOnly */); if (ic != null) { GalleryTitle.Text = ic.Category.Title; if (ic.Category.HasDescription) { Description.Text = string.Format(CultureInfo.InvariantCulture, "{0}", HttpUtility.HtmlEncode(ic.Category.Description)); } ThumbNails.DataSource = ic; ThumbNails.DataBind(); } } }
/// <summary> /// Metoda pentru modificarea Documentului scanat curent /// </summary> /// <returns>SOCISA.response = new object(bool = status, string = error message, int = id-ul cheie returnat)</returns> public response Update() { //try { if (this.DATA_INCARCARE == new DateTime() || this.DATA_INCARCARE == null) this.DATA_INCARCARE = GetFileCreationDate(); } try { if (this.DATA_INCARCARE == new DateTime() || this.DATA_INCARCARE == null) { this.DATA_INCARCARE = DateTime.Now; } } catch { } try { if ((this.FILE_CONTENT == null || this.DIMENSIUNE_FISIER == 0) && this.CALE_FISIER != null) { //this.FILE_CONTENT = FileManager.GetFileContentFromFile(this.CALE_FISIER); this.FILE_CONTENT = FileManager.UploadFile(this.CALE_FISIER); this.SMALL_ICON = (byte[])ThumbNails.GenerateByteThumbNail(this.CALE_FISIER, CommonFunctions.GetThumbNailSizes(ThumbNailType.Small)).Result; this.MEDIUM_ICON = (byte[])ThumbNails.GenerateByteThumbNail(this.CALE_FISIER, CommonFunctions.GetThumbNailSizes(ThumbNailType.Custom)).Result; this.DIMENSIUNE_FISIER = this.FILE_CONTENT.Length; this.EXTENSIE_FISIER = this.CALE_FISIER.Substring(this.CALE_FISIER.LastIndexOf('.')); //File.Delete(this.CALE_FISIER); } if (this.FILE_CONTENT != null && this.CALE_FISIER != null) { this.SMALL_ICON = (byte[])ThumbNails.GenerateByteThumbNail(this.CALE_FISIER, CommonFunctions.GetThumbNailSizes(ThumbNailType.Small)).Result; this.MEDIUM_ICON = (byte[])ThumbNails.GenerateByteThumbNail(this.CALE_FISIER, CommonFunctions.GetThumbNailSizes(ThumbNailType.Custom)).Result; } } catch (Exception exp) { LogWriter.Log(exp); return(new response(false, exp.Message, null, null, new List <Error>() { new Error(exp) })); } response toReturn = Validare(); if (!toReturn.Status) { return(toReturn); } PropertyInfo[] props = this.GetType().GetProperties(); ArrayList _parameters = new ArrayList(); var col = CommonFunctions.table_columns(authenticatedUserId, connectionString, "documente_scanate_procese"); foreach (PropertyInfo prop in props) { if (col != null && col.ToUpper().IndexOf(prop.Name.ToUpper()) > -1) // ca sa includem in Array-ul de parametri doar coloanele tabelei, nu si campurile externe si/sau alte proprietati { string propName = prop.Name; string propType = prop.PropertyType.ToString(); object propValue = prop.GetValue(this, null); propValue = propValue == null ? DBNull.Value : propValue; if (propType != null) { _parameters.Add(new MySqlParameter(String.Format("_{0}", propName.ToUpper()), propValue)); } } } DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "DOCUMENTE_SCANATE_PROCESEsp_update", _parameters.ToArray()); toReturn = da.ExecuteUpdateQuery(); /* * try * { * if (System.Web.HttpContext.Current.Request.Params["SEND_MESSAGE"] != null && Convert.ToBoolean(System.Web.HttpContext.Current.Request.Params["SEND_MESSAGE"])) * Mesaje.GenerateAndSendMessage(this.ID, DateTime.Now, "Document modificat", Convert.ToInt32(System.Web.HttpContext.Current.Session["AUTHENTICATED_ID"]), (int)Mesaje.Importanta.Low); * } * catch { } */ return(toReturn); }
/// <summary> /// Metoda pentru inserarea Documentului scanat curent /// </summary> /// <returns>SOCISA.response = new object(bool = status, string = error message, int = id-ul cheie returnat)</returns> public response Insert() { //try { if (this.DATA_INCARCARE == new DateTime() || this.DATA_INCARCARE == null) this.DATA_INCARCARE = GetFileCreationDate(); } try { if (this.DATA_INCARCARE == new DateTime() || this.DATA_INCARCARE == null) { this.DATA_INCARCARE = DateTime.Now; } } catch { } try { if (this.FILE_CONTENT == null && this.CALE_FISIER != null) { //this.FILE_CONTENT = FileManager.GetFileContentFromFile(this.CALE_FISIER); this.FILE_CONTENT = FileManager.UploadFile(this.CALE_FISIER); this.SMALL_ICON = (byte[])ThumbNails.GenerateByteThumbNail(this.CALE_FISIER, CommonFunctions.GetThumbNailSizes(ThumbNailType.Small)).Result; this.MEDIUM_ICON = (byte[])ThumbNails.GenerateByteThumbNail(this.CALE_FISIER, CommonFunctions.GetThumbNailSizes(ThumbNailType.Custom)).Result; this.DIMENSIUNE_FISIER = this.FILE_CONTENT.Length; this.EXTENSIE_FISIER = this.CALE_FISIER.Substring(this.CALE_FISIER.LastIndexOf('.')); //File.Delete(this.CALE_FISIER); // nu mai stergem, ca ne trebuie si in File Storage ! } if (this.FILE_CONTENT != null && this.CALE_FISIER != null) { this.SMALL_ICON = (byte[])ThumbNails.GenerateByteThumbNail(this.CALE_FISIER, CommonFunctions.GetThumbNailSizes(ThumbNailType.Small)).Result; this.MEDIUM_ICON = (byte[])ThumbNails.GenerateByteThumbNail(this.CALE_FISIER, CommonFunctions.GetThumbNailSizes(ThumbNailType.Custom)).Result; } } catch (Exception exp) { LogWriter.Log(exp); return(new response(false, exp.Message, null, null, new List <Error>() { new Error(exp) })); } response toReturn = Validare(); if (!toReturn.Status) { return(toReturn); } PropertyInfo[] props = this.GetType().GetProperties(); ArrayList _parameters = new ArrayList(); var col = CommonFunctions.table_columns(authenticatedUserId, connectionString, "documente_scanate_procese"); foreach (PropertyInfo prop in props) { if (col != null && col.ToUpper().IndexOf(prop.Name.ToUpper()) > -1) // ca sa includem in Array-ul de parametri doar coloanele tabelei, nu si campurile externe si/sau alte proprietati { string propName = prop.Name; string propType = prop.PropertyType.ToString(); object propValue = prop.GetValue(this, null); propValue = propValue == null ? DBNull.Value : propValue; if (propType != null) { if (propName.ToUpper() != "ID") // il vom folosi doar la Edit! { _parameters.Add(new MySqlParameter(String.Format("_{0}", propName.ToUpper()), propValue)); } } } } DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "DOCUMENTE_SCANATE_PROCESEsp_insert", _parameters.ToArray()); toReturn = da.ExecuteInsertQuery(); if (toReturn.Status) { this.ID = toReturn.InsertedId; } return(toReturn); }