public IList <BDProjectCollectedDocumentUploadInfoEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <BDProjectCollectedDocumentUploadInfoEntity> bDProjectCollectedDocumentUploadInfoEntityList = new List <BDProjectCollectedDocumentUploadInfoEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = BDProjectCollectedDocumentUploadInfoEntity.FLD_NAME_ProjectCollectedDocumentUploadInfoID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                bDProjectCollectedDocumentUploadInfoEntityList = FCCBDProjectCollectedDocumentUploadInfo.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(bDProjectCollectedDocumentUploadInfoEntityList ?? new List <BDProjectCollectedDocumentUploadInfoEntity>());
        }
        protected void afuFiles_UploadedComplete(object sender, AsyncFileUploadEventArgs e)
        {
            //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "size", "top.$get(\"" + uploadResult.ClientID + "\").innerHTML = 'Uploaded size: " + AsyncFileUpload1.FileBytes.Length.ToString() + "';", true);

            // Uncomment to save to AsyncFileUpload\Uploads folder.
            // ASP.NET must have the necessary permissions to write to the file system.



            BDProjectCollectedDocumentUploadInfoEntity ent = new BDProjectCollectedDocumentUploadInfoEntity();

            ent.ProjectCollectedDocumentInfoID = CurrentBDProjectCollectedDocumentInfoEntity.ProjectCollectedDocumentInfoID;// _BDProjectCollectedDocumentInfoEntity.ProjectCollectedDocumentInfoID;
            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.Project.DOCUMENTS + ent.CurrentFileName;
            ent.Remarks          = String.Empty;

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

            // file upload

            afuFiles.SaveAs(Server.MapPath(ent.Path));
            //LoadFileListGried
            BindBDProjectCollectedDocumentUploadInfoList();
        }
        private void SaveBDProjectCollectedDocumentUploadInfoEntity()
        {
            if (IsValid)
            {
                try
                {
                    BDProjectCollectedDocumentUploadInfoEntity bDProjectCollectedDocumentUploadInfoEntity = BuildBDProjectCollectedDocumentUploadInfoEntity();

                    Int64 result = -1;

                    if (bDProjectCollectedDocumentUploadInfoEntity.IsNew)
                    {
                        result = FCCBDProjectCollectedDocumentUploadInfo.GetFacadeCreate().Add(bDProjectCollectedDocumentUploadInfoEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(BDProjectCollectedDocumentUploadInfoEntity.FLD_NAME_ProjectCollectedDocumentUploadInfoID, bDProjectCollectedDocumentUploadInfoEntity.ProjectCollectedDocumentUploadInfoID.ToString(), SQLMatchType.Equal);
                        result = FCCBDProjectCollectedDocumentUploadInfo.GetFacadeCreate().Update(bDProjectCollectedDocumentUploadInfoEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _ProjectCollectedDocumentUploadInfoID       = 0;
                        _BDProjectCollectedDocumentUploadInfoEntity = new BDProjectCollectedDocumentUploadInfoEntity();
                        PrepareInitialView();
                        BindBDProjectCollectedDocumentUploadInfoList();

                        if (bDProjectCollectedDocumentUploadInfoEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Project Collected Document Upload Info Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Project Collected Document Upload Info Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (bDProjectCollectedDocumentUploadInfoEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Project Collected Document Upload Info Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Project Collected Document Upload Info Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvBDProjectCollectedDocumentUploadInfo_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ProjectCollectedDocumentUploadInfoID;

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

            if (ProjectCollectedDocumentUploadInfoID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _ProjectCollectedDocumentUploadInfoID = ProjectCollectedDocumentUploadInfoID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(BDProjectCollectedDocumentUploadInfoEntity.FLD_NAME_ProjectCollectedDocumentUploadInfoID, ProjectCollectedDocumentUploadInfoID.ToString(), SQLMatchType.Equal);

                        BDProjectCollectedDocumentUploadInfoEntity bDProjectCollectedDocumentUploadInfoEntity = new BDProjectCollectedDocumentUploadInfoEntity();


                        result = FCCBDProjectCollectedDocumentUploadInfo.GetFacadeCreate().Delete(bDProjectCollectedDocumentUploadInfoEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _ProjectCollectedDocumentUploadInfoID       = 0;
                            _BDProjectCollectedDocumentUploadInfoEntity = new BDProjectCollectedDocumentUploadInfoEntity();
                            PrepareInitialView();
                            BindBDProjectCollectedDocumentUploadInfoList();

                            MiscUtil.ShowMessage(lblMessage, "Project Collected Document Upload Info has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Project Collected Document Upload Info.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <BDProjectCollectedDocumentUploadInfoEntity> GetData()
        {
            IList <BDProjectCollectedDocumentUploadInfoEntity> bDProjectCollectedDocumentUploadInfoEntityList = new List <BDProjectCollectedDocumentUploadInfoEntity>();

            try
            {
                bDProjectCollectedDocumentUploadInfoEntityList = FCCBDProjectCollectedDocumentUploadInfo.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(bDProjectCollectedDocumentUploadInfoEntityList ?? new List <BDProjectCollectedDocumentUploadInfoEntity>());
        }
        //protected void lvBDProject_ItemDataBound(object sender, ListViewItemEventArgs e)
        //{
        //    if (e.Item.ItemType == ListViewItemType.DataItem)
        //    {
        //        ListViewDataItem dataItem = (ListViewDataItem)e.Item;

        //        BDProjectEntity ent = (BDProjectEntity)dataItem.DataItem;

        //        HyperLink hypUploadedFile = (HyperLink)e.Item.FindControl("hypUploadedFile");

        //        hypUploadedFile.NavigateUrl = UrlHelper.BuildSecureUrl("~/BD/BDProjectEditor.aspx", string.Empty, UrlConstants.OVERVIEW_PROJECT_ID, ent.ProjectID.ToString()).ToString();
        //        hypUploadedFile.Target = "_blank";
        //    }
        //}

        protected void lvBDProjectCollectedDocumentUploadInfo_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ProjectCollectedDocumentUploadInfoID;

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

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(BDProjectCollectedDocumentUploadInfoEntity.FLD_NAME_ProjectCollectedDocumentUploadInfoID, ProjectCollectedDocumentUploadInfoID.ToString(), SQLMatchType.Equal);

                        BDProjectCollectedDocumentUploadInfoEntity bDProjectCollectedDocumentUploadInfoEntity = FCCBDProjectCollectedDocumentUploadInfo.GetFacadeCreate().GetByID(ProjectCollectedDocumentUploadInfoID);

                        result = FCCBDProjectCollectedDocumentUploadInfo.GetFacadeCreate().Delete(bDProjectCollectedDocumentUploadInfoEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

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

                            BindBDProjectCollectedDocumentUploadInfoList();

                            MiscUtil.ShowMessage(lblMessage, "Project Collected Document Upload Info has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Project Collected Document Upload Info.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }