Example #1
0
        internal void RemoveTMSFileFromDiskLogoProfile(string parentFoldername, string name, long oid, int Opentype, long aid)
        {
            string targetPath;

            if (Opentype == 1)
            {
                targetPath = "~/Attachment/TMS/Person/" + oid + "/Profile/" + parentFoldername + "/";
            }
            else
            {
                targetPath = "~/Attachment/TMS/Organization/" + oid + "/Profile/" + parentFoldername + "/";;
            }
            var fileName     = Path.GetFileName(name);
            var physicalPath = Path.Combine(Server.MapPath(targetPath));

            if (System.IO.File.Exists(physicalPath + "/" + name))
            {
                System.IO.File.Delete(physicalPath + "/" + name);
                TMS_Attachments _Attachments = new TMS_Attachments
                {
                    UpdatedBy   = CurrentUser.NameIdentifierInt64,
                    UpdatedDate = DateTime.Now,
                    ID          = aid
                };
                _AttachmentBAL.TMS_Attachment_DeleteBAL(_Attachments);
                System.IO.DirectoryInfo di = new DirectoryInfo(physicalPath);
                di.Delete();
            }
        }
Example #2
0
        public ActionResult SavePictureAndLogo(HttpPostedFileBase fileupload, long oid, int otype)//this is called once person or organization have the id
        {
            var             extention    = Path.GetExtension(fileupload.FileName);
            TMS_Attachments _Attachments = new TMS_Attachments
            {
                FileParentRootFolder = DateTime.Now.Ticks.ToString()
            };
            string targetString;

            if (otype == 1)
            {
                targetString = "~/Attachment/TMS/Person/" + oid + "/Profile/" + _Attachments.FileParentRootFolder + "/";
            }
            else
            {
                targetString = "~/Attachment/TMS/Organization/" + oid + "/Profile/" + _Attachments.FileParentRootFolder + "/";;
            }
            string targetSource = Utility.CreateDirectory(Path.Combine(Server.MapPath(targetString)));
            var    physicalPath = Path.Combine(targetSource, fileupload.FileName);

            _Attachments.CreatedBy     = CurrentUser.NameIdentifierInt64;
            _Attachments.CreatedDate   = DateTime.Now;
            _Attachments.FileExtension = Path.GetExtension(fileupload.FileName);
            _Attachments.FileName      = fileupload.FileName;
            _Attachments.FilePath      = targetString;
            _Attachments.FileSize      = fileupload.ContentLength;
            _Attachments.FileType      = AttachmentsFileType.AttachmentsFileType_ProfilePicture;
            _Attachments.OpenID        = oid;
            _Attachments.OpenType      = otype;
            var result = _AttachmentBAL.TMS_Attachment_CreateBAL(_Attachments);

            fileupload.SaveAs(physicalPath);
            return(Json(new { parentFoldername = _Attachments.FileParentRootFolder, aid = result }, "text/plain"));
        }
 /// <summary>
 /// TMSs the attachment delete dal.
 /// </summary>
 /// <param name="_objTMS_Attachments">The object TMS attachments.</param>
 /// <returns>System.Int32.</returns>
 public int TMS_Attachment_DeleteDAL(TMS_Attachments _objTMS_Attachments)
 {
     return(ExecuteScalarInt32Sp("TMS_Attachments_Delete",
                                 ParamBuilder.Par("ID", _objTMS_Attachments.ID),
                                 ParamBuilder.Par("UpdatedBy", _objTMS_Attachments.UpdatedBy),
                                 ParamBuilder.Par("UpdatedDate", _objTMS_Attachments.UpdatedDate)));
 }
Example #4
0
        public ActionResult SaveOrganizationLogo(HttpPostedFileBase fileupload)//this is called on Organization grid when organization was not created
        {
            var             extention    = Path.GetExtension(fileupload.FileName);
            TMS_Attachments _Attachments = new TMS_Attachments
            {
                FileParentRootFolder = DateTime.Now.Ticks.ToString()
            };
            string targetString;

            targetString = "~/UploadTempFolder/" + _Attachments.FileParentRootFolder + "/";
            string targetSource = Utility.CreateDirectory(Path.Combine(Server.MapPath(targetString)));
            var    physicalPath = Path.Combine(targetSource, fileupload.FileName);

            _Attachments.CreatedBy     = CurrentUser.NameIdentifierInt64;
            _Attachments.CreatedDate   = DateTime.Now;
            _Attachments.FileExtension = Path.GetExtension(fileupload.FileName);
            _Attachments.FileName      = fileupload.FileName;
            _Attachments.FilePath      = targetString;
            _Attachments.FileSize      = fileupload.ContentLength;
            _Attachments.FileType      = AttachmentsFileType.AttachmentsFileType_ProfilePicture;
            _Attachments.OpenID        = -1;
            _Attachments.OpenType      = 2;
            var result = _AttachmentBAL.TMS_Attachment_CreateBAL(_Attachments);

            fileupload.SaveAs(physicalPath);
            return(Json(new { parentFoldername = _Attachments.FileParentRootFolder, aid = result }, "text/plain"));
        }
 /// <summary>
 /// TMSs the attachment completed profile logo dal.
 /// </summary>
 /// <param name="_objTMS_Attachments">The object TMS attachments.</param>
 /// <returns>System.Int32.</returns>
 public int TMS_Attachment_CompletedProfileLogoDAL(TMS_Attachments _objTMS_Attachments)
 {
     return(ExecuteScalarInt32Sp("TMS_Attachment_CompletedProfileLogo",
                                 ParamBuilder.Par("ID", _objTMS_Attachments.ID),
                                 ParamBuilder.Par("OpenID", System.Convert.ToInt32(_objTMS_Attachments.OpenID)),
                                 ParamBuilder.Par("OpenType", _objTMS_Attachments.OpenType),
                                 ParamBuilder.Par("CompletedDate", _objTMS_Attachments.CompletedDate)));
 }
 /// <summary>
 /// TMSs the attachment update dal.
 /// </summary>
 /// <param name="_objTMS_Attachments">The object TMS attachments.</param>
 /// <returns>System.Int32.</returns>
 public int TMS_Attachment_UpdateDAL(TMS_Attachments _objTMS_Attachments)
 {
     return(ExecuteScalarInt32Sp("TMS_Attachments_Update",
                                 ParamBuilder.Par("ID", _objTMS_Attachments.ID),
                                 ParamBuilder.Par("Description", _objTMS_Attachments.Description),
                                 ParamBuilder.Par("ValidTill", _objTMS_Attachments.ValidTill),
                                 ParamBuilder.Par("UpdatedBy", _objTMS_Attachments.UpdatedBy),
                                 ParamBuilder.Par("UpdatedDate", _objTMS_Attachments.UpdatedDate)));
 }
 /// <summary>
 /// TMSs the attachment completed dal.
 /// </summary>
 /// <param name="_objTMS_Attachments">The object TMS attachments.</param>
 /// <returns>System.Int32.</returns>
 public int TMS_Attachment_CompletedDAL(TMS_Attachments _objTMS_Attachments)
 {
     return(ExecuteScalarInt32Sp("TMS_Attachments_Completed",
                                 ParamBuilder.Par("ID", _objTMS_Attachments.ID),
                                 ParamBuilder.Par("FileParentRootFolder", _objTMS_Attachments.FileParentRootFolder),
                                 ParamBuilder.Par("Description", _objTMS_Attachments.Description),
                                 ParamBuilder.Par("ValidTill", _objTMS_Attachments.ValidTill),
                                 ParamBuilder.Par("CompletedDate", _objTMS_Attachments.CompletedDate)));
 }
 /// <summary>
 /// TMSs the attachment completed organization logo dal.
 /// </summary>
 /// <param name="_objTMS_Attachments">The object TMS attachments.</param>
 /// <returns>System.Int32.</returns>
 public int TMS_Attachment_CompletedOrganizationLogoDAL(TMS_Attachments _objTMS_Attachments)
 {
     return(ExecuteScalarInt32Sp("TMS_Attachment_CompletedOrganizationLogo",
                                 ParamBuilder.Par("ID", _objTMS_Attachments.ID),
                                 ParamBuilder.Par("OpenID", _objTMS_Attachments.OpenID),
                                 ParamBuilder.Par("OpenType", _objTMS_Attachments.OpenType),
                                 ParamBuilder.Par("FileParentRootFolder", _objTMS_Attachments.FileParentRootFolder),
                                 ParamBuilder.Par("FilePath", _objTMS_Attachments.FilePath),
                                 ParamBuilder.Par("CompletedDate", _objTMS_Attachments.CompletedDate)));
 }
Example #9
0
        /// <summary>
        /// Profiles the and logo from database.
        /// </summary>
        /// <param name="OpenId">The open identifier.</param>
        /// <param name="OpenType">Type of the open.</param>
        /// <returns>TMS_Attachments.</returns>
        internal TMS_Attachments ProfileAndLogoFromDatabase(long OpenId, int OpenType)
        {
            var model = ExecuteSinglewithSP <TMS_Attachments>("TMS_Attachments_GetProfileLogobyIdandType", ParamBuilder.Par("OpenId", OpenId), ParamBuilder.Par("OpenType", OpenType));

            if (model == null)
            {
                TMS_Attachments LocalModel = new TMS_Attachments()
                {
                    ID = -1, FileType = AttachmentsFileType.AttachmentsFileType_ProfilePicture, FileName = "people.png", FilePath = "~/images/i/"
                };
                model = LocalModel;
            }
            return(model);
        }
        /// <summary>
        /// TMSs the attachment create dal.
        /// </summary>
        /// <param name="_objTMS_Attachments">The object TMS attachments.</param>
        /// <returns>System.Int64.</returns>
        public long TMS_Attachment_CreateDAL(TMS_Attachments _objTMS_Attachments)
        {
            var parameters = new[] { ParamBuilder.Par("ID", 0) };

            return(ExecuteInt64withOutPutparameterSp("TMS_Attachments_Create", parameters,
                                                     ParamBuilder.Par("OpenID", _objTMS_Attachments.OpenID),
                                                     ParamBuilder.Par("OpenType", _objTMS_Attachments.OpenType),
                                                     ParamBuilder.Par("FileName", _objTMS_Attachments.FileName),
                                                     ParamBuilder.Par("FileType", _objTMS_Attachments.FileType),
                                                     ParamBuilder.Par("FileParentRootFolder", _objTMS_Attachments.FileParentRootFolder),
                                                     ParamBuilder.Par("FilePath", _objTMS_Attachments.FilePath),
                                                     ParamBuilder.Par("FileSize", _objTMS_Attachments.FileSize),
                                                     ParamBuilder.Par("FileExtension", _objTMS_Attachments.FileExtension),
                                                     ParamBuilder.Par("Description", _objTMS_Attachments.Description),
                                                     ParamBuilder.Par("ValidTill", _objTMS_Attachments.ValidTill),
                                                     ParamBuilder.Par("CreatedBy", _objTMS_Attachments.CreatedBy),
                                                     ParamBuilder.Par("CreatedDate", _objTMS_Attachments.CreatedDate)));
        }
        /// <summary>
        /// Profiles the and logo from database.
        /// </summary>
        /// <param name="OpenId">The open identifier.</param>
        /// <param name="OpenType">Type of the open.</param>
        /// <returns>TMS_Attachments.</returns>
        internal TMS_Attachments ProfileAndLogoFromDatabase(long OpenId, int OpenType)
        {
            var model = ExecuteSinglewithSP <TMS_Attachments>("TMS_Attachments_GetProfileLogobyIdandType", ParamBuilder.Par("OpenId", OpenId), ParamBuilder.Par("OpenType", OpenType));

            if (model == null)
            {
                TMS_Attachments LocalModel = new TMS_Attachments()
                {
                    ID = -1, FileType = AttachmentsFileType.AttachmentsFileType_ProfilePicture, FileName = "people.png", FilePath = "~/images/i/", Description = "This is default image and this will hide when you add new profile picture"
                };
                model = LocalModel;
            }
            else
            {
                model = null;
            }
            return(model);
        }
Example #12
0
        internal void RemoveTMSFileFromDiskLogoOnly(long aid)
        {
            var model = _AttachmentBAL.TMS_Attachment_GetSingleByIdAndTypeBAL(aid);

            string targetPath = model.FilePath;

            var fileName     = model.FileName;
            var physicalPath = Path.Combine(Server.MapPath(targetPath));

            if (System.IO.File.Exists(physicalPath + "/" + fileName))
            {
                System.IO.File.Delete(physicalPath + "/" + fileName);
                TMS_Attachments _Attachments = new TMS_Attachments
                {
                    UpdatedBy   = CurrentUser.NameIdentifierInt64,
                    UpdatedDate = DateTime.Now,
                    ID          = aid
                };
                _AttachmentBAL.TMS_Attachment_DeleteBAL(_Attachments);
                System.IO.DirectoryInfo di = new DirectoryInfo(physicalPath);
                di.Delete();
            }
        }
Example #13
0
 /// <summary>
 /// TMSs the attachment completed organization logo bal.
 /// </summary>
 /// <param name="_objTMS_Attachments">The object TMS attachments.</param>
 /// <returns>System.Int32.</returns>
 public int TMS_Attachment_CompletedOrganizationLogoBAL(TMS_Attachments _objTMS_Attachments)
 {
     return(DAL.TMS_Attachment_CompletedOrganizationLogoDAL(_objTMS_Attachments));
 }
Example #14
0
 /// <summary>
 /// TMSs the attachment delete bal.
 /// </summary>
 /// <param name="_objTMS_Attachments">The object TMS attachments.</param>
 /// <returns>System.Int32.</returns>
 public int TMS_Attachment_DeleteBAL(TMS_Attachments _objTMS_Attachments)
 {
     return(DAL.TMS_Attachment_DeleteDAL(_objTMS_Attachments));
 }
Example #15
0
 /// <summary>
 /// TMSs the attachment create bal.
 /// </summary>
 /// <param name="_objTMS_Attachments">The object TMS attachments.</param>
 /// <returns>System.Int64.</returns>
 public long TMS_Attachment_CreateBAL(TMS_Attachments _objTMS_Attachments)
 {
     return(DAL.TMS_Attachment_CreateDAL(_objTMS_Attachments));
 }
Example #16
0
 /// <summary>
 /// TMSs the attachment completed bal.
 /// </summary>
 /// <param name="_objTMS_Attachments">The object TMS attachments.</param>
 /// <returns>System.Int32.</returns>
 public int TMS_Attachment_CompletedBAL(TMS_Attachments _objTMS_Attachments)
 {
     return(DAL.TMS_Attachment_CompletedDAL(_objTMS_Attachments));
 }
Example #17
0
        public ActionResult Attachment_Destroy([DataSourceRequest] DataSourceRequest request, TMS_Attachments _TMS_Attachments)
        {
            if (ModelState.IsValid)
            {
                _TMS_Attachments.UpdatedBy   = CurrentUser.NameIdentifierInt64;
                _TMS_Attachments.UpdatedDate = DateTime.Now;

                var result = _AttachmentBAL.TMS_Attachment_DeleteBAL(_TMS_Attachments);
                if (result == -1)
                {
                    ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError);
                }
            }
            var resultData = new[] { _TMS_Attachments };

            return(Json(resultData.ToDataSourceResult(request, ModelState)));
        }
Example #18
0
        public ActionResult Attachment_Update([DataSourceRequest] DataSourceRequest request, TMS_Attachments _TMS_Attachments, string parentFoldername, long aid)
        {
            if (ModelState.IsValid)
            {
                _TMS_Attachments.CompletedDate = DateTime.Now;
                _TMS_Attachments.UpdatedBy     = CurrentUser.NameIdentifierInt64;
                _TMS_Attachments.UpdatedDate   = DateTime.Now;
                int result;
                if (_TMS_Attachments.FileType == AttachmentsFileType.AttachmentsFileType_ProfilePicture)
                {
                    _TMS_Attachments.ValidTill = DateTime.Now.AddMonths(TMSHelper.AttachmentValidTillPeriodInMonths());
                    _TMS_Attachments.ID        = aid;
                    result = _AttachmentBAL.TMS_Attachment_CompletedProfileLogoBAL(_TMS_Attachments);
                }
                else
                {
                    result = _AttachmentBAL.TMS_Attachment_UpdateBAL(_TMS_Attachments);
                }
                if (result == -1)
                {
                    ModelState.AddModelError(lr.ErrorServerError, lr.ResourceUpdateValidationError);
                }
            }
            var resultData = new[] { _TMS_Attachments };

            return(Json(resultData.ToDataSourceResult(request, ModelState)));
        }
Example #19
0
        public ActionResult Attachment_Create([DataSourceRequest] DataSourceRequest request, TMS_Attachments _TMS_Attachments, string parentFoldername, long aid)
        {
            if (ModelState.IsValid)
            {
                _TMS_Attachments.CompletedDate = DateTime.Now;
                if (_TMS_Attachments.ValidTill == null)
                {
                    _TMS_Attachments.ValidTill = DateTime.Now.AddMonths(TMSHelper.AttachmentValidTillPeriodInMonths());
                }
                _TMS_Attachments.ID = aid;
                _TMS_Attachments.FileParentRootFolder = parentFoldername;
                _AttachmentBAL.TMS_Attachment_CompletedBAL(_TMS_Attachments);
            }
            var resultData = new[] { _TMS_Attachments };

            return(Json(resultData.ToDataSourceResult(request, ModelState)));
        }
Example #20
0
 /// <summary>
 /// TMSs the attachment completed profile logo bal.
 /// </summary>
 /// <param name="_objTMS_Attachments">The object TMS attachments.</param>
 /// <returns>System.Int32.</returns>
 public int TMS_Attachment_CompletedProfileLogoBAL(TMS_Attachments _objTMS_Attachments)
 {
     return(DAL.TMS_Attachment_CompletedProfileLogoDAL(_objTMS_Attachments));
 }