示例#1
0
        public string GetTPDoctorDetailsForAluminiUsers(string tpDate, string userCode)
        {
            StringBuilder strContent = new StringBuilder();

            try
            {
                DataControl.CurrentInfo objCurInfo = new DataControl.CurrentInfo();
                DataControl.BL_Report   objReport  = new DataControl.BL_Report();
                List <MVCModels.HiDoctor_Master.DoctorModel> lstDoctor =
                    new List <MVCModels.HiDoctor_Master.DoctorModel>(objReport.GetTPDoctorDetailsForAlumniUsers(objCurInfo.GetCompanyCode(), tpDate, userCode));
                strContent.Append("<table class='table table-striped' id='tbl_Details'>");
                strContent.Append("<thead>");
                strContent.Append("<tr id='tblTrpopup'>");
                strContent.Append("<th>MDL NO</th>");
                strContent.Append("<th>Doctor Name</th>");
                strContent.Append("<th>Speciality</th>");
                strContent.Append("</tr>");
                strContent.Append("</thead>");
                strContent.Append("<tbody>");

                if (lstDoctor.Count > 0)
                {
                    for (var i = 0; i < lstDoctor.Count; i++)
                    {
                        strContent.Append("<tr>");
                        strContent.Append("<td>" + lstDoctor[i].MDL_Number + "</td>");
                        strContent.Append("<td>" + lstDoctor[i].Customer_Name + "</td>");
                        strContent.Append("<td>" + lstDoctor[i].Speciality_Name + "</td>");
                        strContent.Append("</tr>");
                    }
                }
                strContent.Append("</tbody>");
                strContent.Append("</table>");
            }
            catch (Exception ex)
            {
            }
            return(strContent.ToString());
        }
示例#2
0
        ///// <summary>
        ///// Get TP Master report for alumini users
        ///// </summary>
        ///// <param name="userCode"></param>
        ///// <param name="date"></param>
        ///// <returns>return the table content</returns>
        public string GetTPMasterReportForAluminiUsers(string userCode, string month, string year, string isExcel, string monthName)
        {
            StringBuilder strContent = new StringBuilder();

            DataControl.CurrentInfo objCurInfo = new DataControl.CurrentInfo();
            DataControl.BL_Report   objReport  = new DataControl.BL_Report();
            DataControl.BLUser      objUser    = new DataControl.BLUser();
            #region tp header
            strContent.Append(objUser.GetReportHeaderTableString(objCurInfo.GetCompanyCode(), userCode, monthName + "-" + year, "", "", ""));
            strContent.Append("<table class='table table-striped' cellpadding=0 cellspacing=0  id ='tblTPReport'>");
            strContent.Append("<thead>");
            strContent.Append("<tr id='tblTr'>");
            strContent.Append("<th>User Name</th>");
            strContent.Append("<th>TP Date</th>");
            strContent.Append("<th>Call Objective</th>");
            strContent.Append("<th>Activity Name</th>");
            strContent.Append("<th>Category</th>");
            strContent.Append("<th>CP Name</th>");
            strContent.Append("<th>Meeting Point </th>");
            strContent.Append("<th>Meeting Time </th>");
            strContent.Append("<th>Work Place</th>");
            strContent.Append("<th>SFC</th>");
            strContent.Append("<th>Accomp Name</th>");
            strContent.Append("<th>No oF Planned Doctors</th>");
            strContent.Append("<th>Entered Date</th>");
            strContent.Append("<th>Entered By</th>");
            strContent.Append("<th>Remarks</th>");
            strContent.Append("<th>Status</th>");
            strContent.Append("<th>Approved/Unapproved Date</th>");
            strContent.Append("<th>Approve/Unapprove Reason</th>");
            strContent.Append("</tr>");
            strContent.Append("</thead>");
            strContent.Append("<tbody>");
            #endregion tp header
            try
            {
                DataSet ds = new DataSet();
                ds = objReport.GetTPMasterReportForAlumniUsers(objCurInfo.GetCompanyCode(), month, year, userCode);
                if (ds.Tables.Count > 0)
                {
                    int      noOfDays    = System.DateTime.DaysInMonth(Convert.ToInt32(year), Convert.ToInt32(month));
                    DateTime startDate   = Convert.ToDateTime(year + "-" + month + "-01");
                    DateTime endDate     = Convert.ToDateTime(year + "-" + month + "-" + noOfDays);
                    DateTime dtStartDate = new DateTime();
                    DateTime dtEndDate   = new DateTime();
                    dtStartDate = Convert.ToDateTime(startDate);
                    dtEndDate   = Convert.ToDateTime(endDate);
                    DateTime dtDate = dtStartDate;
                    TimeSpan ts;
                    ts = dtEndDate - dtStartDate;
                    for (var j = 0; j <= ts.Days; j++)
                    {
                        if (j != 0)
                        {
                            dtDate = dtDate.AddDays(Convert.ToDouble(1));
                        }

                        DataRow[] dr = ds.Tables[0].AsEnumerable().Where(a => Convert.ToInt32(a["Day"]) == dtDate.Day &&
                                                                         Convert.ToInt32(a["Month"]) == dtDate.Month && Convert.ToInt32(a["Year"]) == dtDate.Year).ToArray();

                        if (dr.Length > 0)
                        {
                            strContent.Append("<tr>");
                            strContent.Append("<td>" + Convert.ToString(dr[0]["User_Name"]) + "</td>");
                            strContent.Append("<td>" + Convert.ToString(dr[0]["TP_Date"]) + "</td>");


                            strContent.Append("<td>" + Convert.ToString(dr[0]["Activity_Code"]) + "</td>");


                            strContent.Append("<td>" + Convert.ToString(dr[0]["Project_Code"]) + "</td>");


                            strContent.Append("<td>" + Convert.ToString(dr[0]["Category"]) + "</td>");


                            strContent.Append("<td>" + Convert.ToString(dr[0]["CP_name"]) + "</td>");
                            strContent.Append("<td>" + Convert.ToString(dr[0]["Meeting_point"]) + "</td>");
                            strContent.Append("<td>" + Convert.ToString(dr[0]["Meeting_Time"]) + "</td>");

                            strContent.Append("<td>" + Convert.ToString(dr[0]["Work_Area"]) + "</td>");

                            #region TP SFC details
                            //  var sfcDet = jsonPath(jsData, "$.Tables[4].Rows[?(@.TP_Id=='" + details[0].TP_Id + "')]");
                            DataRow[]     drSFC  = ds.Tables[2].AsEnumerable().Where(z => Convert.ToString(z["TP_Id"]) == Convert.ToString(dr[0]["TP_Id"])).ToArray();
                            StringBuilder strSFC = new StringBuilder();

                            if (drSFC.Length > 0)
                            {
                                for (int s = 0; s < drSFC.Length; s++)
                                {
                                    if (!string.IsNullOrEmpty(Convert.ToString(drSFC[s]["From_Place"])))
                                    {
                                        strSFC.Append("" + (s + 1) + "/ " + Convert.ToString(drSFC[s]["From_Place"]) + "  to  "
                                                      + Convert.ToString(drSFC[s]["To_Place"]) + "<br />");
                                    }
                                }
                            }
                            strContent.Append("<td>" + strSFC.ToString() + "</td>");
                            #endregion TP SFC details
                            StringBuilder strAccName = new StringBuilder();
                            if (!string.IsNullOrEmpty(Convert.ToString(dr[0]["Accomp_Name"])))
                            {
                                strAccName.Append("" + Convert.ToString(dr[0]["Accomp_Name"]) + " <br />");
                            }
                            if (!string.IsNullOrEmpty(Convert.ToString(dr[0]["Accompanist2_Name"])))
                            {
                                strAccName.Append("" + Convert.ToString(dr[0]["Accompanist2_Name"]) + "<br />");
                            }
                            if (!string.IsNullOrEmpty(Convert.ToString(dr[0]["Accompanist3_Name"])))
                            {
                                strAccName.Append("" + Convert.ToString(dr[0]["Accompanist3_Name"]) + "<br />");
                            }
                            if (!string.IsNullOrEmpty(Convert.ToString(dr[0]["Accompanist4_Name"])))
                            {
                                strAccName.Append("" + Convert.ToString(dr[0]["Accompanist4_Name"]) + "<br /> ");
                            }

                            strContent.Append("<td>" + strAccName.ToString() + "</td>");
                            DataRow[] drDoctors = ds.Tables[1].AsEnumerable().Where(c => Convert.ToString(c["TP_Date"]) ==
                                                                                    Convert.ToString(dr[0]["TP_Date"])).ToArray();


                            if (drDoctors.Length > 0)
                            {
                                // content += "<td>" + dJsonData.length + "</td>";
                                strContent.Append("<td align='center' ><span onclick='fnTPDetails(\"" + userCode + "_"
                                                  + dr[0]["TP_Date"] + "\")' style='text-decoration:underline;cursor:pointer'>" + drDoctors.Length + "</span></td>");
                            }
                            else
                            {
                                strContent.Append("<td></td>");
                            }


                            strContent.Append("<td>" + Convert.ToString(dr[0]["Entered_Date"]) + "</td>");

                            strContent.Append("<td>" + Convert.ToString(dr[0]["Entered_by"]) + "</td>");



                            strContent.Append("<td>" + Convert.ToString(dr[0]["Remarks"]) + "</td>");



                            strContent.Append("<td>" + Convert.ToString(dr[0]["Status"]) + "</td>");


                            strContent.Append("<td>" + Convert.ToString(dr[0]["Approved_Date"]) + "</td>");



                            strContent.Append("<td>" + Convert.ToString(dr[0]["Unapprove_Reason"]) + "</td>");


                            strContent.Append("</tr>");
                        }
                        else
                        {
                            #region holiday details
                            DataRow[] drHoliday = ds.Tables[3].AsEnumerable().Where(a => Convert.ToInt32(a["Day"]) == dtDate.Day &&
                                                                                    Convert.ToInt32(a["Month"]) == dtDate.Month && Convert.ToInt32(a["Year"]) == dtDate.Year).ToArray();
                            // var details = jsonPath(jsData, "$.Tables[5].Rows[?(@.Day=='" + day + "' & @.Month=='" + month + "' & @.Year=='" + year + "')]");
                            if (drHoliday.Length > 0)
                            {
                                if (Convert.ToString(drHoliday[0]["Type"]) == "S")
                                {
                                    strContent.Append("<tr>");
                                    strContent.Append("<td style='background: #efefef;'></td>");


                                    strContent.Append("<td style='background: #efefef;'>" + Convert.ToString(drHoliday[0]["Date"]) + "</td>");

                                    strContent.Append("<td style='background: #efefef;'> - Sunday</td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");

                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");

                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");

                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("</tr>");
                                }
                                else
                                {
                                    strContent.Append("<tr>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'>" + Convert.ToString(drHoliday[0]["Date"]) + "</td>");
                                    strContent.Append("<td style='background: #efefef;'> - Holiday - </td>");

                                    strContent.Append("<td style='background: #efefef;'>" + Convert.ToString(drHoliday[0]["Holiday"]) + "</td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");

                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");

                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");

                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("<td style='background: #efefef;'></td>");
                                    strContent.Append("</tr>");
                                }
                            }
                            #endregion holiday details
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }

            strContent.Append("</tbody>");
            strContent.Append("</table>");
            string blobUrl = string.Empty;
            if ("Y" == isExcel)
            {
                DataControl.Abstraction.IConfigProvider iConfigPro   = new DataControl.Impl.ConfigProvider();
                DataControl.Repository.AzureBlobUpload  objAzureBlob = new DataControl.Repository.AzureBlobUpload();
                string accKey   = iConfigPro.GetConfigValue("SWAASBLOBACCKEY");
                string userName = objCurInfo.GetUserName();
                string compCode = objCurInfo.GetCompanyCode();
                string fileName = "TPMASTERALUMINI_" + "_" + compCode + "_" + userName + ".xls";
                blobUrl = objAzureBlob.AzureBlobUploadText(strContent.ToString(), accKey, fileName, "bulkdatasvc");
                strContent.Clear();
                strContent.Append(blobUrl);
            }
            return(strContent.ToString());
        }