Example #1
0
        public IList <OTIssueUploadInfoEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <OTIssueUploadInfoEntity> oTIssueUploadInfoEntityList = new List <OTIssueUploadInfoEntity>();

            try
            {
                if (pageSize == -1)
                {
                    pageSize = 1000000000;
                }

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = OTIssueUploadInfoEntity.FLD_NAME_IssueUploadInfoID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

                startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1;

                oTIssueUploadInfoEntityList = FCCOTIssueUploadInfo.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

                if (oTIssueUploadInfoEntityList != null && oTIssueUploadInfoEntityList.Count > 0)
                {
                    totalRowCount = oTIssueUploadInfoEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(oTIssueUploadInfoEntityList ?? new List <OTIssueUploadInfoEntity>());
        }
        protected void lvOTIssueUploadInfo_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 IssueUploadInfoID;

            Int64.TryParse(e.CommandArgument.ToString(), out IssueUploadInfoID);

            if (IssueUploadInfoID > 0)
            {
                if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(OTIssueUploadInfoEntity.FLD_NAME_IssueUploadInfoID, IssueUploadInfoID.ToString(), SQLMatchType.Equal);

                        OTIssueUploadInfoEntity oTIssueUploadInfoEntity = FCCOTIssueUploadInfo.GetFacadeCreate().GetByID(IssueUploadInfoID);


                        result = FCCOTIssueUploadInfo.GetFacadeCreate().Delete(oTIssueUploadInfoEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            if (File.Exists(Server.MapPath(oTIssueUploadInfoEntity.Path)))
                            {
                                File.Delete(Server.MapPath(oTIssueUploadInfoEntity.Path));
                            }

                            _IssueUploadInfoID       = 0;
                            _OTIssueUploadInfoEntity = new OTIssueUploadInfoEntity();

                            BindOTIssueUploadInfoList();

                            MiscUtil.ShowMessage(lblMessage, "File has been deleted successfully.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete file.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Example #3
0
        public IList <OTIssueUploadInfoEntity> GetData()
        {
            IList <OTIssueUploadInfoEntity> oTIssueUploadInfoEntityList = new List <OTIssueUploadInfoEntity>();

            try
            {
                oTIssueUploadInfoEntityList = FCCOTIssueUploadInfo.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

                if (oTIssueUploadInfoEntityList != null && oTIssueUploadInfoEntityList.Count > 0)
                {
                    totalRowCount = oTIssueUploadInfoEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(oTIssueUploadInfoEntityList ?? new List <OTIssueUploadInfoEntity>());
        }
        protected void afuFiles_UploadedComplete(object sender, AsyncFileUploadEventArgs e)
        {
            OTIssueUploadInfoEntity ent = new OTIssueUploadInfoEntity();

            ent.IssueID          = this.OverviewIssueID;
            ent.OriginalFileName = Path.GetFileName(e.FileName);
            ent.CurrentFileName  = Guid.NewGuid().ToString() + Path.GetExtension(e.FileName);
            ent.FileType         = "";
            ent.Extension        = Path.GetExtension(e.FileName);
            ent.Path             = FileUploadConstants.Issue.ADHOC_DOCUMENTS + ent.CurrentFileName;
            ent.Remarks          = String.Empty;

            FCCOTIssueUploadInfo.GetFacadeCreate().Add(ent, DatabaseOperationType.Add, TransactionRequired.No);

            // file upload

            afuFiles.SaveAs(Server.MapPath(ent.Path));

            //LoadFileListGried
            BindOTIssueUploadInfoList();
        }