/// <summary> /// DownLoad The ActivityMasterDetails into Excel /// </summary> public void PutActivityMasterIntoExcel() { string error = string.Empty; StringBuilder sb = new StringBuilder(); try { string companyCode = _objcurrentInfo.GetCompanyCode(); DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); DataControl.Abstraction.IFileProvider objProvider = new DataControl.Impl.FileSystemProvider(); BLMaster Master = new BLMaster(); DataSet dsActivityMaster = new DataSet(); dsActivityMaster = Master.GetLeaveTypeDetails(companyCode); //dsc sb.Append("<table WIDTH='75%' id='tblsummary' class='table table-striped'>"); sb.Append("<thead class='active'>"); sb.Append("<tr style='background-color:#428bca;'>"); sb.Append("<td>Activity Name</td>"); sb.Append("<td>Start Date</td>"); sb.Append("<td>End Date</td>"); sb.Append("<td>Status</td>"); sb.Append("</tr>"); sb.Append("<tbody>"); // if (dsActivityMaster != null && dsActivityMaster.Tables[0] != null && dsActivityMaster.Tables[0].Rows.Count > 0) { for (int i = 0; i < dsActivityMaster.Tables[0].Rows.Count; i++) { sb.Append("<td id='Activity_Name" + i + "'style='text-align:left;'>" + dsActivityMaster.Tables[0].Rows[i]["Activity_Name"] + "</td>"); sb.Append("<td id='Start_Date" + i + " 'style='text-align:left;'>" + dsActivityMaster.Tables[0].Rows[i]["Start_Date"] + "</td>"); sb.Append("<td id='End_Date" + i + " ' style='text-align:left;'>" + dsActivityMaster.Tables[0].Rows[i]["End_Date"] + "</td>"); sb.Append("<td id='Row_Status" + i + " 'style='text-align:left;'>" + dsActivityMaster.Tables[0].Rows[i]["Row_Status"] + "</td></tr>"); } } else { sb.Append("<tr><td>No records To Display</td></tr>"); } sb.Append("</tbody>"); sb.Append("</table>"); DataControl.Abstraction.IConfigProvider iConfigPro = new DataControl.Impl.ConfigProvider(); DataControl.Repository.AzureBlobUpload objAzureBlob = new DataControl.Repository.AzureBlobUpload(); string accKey = iConfigPro.GetConfigValue("SWAASBLOBACCKEY"); string userName = _objcurrentInfo.GetUserName(); string subdomainName = System.Web.HttpContext.Current.Request.Url.DnsSafeHost;; string fileName = "ActivityMaster" + " - " + subdomainName + " - " + userName + ".xls"; string blobUrl = objAzureBlob.AzureBlobUploadText(sb.ToString(), accKey, fileName, "bulkdatasvc"); objFileDownload.DownloadFile(blobUrl, fileName, out error); } catch (Exception ex) { Dictionary <string, string> dicContext = new Dictionary <string, string>(); DataControl.Impl.ExceptionHandler.WriteLog(ex, dicContext); } }
public void GetHolidayExcelDownload(FormCollection coll) { string blobUrl = string.Empty, error = string.Empty; DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); string holidayDate = string.Empty; if (!string.IsNullOrEmpty(coll["hdnSearchDate"])) { holidayDate = Convert.ToString(coll["hdnSearchDate"]); } try { System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; DataControl.CurrentInfo _objCurr = new DataControl.CurrentInfo(); string content = GetSearchHolidayDetails(holidayDate); DataControl.Abstraction.IConfigProvider iConfigPro = new DataControl.Impl.ConfigProvider(); DataControl.Repository.AzureBlobUpload objAzureBlob = new DataControl.Repository.AzureBlobUpload(); string accKey = iConfigPro.GetConfigValue("SWAASBLOBACCKEY"); string userName = _objCurr.GetUserName(); string subDomin = _objCurr.GetSubDomain(); string fileName = "HolidayMaster" + "_" + subDomin + "_" + userName + ".xls"; blobUrl = objAzureBlob.AzureBlobUploadText(content.ToString(), accKey, fileName, "bulkdatasvc"); objFileDownload.DownloadFile(blobUrl, fileName, out error); } catch (Exception ex) { Dictionary <string, string> dicObj = new Dictionary <string, string>(); DataControl.Impl.ExceptionHandler.WriteLog(ex: ex, dic: dicObj); } }
public ActionResult GetDocumentByDocId(FormCollection coll) { DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); DataControl.Abstraction.IFileProvider objProvider = new DataControl.Impl.FileSystemProvider(); string docmentURL = string.Empty; string fileName = string.Empty; string docmentId = string.Empty; string error = ""; string DOCSS = coll["docid"].ToString(); if (!string.IsNullOrEmpty(DOCSS)) { byte[] docIdDncode = System.Convert.FromBase64String(DOCSS); String docId = System.Text.Encoding.UTF8.GetString(docIdDncode); //docmentId = docId; docmentURL = _objBlMaster.GetDocumentbyDocId(_objcurrentInfo.GetCompanyCode(), _objcurrentInfo.GetUserCode(), docId); if (!string.IsNullOrEmpty(docmentURL.Split('#')[0])) { //fileName = docmentURL.Substring(docmentURL.LastIndexOf(("/")) + 1); int updatedResult = _objBlMaster.UpdateMyDocMentforDownload(_objcurrentInfo.GetCompanyCode(), _objcurrentInfo.GetUserCode(), docId, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff"), _objcurrentInfo.GetUserCode()); } } objFileDownload.DownloadFile(docmentURL.Split('#')[0], docmentURL.Split('#')[1], out error); return(new EmptyResult()); }
public void DownloadSFCExcelFormat(FormCollection col) { System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); DataControl.Abstraction.IFileProvider objProvider = new DataControl.Impl.FileSystemProvider(); _objCurrentInfo = new CurrentInfo(); string regioncode = col["hdnRegionCode"].ToString(); string sfcStatus = col["SFCStatus"].ToString(); int archived = Convert.ToInt32(col["rdoShowArchived"].ToString()); int totalPageNo = 0; string error = ""; List <SFCRegionModel> lstRegionModel = GetSFCRegions(regioncode, 1, true, ref totalPageNo, "", "", "", sfcStatus, archived).ToList(); string SFCGrid = SFCExcelTable(lstRegionModel); DataControl.Abstraction.IConfigProvider iConfigPro = new DataControl.Impl.ConfigProvider(); DataControl.Repository.AzureBlobUpload objAzureBlob = new DataControl.Repository.AzureBlobUpload(); string accKey = iConfigPro.GetConfigValue("SWAASBLOBACCKEY"); string userName = _objCurrentInfo.GetUserName(); string compCode = _objCurrentInfo.GetCompanyCode(); string fileName = "SFCMASTER" + "_" + compCode + "_" + userName + ".xls"; string blobUrl = objAzureBlob.AzureBlobUploadText(SFCGrid, accKey, fileName, "bulkdatasvc"); objFileDownload.DownloadFile(blobUrl, fileName, out error); }
/// <summary> /// DownLoad The statusMasterDetails into Excel /// </summary> /// <returns></returns> public void PutStatusMasterIntoExcel() { string companycode = _objcurrentInfo.GetCompanyCode(); string error = string.Empty; try { List <StatusMasterModel> lstStatusMaster = (List <StatusMasterModel>)GetStatusMasterDetails(); StringBuilder sb = new StringBuilder(); BLMaster objMaster = new BLMaster(); DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); DataControl.Abstraction.IFileProvider objProvider = new DataControl.Impl.FileSystemProvider(); sb.Append("<table WIDTH='40%' id='tblsummary' class='table table-striped'>"); sb.Append("<thead class='active'>"); sb.Append("<tr style='background-color:#428bca;'>"); sb.Append("<td>Status Name</td>"); sb.Append("<td>Display Name</td>"); sb.Append("<td>Status</td>"); sb.Append("</tr>"); sb.Append("</thead>"); sb.Append("<tbody>"); if (lstStatusMaster != null && lstStatusMaster.Count > 0) { int i = 0; foreach (var lstStatus in lstStatusMaster) { i++; sb.Append("<td id='Status_Name" + i + "'>" + lstStatus.Status_Name + "</td>"); sb.Append("<td id='Display_Name" + i + "'>" + lstStatus.Display_Name + "</td>"); sb.Append("<td id='Record_Status" + i + "'>" + lstStatus.Record_Status + "</td></tr>"); } } else { sb.Append("<span>No Records TO Display</span>"); } sb.Append("</body>"); sb.Append("</table>"); DataControl.Abstraction.IConfigProvider iConfigPro = new DataControl.Impl.ConfigProvider(); DataControl.Repository.AzureBlobUpload objAzureBlob = new DataControl.Repository.AzureBlobUpload(); string accKey = iConfigPro.GetConfigValue("SWAASBLOBACCKEY"); string userName = _objcurrentInfo.GetUserName(); string subdomainName = System.Web.HttpContext.Current.Request.Url.DnsSafeHost;; string fileName = "Status Master" + " - " + subdomainName + " - " + userName + ".xls"; string blobUrl = objAzureBlob.AzureBlobUploadText(sb.ToString(), accKey, fileName, "bulkdatasvc"); objFileDownload.DownloadFile(blobUrl, fileName, out error); } catch (Exception ex) { Dictionary <string, string> dicContext = new Dictionary <string, string>(); DataControl.Impl.ExceptionHandler.WriteLog(ex, dicContext); } }
//For excell public void PutRequestCategoryMasterIntoExcel() { string blobUrl = string.Empty; string error = string.Empty; StringBuilder sbTableContent = new StringBuilder(); DataControl.CurrentInfo _objCurrentInfo = new DataControl.CurrentInfo(); string companyCode = _objCurrentInfo.GetCompanyCode(); StringBuilder sb = new StringBuilder(); DataControl.BLMaster _objBlmaster = new DataControl.BLMaster(); DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); try { DataControl.JSONConverter json = new DataControl.JSONConverter(); List <RequestCategoryMasterModel> lstRequestMap = new List <RequestCategoryMasterModel>(); DataControl.BLMaster _objMapping = new DataControl.BLMaster(); lstRequestMap = (List <RequestCategoryMasterModel>)_objMapping.GetRequestCategoryDetail(companyCode); if (lstRequestMap != null && lstRequestMap.Count > 0) { sbTableContent.Append("<table id='tblrequest' class='table table-striped' >"); sbTableContent.Append("<thead class='active'>"); sbTableContent.Append("<tr style='background-color: #428bca'>"); sbTableContent.Append("<td>Request Category Name</td>"); sbTableContent.Append("<td>Status</td>"); sbTableContent.Append("</tr>"); sbTableContent.Append("</thead>"); sbTableContent.Append("<tbody>"); foreach (var item in lstRequestMap) { sbTableContent.Append("<tr><td>" + item.Request_Category_Name + "</td>"); sbTableContent.Append("<td>" + item.Request_Category_Status + "</td></tr>"); } } sbTableContent.Append("</tbody>"); sbTableContent.Append("</table>"); DataControl.Abstraction.IConfigProvider iConfigPro = new DataControl.Impl.ConfigProvider(); DataControl.Repository.AzureBlobUpload objAzureBlob = new DataControl.Repository.AzureBlobUpload(); string accKey = iConfigPro.GetConfigValue("SWAASBLOBACCKEY"); string userName = _objCurrentInfo.GetUserName(); string subdomainName = System.Web.HttpContext.Current.Request.Url.DnsSafeHost;; string fileName = "RequestCategoryMaster " + " - " + subdomainName + " - " + userName + ".xls"; blobUrl = objAzureBlob.AzureBlobUploadText(sbTableContent.ToString(), accKey, fileName, "bulkdatasvc"); objFileDownload.DownloadFile(blobUrl, fileName, out error); } catch (Exception ex) { Dictionary <string, string> dicContext = new Dictionary <string, string>();; DataControl.Impl.ExceptionHandler.WriteLog(ex, dicContext); } }
public void PutPayslipmetadataintoExcel() { string error = string.Empty; StringBuilder sb = new StringBuilder(); try { DataControl.BLUser objBlUser = new BLUser(); DataControl.CurrentInfo _objCurInfo = new DataControl.CurrentInfo(); string companyCode = _objCurInfo.GetCompanyCode(); DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); DataControl.Abstraction.IFileProvider objProvider = new DataControl.Impl.FileSystemProvider(); List <MVCModels.HiDoctor_Master.PaySlipMetaDataModel> lstdata = new List <MVCModels.HiDoctor_Master.PaySlipMetaDataModel>(); lstdata = objBlUser.GetpaysliprefsheetDetail(companyCode).ToList(); DataControl.Abstraction.IConfigProvider iConfigPro = new DataControl.Impl.ConfigProvider(); DataControl.Repository.AzureBlobUpload objAzureBlob = new DataControl.Repository.AzureBlobUpload(); string accKey = iConfigPro.GetConfigValue("SWAASBLOBACCKEY"); sb.Append("<table WIDTH='40%' id='tblpaysummary' class='table table-striped'>"); sb.Append("<thead class='active'>"); sb.Append("<tr style='background-color:#428bca;'>"); sb.Append("<td>User Type Name</td>"); sb.Append("<td>Column No</td>"); sb.Append("<td>Column Name</td>"); sb.Append("<td>DataTypeName</td>"); sb.Append("</tr>"); sb.Append("</thead>"); sb.Append("<tbody>"); if (lstdata.Count > 0) { foreach (var lstPayMetadata in lstdata) { sb.Append("<tr><td>" + lstPayMetadata.User_Type_Name + "</td>"); sb.Append("<td>" + lstPayMetadata.Column_No + "</td>"); sb.Append("<td>" + lstPayMetadata.Column_Name + "</td>"); sb.Append("<td>" + lstPayMetadata.DataTypeAliasName + "</td></tr>"); } } string userName = _objCurInfo.GetUserName(); string subdomainName = System.Web.HttpContext.Current.Request.Url.DnsSafeHost;; string fileName = "PaySlipMetaData" + " - " + subdomainName + " - " + userName + ".xls"; string blobUrl = objAzureBlob.AzureBlobUploadText(sb.ToString(), accKey, fileName, "bulkdatasvc"); objFileDownload.DownloadFile(blobUrl, fileName, out error); } catch (Exception ex) { Dictionary <string, string> dicContext = new Dictionary <string, string>(); DataControl.Impl.ExceptionHandler.WriteLog(ex, dicContext); } }
public void PutProjectActivityIntoAzure(FormCollection coll) { try { string error = string.Empty; DataControl.BLMaster _objBlMaster = new DataControl.BLMaster(); DataControl.CurrentInfo _objCurInfo = new DataControl.CurrentInfo(); DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); DataControl.Abstraction.IFileProvider objProvider = new DataControl.Impl.FileSystemProvider(); StringBuilder tblBuilder = new StringBuilder(); string companyCode = _objCurInfo.GetCompanyCode(); int rowNum = 0; DataSet dsProjActMapp = _objBlMaster.GetSalesActivityMapping(companyCode); if (dsProjActMapp != null && dsProjActMapp.Tables.Count > 0 && dsProjActMapp.Tables[0].Rows.Count > 0) { tblBuilder.Append("<table id='tblSFC' class='table table-striped' cellpadding='0' cellspacing='0'>"); tblBuilder.Append("<thead><tr><th>Project Name</th><th>Activity Name</th><th>Start Date</th><th>End Date</th><th>Status</th></tr></thead>"); tblBuilder.Append("<tbody>"); foreach (DataRow dr in dsProjActMapp.Tables[0].Rows) { rowNum++; tblBuilder.Append("<tr>"); tblBuilder.Append("<td>" + dr["Project_Name"].ToString() + "<input type='hidden' id='hdnProjCode_" + rowNum + "' value='" + dr["Project_Code"].ToString() + "' /></td>"); tblBuilder.Append("<td>" + dr["Activity_Name"].ToString() + "<input type='hidden' id='hdnActivityCode_" + rowNum + "' value='" + dr["Activity_Code"].ToString() + "' /></td>"); tblBuilder.Append("<td id='tdStartDate_" + rowNum + "'>" + dr["StartDate"].ToString() + "</td>"); tblBuilder.Append("<td id='tdEndDate_" + rowNum + "'>" + dr["EndDate"].ToString() + "</td>"); tblBuilder.Append("<td id='tdStatus_" + rowNum + "'>" + dr["Status"].ToString() + "</td>"); tblBuilder.Append("</tr>"); } tblBuilder.Append("</tbody>"); tblBuilder.Append("</table>"); } 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 subdomainName = HttpContext.Request.Url.DnsSafeHost.ToString(); string fileName = "ProjectActivityMapping" + " - " + subdomainName + " - " + userName + ".xls"; string blobUrl = objAzureBlob.AzureBlobUploadText(tblBuilder.ToString(), accKey, fileName, "bulkdatasvc"); objFileDownload.DownloadFile(blobUrl, fileName, out error); } catch (Exception ex) { Dictionary <string, string> dicObj = new Dictionary <string, string>(); DataControl.Impl.ExceptionHandler.WriteLog(ex, dicObj); } }
public void DownloadInwardExcelTemplate() { System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); DataControl.Abstraction.IFileProvider objProvider = new DataControl.Impl.FileSystemProvider(); string error = string.Empty; string fileName = "BulkInwardUpload.xlsx"; string blobURL = objProvider.GetConfigValue("EXCELTEMPLATES") + fileName; objFileDownload.DownloadFile(blobURL, fileName, out error); }
/// <summary> /// Method is Used to DownLoad the Subregion master in Excel /// </summary> public void PutSubRegionMasterIntoExcel() { string companycode = _objcurrentInfo.GetCompanyCode(); string error = string.Empty; try { DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); DataControl.Abstraction.IFileProvider objProvider = new DataControl.Impl.FileSystemProvider(); StringBuilder strTbl = new StringBuilder(); BLMaster _objBlMaster = new BLMaster(); List <SubRegionMasterModel> lstSubRegionMaster = _objBlMaster.GetSubRegionMaster(companycode).ToList(); if (lstSubRegionMaster != null && lstSubRegionMaster.Count() > 0) { strTbl.Append("<div class='table-responsive'>"); strTbl.Append("<table class='table table-striped' id='tblSubRegion' cellspacing='0' cellpadding='0'>"); strTbl.Append("<thead>"); strTbl.Append("<tr>"); strTbl.Append("<th>Sub Region Name</th>"); strTbl.Append("<th>Under Region</th>"); strTbl.Append("<th>Status</th></tr>"); strTbl.Append("</thead>"); strTbl.Append("<tbody>"); int rowCount = 0; foreach (var subRegion in lstSubRegionMaster) { strTbl.Append("<tr id='" + rowCount + "'>"); strTbl.Append("<td>" + subRegion.SubRegion_Name + "</td>"); strTbl.Append("<td>" + subRegion.UnderRegion + " </td>"); strTbl.Append("<td>" + subRegion.SubRegion_Status + " </td>"); strTbl.Append("<tr>"); } strTbl.Append("</tbody>"); strTbl.Append("</table></div>"); } DataControl.Abstraction.IConfigProvider iConfigPro = new DataControl.Impl.ConfigProvider(); DataControl.Repository.AzureBlobUpload objAzureBlob = new DataControl.Repository.AzureBlobUpload(); string accKey = iConfigPro.GetConfigValue("SWAASBLOBACCKEY"); string userName = _objcurrentInfo.GetUserName(); string subdomainName = System.Web.HttpContext.Current.Request.Url.DnsSafeHost;; string fileName = "SubRegion Master" + " - " + subdomainName + " - " + userName + ".xls"; string blobUrl = objAzureBlob.AzureBlobUploadText(strTbl.ToString(), accKey, fileName, "bulkdatasvc"); objFileDownload.DownloadFile(blobUrl, fileName, out error); } catch (Exception ex) { Dictionary <string, string> dicContext = new Dictionary <string, string>(); DataControl.Impl.ExceptionHandler.WriteLog(ex, dicContext); } }
public void DownloadPrimarySalesExcelTemplate() { try { System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); DataControl.Abstraction.IFileProvider objProvider = new DataControl.Impl.FileSystemProvider(); string error = string.Empty; string fileName = "PrimarySales.xls"; string blobURL = objProvider.GetConfigValue("EXCELTEMPLATES") + fileName; objFileDownload.DownloadFile(blobURL, fileName, out error); } catch (Exception ex) { Dictionary <string, string> dicObj = new Dictionary <string, string>(); DataControl.Impl.ExceptionHandler.WriteLog(ex: ex, dic: dicObj); } }
/// <summary> /// /// </summary> /// <returns></returns> //public ActionResult DownloadRegionExcelTemplate() //{ // return new DownloadResult { VirtualPath = "~/Content/XLTemplates/Region_Upload.xlsx", FileDownloadName = "Region_Upload.xlsx" }; // //return new DownloadResult { VirtualPath = "~/Content/XLTemplates/" + File_Name.ToUpper() + "_MASTER.csv", FileDownloadName = File_Name.ToUpper() + "_MASTER.csv" }; //} public void DownloadRegionExcelTemplate() { try { DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); DataControl.Abstraction.IFileProvider objProvider = new DataControl.Impl.FileSystemProvider(); string error = string.Empty; string fileName = "Region_Upload.xlsx"; string blobURL = objProvider.GetConfigValue("EXCELTEMPLATES") + fileName; objFileDownload.DownloadFile(blobURL, fileName, out error); // return new DownloadResult { VirtualPath = "~/Content/XLTemplates/EmployeeMaster.xls", FileDownloadName = "EmployeeMaster.xls" }; //return new DownloadResult { VirtualPath = "~/Content/XLTemplates/" + File_Name.ToUpper() + "_MASTER.csv", FileDownloadName = File_Name.ToUpper() + "_MASTER.csv" }; } catch (Exception ex) { throw ex; } }
public void PutDCRRequestScreenintoExcel() { string companycode = _objcurrentInfo.GetCompanyCode(); string userCode = _objcurrentInfo.GetUserCode(); string error = string.Empty; try { List <DCRRestrictionModel> lstDCRRequestMaster = new List <DCRRestrictionModel>(); StringBuilder sb = new StringBuilder(); BLMaster objMaster = new BLMaster(); DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); DataControl.Abstraction.IFileProvider objProvider = new DataControl.Impl.FileSystemProvider(); lstDCRRequestMaster = objMaster.GetRequestScreenforDcrRestrict(companycode, userCode).ToList(); sb.Append("<table WIDTH='70%' id='tblsummary' class='table table-striped'>"); sb.Append("<thead class='active'>"); sb.Append("<tr style='background-color:#428bca;'>"); sb.Append("<td>Region Category</td>"); sb.Append("<td>Period</td>"); sb.Append("<td>Admin Remarks</td>"); sb.Append("<td>User Remarks</td>"); sb.Append("<td>Status</td>"); sb.Append("</tr>"); sb.Append("</thead>"); sb.Append("<tbody>"); if (lstDCRRequestMaster != null && lstDCRRequestMaster.Count > 0) { int i = 0; foreach (var lstRequest in lstDCRRequestMaster) { i++; sb.Append("<td id='Request_Category_Name_" + lstRequest.Request_Id + "'>"); sb.Append(lstRequest.Request_Category_Name); sb.Append("</td>"); sb.Append("<td id='Request_period_" + lstRequest.Request_Id + "'>"); sb.Append(lstRequest.Date_From); sb.Append(" to "); sb.Append(lstRequest.Date_To); sb.Append("</td>"); sb.Append("<td>" + lstRequest.Admin_Remarks + "</td>"); sb.Append("<td>" + lstRequest.Requesting_User_Remarks + "</td>"); sb.Append("<td id='Record_Status_" + lstRequest.Request_Id + "'>" + lstRequest.Request_Status + "</td></tr>"); } } else { sb.Append("No Records TO Display."); } sb.Append("</body>"); sb.Append("</table>"); DataControl.Abstraction.IConfigProvider iConfigPro = new DataControl.Impl.ConfigProvider(); DataControl.Repository.AzureBlobUpload objAzureBlob = new DataControl.Repository.AzureBlobUpload(); string accKey = iConfigPro.GetConfigValue("SWAASBLOBACCKEY"); string userName = _objcurrentInfo.GetUserName(); string subdomainName = System.Web.HttpContext.Current.Request.Url.DnsSafeHost;; string fileName = "DCR_Request_Screen" + " - " + subdomainName + " - " + userName + ".xls"; string blobUrl = objAzureBlob.AzureBlobUploadText(sb.ToString(), accKey, fileName, "bulkdatasvc"); objFileDownload.DownloadFile(blobUrl, fileName, out error); } catch (Exception ex) { Dictionary <string, string> dicContext = new Dictionary <string, string>(); DataControl.Impl.ExceptionHandler.WriteLog(ex, dicContext); } }
/// <summary> /// Method is used to download the ProductpriceMaster into Excel /// </summary> /// <returns></returns> public void PutProductPricemasterIntoExcel() { string companycode = _objcurrentInfo.GetCompanyCode(); string error = string.Empty; try { List <ProductPriceMasterModel> lstproductpriceMastermodel = (List <ProductPriceMasterModel>)GetProductPriceDetails(); StringBuilder sb = new StringBuilder(); BLMaster objMaster = new BLMaster(); DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); DataControl.Abstraction.IFileProvider objProvider = new DataControl.Impl.FileSystemProvider(); sb.Append("<table WIDTH='70%' id='tblsummary' class='table table-striped'>"); sb.Append("<thead class='active'>"); sb.Append("<tr style='background-color:#428bca;'>"); sb.Append("<td>Edit</td>"); sb.Append("<td>Change Status</td>"); sb.Append("<td>Region Type</td>"); sb.Append("<td>Region</td>"); sb.Append("<td>Product</td>"); sb.Append("<td>Price</td>"); sb.Append("<td>Effective From</td>"); sb.Append("<td>Effective To</td>"); sb.Append("<td>Status</td>"); sb.Append("</tr>"); sb.Append("</thead>"); sb.Append("<tbody>"); if (lstproductpriceMastermodel != null && lstproductpriceMastermodel.Count > 0) { int i = 0; foreach (var lstproductprice in lstproductpriceMastermodel) { i++; sb.Append("<tr><td class='td-a'><a id='E" + i + "' onclick='fnEdit(this)'>Edit</a></td>"); sb.Append("<td class='td-a'><a id='C" + i + "' onclick='fnchangeStatus(this)'>Change Status</a></td>"); sb.Append("<td style='display:none' id='Price_Code" + i + "'>" + lstproductprice.Price_Code + "</td>"); sb.Append("<td id='Region_Type_Name" + i + "'>" + lstproductprice.Region_Type_Name + "</td>"); sb.Append("<td style='display:none' id='Region_Type_Code" + i + "'>" + lstproductprice.Region_Type_Code + "</td>"); sb.Append("<td id='Region_Name" + i + "'>" + lstproductprice.Region_Name + "</td>"); sb.Append("<td style='display:none' id='Region_Code" + i + "'>" + lstproductprice.Region_Code + "</td>"); sb.Append("<td id='Product_Name" + i + "'>" + lstproductprice.Product_Name + "</td>"); sb.Append("<td style='display:none' id='Product_Code" + i + "'>" + lstproductprice.Product_Code + "</td>"); sb.Append("<td id='Price" + i + "'>" + lstproductprice.Price + "</td>"); sb.Append("<td id='Effective_From" + i + "'>" + lstproductprice.Effective_From + "</td>"); sb.Append("<td id='Effective_To" + i + "'>" + lstproductprice.Effective_To + "</td>"); sb.Append("<td id='Price_Status" + i + "'>" + lstproductprice.Price_Status + "</td>"); } } else { sb.Append("<span>No Records TO Display</span>"); } sb.Append("</body>"); sb.Append("</table>"); DataControl.Abstraction.IConfigProvider iConfigPro = new DataControl.Impl.ConfigProvider(); DataControl.Repository.AzureBlobUpload objAzureBlob = new DataControl.Repository.AzureBlobUpload(); string accKey = iConfigPro.GetConfigValue("SWAASBLOBACCKEY"); string userName = _objcurrentInfo.GetUserName(); string subdomainName = System.Web.HttpContext.Current.Request.Url.DnsSafeHost;; string fileName = "ProductpriceMaster" + " - " + subdomainName + " - " + userName + ".xls"; string blobUrl = objAzureBlob.AzureBlobUploadText(sb.ToString(), accKey, fileName, "bulkdatasvc"); objFileDownload.DownloadFile(blobUrl, fileName, out error); } catch (Exception ex) { Dictionary <string, string> dicContext = new Dictionary <string, string>(); DataControl.Impl.ExceptionHandler.WriteLog(ex, dicContext); } }
//For excell public void PutRegionTypeMasterIntoExcel() { string blobUrl = string.Empty; string error = string.Empty; StringBuilder sbTableContent = new StringBuilder(); DataControl.CurrentInfo _objCurrentInfo = new DataControl.CurrentInfo(); StringBuilder sb = new StringBuilder(); DataControl.BLMaster _objBlmaster = new DataControl.BLMaster(); DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); try { DataSet ds = new DataSet(); ds = _objBlmaster.GetRegiontypeDetailsAll(_objCurrentInfo.GetCompanyCode()); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { sbTableContent.Append("<table id='tblRegionsummary' class='table table-striped' >"); sbTableContent.Append("<thead class='active'>"); sbTableContent.Append("<tr style='background-color: #428bca'>"); sbTableContent.Append("<td>Region Type Name</td>"); sbTableContent.Append("<td>Under Region</td>"); sbTableContent.Append("<td>Status</td>"); sbTableContent.Append("</tr>"); sbTableContent.Append("</thead>"); sbTableContent.Append("<tbody>"); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { sbTableContent.Append("<tr>"); sbTableContent.Append("<td>" + ds.Tables[0].Rows[i]["Region_Type_Name"] + "</td>"); sbTableContent.Append("<td>" + ds.Tables[0].Rows[i]["UnderRegion"] + "</td>"); sbTableContent.Append("<td>" + ds.Tables[0].Rows[i]["Status"] + "</td></tr>"); } } else { sbTableContent.Append("<tr><td>No records To Display</td></tr>"); } sbTableContent.Append("</tbody>"); sbTableContent.Append("</table>"); DataControl.Abstraction.IConfigProvider iConfigPro = new DataControl.Impl.ConfigProvider(); DataControl.Repository.AzureBlobUpload objAzureBlob = new DataControl.Repository.AzureBlobUpload(); string accKey = iConfigPro.GetConfigValue("SWAASBLOBACCKEY"); string userName = _objCurrentInfo.GetUserName(); string subdomainName = System.Web.HttpContext.Current.Request.Url.DnsSafeHost;; string fileName = "RegionTypeMaster " + " - " + subdomainName + " - " + userName + ".xls"; blobUrl = objAzureBlob.AzureBlobUploadText(sbTableContent.ToString(), accKey, fileName, "bulkdatasvc"); objFileDownload.DownloadFile(blobUrl, fileName, out error); } catch (Exception ex) { Dictionary <string, string> dicContext = new Dictionary <string, string>();; DataControl.Impl.ExceptionHandler.WriteLog(ex, dicContext); } }
public string GetDoctorDeviationReportDetails(string startDate, string endDate, string statusName, string userCode, string userName, string dcrStatus, string reportFormat) { StringBuilder strTblContent = new StringBuilder(); string blobUrl = string.Empty; try { DataControl.CurrentInfo objCurInfo = new CurrentInfo(); DataControl.BLUser objUser = new BLUser(); DataControl.BAL_DoctorVisitAnalysis objDoctorVisit = new BAL_DoctorVisitAnalysis(); IEnumerable <MVCModels.HiDoctor_Master.UserModel> lstUser = null; IEnumerable <MVCModels.DCRHeaderModel> lstHeader = null; IEnumerable <MVCModels.DCRDoctorVisitModel> lstDoctors = null; strTblContent.Append(objUser.GetReportHeaderTableString(objCurInfo.GetCompanyCode(), userCode, startDate, endDate, statusName, "")); lstHeader = objDoctorVisit.GetDCRHeaderByStatusAndDate(objCurInfo.GetCompanyCode(), dcrStatus, userCode, startDate, endDate); StringBuilder strAcc = new StringBuilder(); ArrayList al = new ArrayList(); if (lstHeader != null) { #region get dcr header info foreach (var dr in lstHeader) { if (!string.IsNullOrEmpty(Convert.ToString(dr.Acc1_Name))) { if (!al.Contains(Convert.ToString(dr.Acc1_Name))) { strAcc.Append(Convert.ToString(dr.Acc1_Name).Trim() + "^"); al.Add(Convert.ToString(dr.Acc1_Name).Trim()); } } if (!string.IsNullOrEmpty(Convert.ToString(dr.Acc2_Name))) { if (!al.Contains(Convert.ToString(dr.Acc2_Name))) { strAcc.Append(Convert.ToString(dr.Acc2_Name) + "^"); al.Add(Convert.ToString(dr.Acc2_Name).Trim()); } } if (!string.IsNullOrEmpty(Convert.ToString(dr.Acc3_Name))) { if (!al.Contains(Convert.ToString(dr.Acc3_Name))) { strAcc.Append(Convert.ToString(dr.Acc3_Name) + "^"); al.Add(Convert.ToString(dr.Acc3_Name).Trim()); } } if (!string.IsNullOrEmpty(Convert.ToString(dr.Acc4_Name))) { if (!al.Contains(Convert.ToString(dr.Acc4_Name))) { strAcc.Append(Convert.ToString(dr.Acc4_Name) + "^"); al.Add(Convert.ToString(dr.Acc4_Name).Trim()); } } } strAcc.Append(userName.Split(',')[0] + "^"); #endregion dcr header info lstDoctors = objDoctorVisit.GetDCRDoctorsByUserName(objCurInfo.GetCompanyCode(), dcrStatus, strAcc.ToString(), startDate, endDate); strTblContent.Append("<table class='table table-striped'>"); strTblContent.Append("<thead><tr><th>Date</th><th>" + userName + "</th>"); foreach (string accName in al) { strTblContent.Append("<th>Doctors met by " + accName + "</th>"); } strTblContent.Append("<th>Doctor Missed</th>"); strTblContent.Append("<th>Doctor Deviation</th></thead><tbody>"); if (lstDoctors != null) { foreach (var dr in lstHeader) { StringBuilder strDoctorContent = new StringBuilder(); strTblContent.Append("<tr><td>" + dr.DCR_Date + "</td>"); var disDcr = lstDoctors.AsEnumerable().Where(a => a.DCR_Actual_Date == dr.DCR_Date && a.User_Name.ToUpper() == userName.Split(',')[0].ToString().ToUpper()).ToList(); ArrayList alManagerDocs = new ArrayList(); ArrayList alChildDocs = new ArrayList(); if (disDcr.Count > 0) { strDoctorContent.Append("<table>"); foreach (var doc in disDcr) { strDoctorContent.Append("<tr><td>" + doc.Doctor_Name + "</td></tr>"); alManagerDocs.Add(doc.Doctor_Name); } strDoctorContent.Append("</table>"); strTblContent.Append("<td>" + strDoctorContent.ToString() + "</td>"); foreach (string accName in al) { StringBuilder strAccDocs = new StringBuilder(); if (accName == Convert.ToString(dr.Acc1_Name).Trim() || accName == Convert.ToString(dr.Acc2_Name).Trim() || accName == Convert.ToString(dr.Acc3_Name).Trim() || accName == Convert.ToString(dr.Acc4_Name).Trim()) { var lstAcc = lstDoctors.AsEnumerable().Where(b => b.DCR_Actual_Date == dr.DCR_Date && b.User_Name == accName).ToList(); if (lstAcc.Count > 0) { strAccDocs.Append("<table>"); foreach (var accDoc in lstAcc) { strAccDocs.Append("<tr><td>" + accDoc.Doctor_Name + "</td></tr>"); alChildDocs.Add(accDoc.Doctor_Name); } strAccDocs.Append("</table>"); } } strTblContent.Append("<td>" + strAccDocs.ToString() + "</td>"); } strDoctorContent.Clear(); #region doctor missed count if (alChildDocs.Count > 0) { strDoctorContent.Append("<table>"); foreach (string childDoctor in alChildDocs) { if (!alManagerDocs.Contains(childDoctor)) { strDoctorContent.Append("<tr><td>" + childDoctor.Trim() + "</td></tr>"); } } strDoctorContent.Append("</table>"); } strTblContent.Append("<td>" + strDoctorContent.ToString() + "</td>"); #endregion doctor missed count #region doctor deviation strDoctorContent.Clear(); int count = 0; if (alManagerDocs.Count > 0) { strDoctorContent.Append("<table>"); foreach (string managerDoctor in alManagerDocs) { if (!alChildDocs.Contains(managerDoctor)) { count++; strDoctorContent.Append("<tr><td>" + managerDoctor.Trim() + "</td></tr>"); } } strDoctorContent.Append("</table>"); if (count < 0) { strDoctorContent.Clear(); } } strTblContent.Append("<td>" + strDoctorContent + "</td>"); #endregion doctor deviation } strTblContent.Append("</tr>"); } } } if (reportFormat == "2") { DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); DataControl.CurrentInfo _objCurr = new CurrentInfo(); DataControl.Abstraction.IConfigProvider iConfigPro = new DataControl.Impl.ConfigProvider(); DataControl.Repository.AzureBlobUpload objAzureBlob = new DataControl.Repository.AzureBlobUpload(); string accKey = iConfigPro.GetConfigValue("SWAASBLOBACCKEY"); string compCode = _objCurr.GetCompanyCode(); string fileName = "DoctorDeviationReport_" + "_" + compCode + "_" + _objCurr.GetUserName() + ".xls"; string error = string.Empty; //string strExcelContent = GetDoctorDeviationReportDetails(startDate,endDate,statusName,userCode,userName,dcrStatus); blobUrl = objAzureBlob.AzureBlobUploadText(strTblContent.ToString(), accKey, fileName, "bulkdatasvc"); } } catch (Exception ex) { } if (reportFormat == "1") { return(strTblContent.ToString()); } else { return(blobUrl); } }
public void GetDistanceFareChartExcel() { try { List <DistanceFareChartModel> lstDFC = new List <DistanceFareChartModel>(); BLMaster _objMast = new BLMaster(); StringBuilder sbTableContentExcel = new StringBuilder(); string blobUrl = string.Empty, error = string.Empty; DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); lstDFC = _objMast.GetDistanceFareChart(_objCurr.GetCompanyCode()); var lstDistUserType = lstDFC.Select(x => new { x.User_Type_Code, x.User_Type_Name }).Distinct().ToList(); if (lstDFC != null && lstDFC.Count > 0) { //excel sbTableContentExcel.Append("<div style='font-size:14px;width:100%;font-weight:bold;float:left' align='left'>Distance Fare Chart</div>"); sbTableContentExcel.Append("<table class='table table-striped' id='tblDFC' cellspacing='0' cellpadding='0' border='1'>"); sbTableContentExcel.Append("<thead>"); sbTableContentExcel.Append("<tr>"); sbTableContentExcel.Append("<th>From Km</th>"); sbTableContentExcel.Append("<th>To Km</th>"); sbTableContentExcel.Append("<th>Fare Amount</th>"); sbTableContentExcel.Append("<th>User Type</th>"); sbTableContentExcel.Append("<th>Entity</th>"); sbTableContentExcel.Append("<th>Date From</th>"); sbTableContentExcel.Append("<th>Date To</th>"); sbTableContentExcel.Append("<th>Is Amount Fixed</th>"); sbTableContentExcel.Append("<th>Status</th>"); sbTableContentExcel.Append("</tr>"); sbTableContentExcel.Append("</thead>"); sbTableContentExcel.Append("<tbody>"); // foreach (var userType in lstDistUserType) { var lstDist = lstDFC.AsEnumerable().Where(x => x.User_Type_Code == userType.User_Type_Code); if (lstDist != null && lstDist.Count() > 0) { //excel sbTableContentExcel.Append("<tr><th class='collapseHeader' colspan='9'>" + userType.User_Type_Name + "</th></tr>"); // foreach (var item in lstDist) { // excel sbTableContentExcel.Append("<tr >"); sbTableContentExcel.Append("<td >" + item.From_Km.ToString() + "</td>"); sbTableContentExcel.Append("<td >" + item.To_Km.ToString() + "</td>"); sbTableContentExcel.Append("<td >" + item.Fare_Amount.ToString() + "</td>"); sbTableContentExcel.Append("<td >" + item.User_Type_Name.ToString() + "</td>"); sbTableContentExcel.Append("<td >" + item.Entity_Name.ToString() + "</td>"); sbTableContentExcel.Append("<td >" + item.Date_From.ToString() + "</td>"); sbTableContentExcel.Append("<td >" + item.Date_To.ToString() + "</td>"); sbTableContentExcel.Append("<td >" + ((item.Is_Amount_Fixed == "1") ? "Yes" : "No") + "</td>"); sbTableContentExcel.Append("<td >" + ((item.Status == 1) ? "Enabled" : "Disabled") + "</td>"); sbTableContentExcel.Append("</tr>"); // } } } //excel sbTableContentExcel.Append("</tbody></table>"); // } DataControl.Abstraction.IConfigProvider iConfigPro = new DataControl.Impl.ConfigProvider(); DataControl.Repository.AzureBlobUpload objAzureBlob = new DataControl.Repository.AzureBlobUpload(); string accKey = iConfigPro.GetConfigValue("SWAASBLOBACCKEY"); string userName = _objCurr.GetUserName(); string subDomin = _objCurr.GetSubDomain(); string fileName = "DistanceFareChart_" + "_" + subDomin + "_" + userName + ".xls"; blobUrl = objAzureBlob.AzureBlobUploadText(sbTableContentExcel.ToString(), accKey, fileName, "bulkdatasvc"); objFileDownload.DownloadFile(blobUrl, fileName, out error); } catch (Exception ex) { Dictionary <string, string> dicObj = new Dictionary <string, string>(); DataControl.Impl.ExceptionHandler.WriteLog(ex: ex, dic: dicObj); } }
/// <summary> /// Method is used to download the Doctorcategory into Excel /// </summary> /// <returns></returns> public void PutDoctorcategoryIntoExcel() { string companycode = _objcurrentInfo.GetCompanyCode(); string error = string.Empty; try { BLMaster _objmaster = new BLMaster(); List <MVCModels.HiDoctor_Master.DoctorModel> lstdoctcategory = (List <MVCModels.HiDoctor_Master.DoctorModel>)GetdoctorcategoryDetails(); DataControl.Repository.FileDownload objFileDownload = new DataControl.Repository.FileDownload(); DataControl.Abstraction.IFileProvider objProvider = new DataControl.Impl.FileSystemProvider(); //dsc StringBuilder sb = new StringBuilder(); sb.Append("<table WIDTH='100%' id='tblsummary' class='table table-striped' >"); sb.Append("<thead class='active'>"); sb.Append("<tr style='background-color:#428bca;'>"); sb.Append("<td>Doctor Category Name</td>"); sb.Append("<td>Visit Count</td>"); sb.Append("<td>Doctor Count</td>"); sb.Append("<td>Division Name</td>"); sb.Append("<td>Effective From</td>"); sb.Append("<td>Effective To</td>"); sb.Append("<td>Status</td>"); sb.Append("</tr>"); sb.Append("</thead>"); sb.Append("<tbody>"); // if (lstdoctcategory != null && lstdoctcategory.Count > 0) { int i = 0; foreach (var lstdoc in lstdoctcategory) { i++; sb.Append("<tr><td id='Category_Name" + i + "' style='text-align:left;'>" + lstdoc.Category_Name + "</td>"); sb.Append("<td id='Visit_Count" + i + "' style='text-align:left;'>" + lstdoc.Visit_Count + "</td>"); sb.Append("<td id='Doctor_Count" + i + "' style='text-align:left;' >" + lstdoc.Doctor_Count + "</td>"); sb.Append("<td id='Division_Name" + i + "' style='text-align:left;' >" + lstdoc.Division_Name + "</td>"); sb.Append("<td id='Effective_From" + i + "' style='text-align:left;' >" + lstdoc.Effective_From + "</td>"); sb.Append("<td id='Effective_To" + i + "' style='text-align:left;' >" + lstdoc.Effective_To + "</td>"); sb.Append("<td id='status" + i + "' style='text-align:left;'>" + lstdoc.Status + "</td></tr>"); } } sb.Append("</tbody>"); sb.Append("</table>"); DataControl.Abstraction.IConfigProvider iConfigPro = new DataControl.Impl.ConfigProvider(); DataControl.Repository.AzureBlobUpload objAzureBlob = new DataControl.Repository.AzureBlobUpload(); string accKey = iConfigPro.GetConfigValue("SWAASBLOBACCKEY"); string userName = _objcurrentInfo.GetUserName(); string subdomainName = System.Web.HttpContext.Current.Request.Url.DnsSafeHost;; string fileName = "DoctorCategoryMaster" + " - " + subdomainName + " - " + userName + ".xls"; string blobUrl = objAzureBlob.AzureBlobUploadText(sb.ToString(), accKey, fileName, "bulkdatasvc"); objFileDownload.DownloadFile(blobUrl, fileName, out error); } catch (Exception ex) { Dictionary <string, string> dicContext = new Dictionary <string, string>(); DataControl.Impl.ExceptionHandler.WriteLog(ex, dicContext); } }