Ejemplo n.º 1
0
        private string OwlWorksAssociateList()
        {
            StringBuilder sb  = new StringBuilder();
            ExportManager oEM = new ExportManager();
            DataTable     dt  = ExportDataDAL.OwlWorksAssociateList();

            if (dt != null && dt.Rows != null && dt.Rows.Count > 0)
            {
                string   strOutput = "";
                string   strData   = "";
                DateTime datDate   = new DateTime();
                foreach (DataColumn dc in dt.Columns)
                {
                    if (dc.Ordinal > 0)
                    {
                        strOutput += "\t";
                    }

                    strOutput += dc.Caption;
                }

                sb.AppendLine(strOutput);

                foreach (DataRow dr in dt.Rows)
                {
                    strOutput = "";
                    foreach (DataColumn dc1 in dt.Columns)
                    {
                        strData = Convert.ToString(dr[dc1.Ordinal]);

                        switch (dc1.Caption)
                        {
                        case "ProbationaryDate":
                        case "HonoraryDate":
                        case "WhiteAppApprovedDate":
                        case "WhiteAppReceivedDate":
                        {
                            if (DateTime.TryParse(strData, out datDate) == true)
                            {
                                strData = datDate.ToString("MM/dd/yyyy");
                            }
                            else
                            {
                                strData = "";
                            }
                            break;
                        }

                        default:
                            break;
                        }

                        if (dc1.Ordinal > 0)
                        {
                            strOutput += "\t";
                        }

                        strOutput += strData;
                    }
                    sb.AppendLine(strOutput);
                }
            }


            return(sb.ToString());
        }