private void InitialGVAttachFile()
        {
            try
            {
                string _EmployeeID = hdfEmployeeID.Value.Trim();

                EmployeeMaster_Manage manage      = new EmployeeMaster_Manage();
                List <Attachment>     lAttachment = new List <Attachment>();
                lAttachment = manage.listAttachfile(_EmployeeID);

                DataTable dtAttachment = (DataTable)Session["tbAttachFile"];

                if (lAttachment != null && lAttachment.Count > 0)
                {
                    dtAttachment = new DataTable();
                    DataRow dr;

                    dtAttachment.Clear();

                    dtAttachment.Columns.Add("FileName", typeof(string));
                    dtAttachment.Columns.Add("Description", typeof(string));
                    dtAttachment.Columns.Add("AttachFilePath", typeof(string));
                    dtAttachment.Columns.Add("EmployeeID", typeof(string));

                    foreach (var item in lAttachment)
                    {
                        dr = dtAttachment.NewRow();

                        dr["FileName"]       = item.FileName;
                        dr["Description"]    = string.Empty;
                        dr["AttachFilePath"] = item.Attachment1;
                        dr["EmployeeID"]     = item.EmployeeID;

                        dtAttachment.Rows.Add(dr);
                    }
                }

                Session["tbAttachFile"] = dtAttachment;

                gvAttachFile.DataSource = dtAttachment;
                gvAttachFile.DataBind();
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
        }
Example #2
0
        private void InitialGridAttachfile()
        {
            try
            {
                string _EmployeeID = hdfEmployeeID.Value.Trim();

                EmployeeMaster_Manage manage      = new EmployeeMaster_Manage();
                List <Attachment>     lAttachment = new List <Attachment>();
                lAttachment = manage.listAttachfile(_EmployeeID);

                gvAttachFile.DataSource = lAttachment;
                gvAttachFile.DataBind();
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
        }