Exemplo n.º 1
0
        private void BindDetailViewStaff(int staffId)
        {
            optCategory.Visible = false;

            if (PageVar.StaffMasterList == null)
            {
                PageVar.StaffMasterList = StaffMasterManagement.GetInstance.GetOfficeEmployeeList();
            }
            StaffMaster theStaff = new StaffMaster();

            theStaff = PageVar.StaffMasterList.Find(a => a.EmployeeID == staffId);

            lit_StaffDetails.Text = "";
            if (theStaff == null)
            {
                lit_StaffDetails.Text = string.Format("NO SUCH RECORD AVAILABLE FOR: <span class='Name'>{0} </span>", staffId);
                return;
            }
            else
            {
                //optCategory.SelectedIndex = -1;
                lit_StaffDetails.Text = string.Format("Detail Information of the Staff:- <span class='Name'>    {0} {1} - </span><span class='Desig'>{2}</span> <span class='dept'>({3})</span>", theStaff.Salutation, theStaff.EmployeeName, theStaff.DesignationDescription, theStaff.DepartmentDescription);
            }

            PropertyInfo[] propertiesStudent = theStaff.GetType().GetProperties();

            StringBuilder sbStaffDetails = new StringBuilder("<ul id='StaffDetailsView' class='StaffDetails'>");
            //Display Details
            //sbStaffDetails.Append(string.Format("<li class='FullRow'></li>", pi.Name, theVar, ctr));
            int ctr = 0;

            foreach (PropertyInfo pi in propertiesStudent)
            {
                ctr++;
                if (ctr > 1) // don't print the first row, as it it is the Employee ID column
                {
                    string theVar = string.Concat(pi.GetValue(theStaff, null), "&nbsp;");
                    sbStaffDetails.Append(string.Format("<li class='theName'>{2}. {0}</li><li class='theValue'>{1}</li>", pi.Name, theVar, ctr));
                }
            }
            sbStaffDetails.Append("</ul>");

            //studentDeails.InnerText = sbStaffDetails.ToString();
            lit_StaffDetailsInfo.Text = sbStaffDetails.ToString();
        }