Ejemplo n.º 1
0
        /// <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);
            }
        }
Ejemplo n.º 2
0
        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());
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public string UploadAttachment()
        {
            var result = "";

            try
            {
                System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

                var    objAzureUpload        = new DataControl.Repository.AzureBlobUpload();
                var    objPathProv           = new DataControl.Impl.FileSystemProvider();
                string accKey                = objPathProv.GetConfigValue("UPLOADEDFILEBLOBACCKEY");
                HttpFileCollectionBase files = Request.Files;
                if (files.Count > 0)
                {
                    for (var i = 0; i < files.Count; i++)
                    {
                        HttpPostedFileBase fileUpload        = files[i];
                        String             fileNametimeStamp = DateTime.Now.ToString("ddMMyyyyHHmmssfff");
                        fileNametimeStamp = fileNametimeStamp + '_' + fileUpload.FileName;
                        string containerName = "ORDERSHIPMENT";
                        result = objAzureUpload.PutAzureBlobStorage(fileUpload.InputStream, fileNametimeStamp, accKey, containerName);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Ejemplo n.º 5
0
        public JsonResult UploadFieldAttachment()
        {
            // Checking no of files injected in Request object
            AzureBlobUpload objblob = new AzureBlobUpload();

            DataControl.Abstraction.IFileProvider objPathProv = new DataControl.Impl.FileSystemProvider();
            string        accKey = objPathProv.GetConfigValue("UPLOADEDFILEBLOBACCKEY");
            List <string> lst    = new List <string>();

            if (Request.Files.Count > 0)
            {
                try
                {
                    //  Get all files from Request object
                    HttpFileCollectionBase files = Request.Files;
                    string containerName         = "MTOAttachment";
                    for (int i = 0; i < files.Count; i++)
                    {
                        HttpPostedFileBase file    = files[i];
                        string             blobUrl = objblob.PutAzureBlobStorage(file.InputStream, file.FileName, accKey, containerName);
                        lst.Add(blobUrl);
                        lst.Add(file.FileName);
                    }
                }
                catch (Exception)
                {
                    string blobUrl = "Failed";
                    lst.Add(blobUrl);
                }
            }
            return(Json(lst, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 6
0
        /// <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);
            }
        }
Ejemplo n.º 7
0
        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);
            }
        }
Ejemplo n.º 8
0
        public string GetAllNoticesReadPopup(string mesgCode)
        {
            DataControl.CurrentInfo objCur = new DataControl.CurrentInfo();
            string companyCode             = objCur.GetCompanyCode();
            string userCode = objCur.GetUserCode();

            try
            {
                StringBuilder sbTableContent = new StringBuilder();
                DataControl.HiDoctor_ActivityFactoryClasses.BL_NoticeBoard _objBlActivity = new DataControl.HiDoctor_ActivityFactoryClasses.BL_NoticeBoard();
                DataControl.CurrentInfo _objCurrentInfo = new DataControl.CurrentInfo();
                IEnumerable <MVCModels.NoticeBoardContentModel> lstdata = null;
                lstdata = _objBlActivity.GetNoticeBoardPopup(companyCode, mesgCode, userCode);
                sbTableContent.Append("</div>");
                sbTableContent.Append("<table id='NoticeBoardpopup' class='table table-striped' style='width:100%;'>");
                DataControl.Repository.AzureBlobUpload objAzureUpload = new DataControl.Repository.AzureBlobUpload();
                DataControl.Abstraction.IFileProvider  objPathProv    = new DataControl.Impl.FileSystemProvider();
                string accKey = objPathProv.GetConfigValue("NBFILES");
                //   string blobURL = objAzureUpload.AzureblockDownload(postedFile.FileName, accKey, containerName);

                foreach (var item in lstdata)
                {
                    sbTableContent.Append("<thead class='active'>");
                    sbTableContent.Append("<tr><td>NoticeBoardInfo</td><td></td></tr>");
                    sbTableContent.Append("</thead>");
                    sbTableContent.Append("<tr><td>Author</td>");
                    sbTableContent.Append("<td>" + item.Employee_Name + "(" + item.Author + ")</td></tr>");
                    sbTableContent.Append("<tr><td>Title</td>");
                    sbTableContent.Append("<td>" + item.Title + "</td></tr>");
                    sbTableContent.Append("<tr><td>Message</td>");
                    sbTableContent.Append("<td>" + item.Message + "</td></tr>");
                    sbTableContent.Append("<tr><td>Hyperlink</td>");
                    sbTableContent.Append("<td class='td-a'><a style='text-decoration:underline;cursor:pointer;' target='_blank' href='" + item.Hyperlink + "'>" + item.Hyperlink + "</a></td></tr>");
                    sbTableContent.Append("<tr><td>Attachments</td>");
                    string blobURL = accKey + Session["Comp_Code"].ToString().ToLower() + "/" + HttpUtility.UrlEncode(item.FilePath).ToString();
                    if (item.FilePath != "")
                    {
                        sbTableContent.Append("<td <div id='dvURL' class='div-alert'>Click on link to download : <a href=" + blobURL + " target='_blank' >" + item.FilePath + "</a></div></td></tr>");
                    }
                    else
                    {
                        sbTableContent.Append("<td></td></tr>");
                    }
                }
                return(sbTableContent.ToString());
            }
            catch (Exception ex)
            {
                Dictionary <string, string> dicContext = new Dictionary <string, string>();
                dicContext.Add("Filter:CompanyCode", companyCode);
                dicContext.Add("Filter:UserCode", userCode);
                DataControl.Impl.ExceptionHandler.WriteLog(ex, dicContext);
                throw new Exception("Sorry an error occurred. Please try again later");

                throw ex;
            }
        }
Ejemplo n.º 9
0
        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);
            }
        }
Ejemplo n.º 10
0
        public void DownloadHolidayExcelTemplate()
        {
            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 = "Holiday_Bulk_Upload.xlsx";
            string blobURL  = objProvider.GetConfigValue("EXCELTEMPLATES") + fileName;

            objFileDownload.DownloadFile(blobURL, fileName, out error);
        }
Ejemplo n.º 11
0
        /// <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);
            }
        }
Ejemplo n.º 12
0
        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);
            }
        }
Ejemplo n.º 13
0
        /// <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;
            }
        }
Ejemplo n.º 14
0
        public string ConvertHtmlToPdf()
        {
            DataControl.CurrentInfo objCurInfo = new CurrentInfo();
            DataControl.Repository.AzureBlobUpload objAzureUpload = new DataControl.Repository.AzureBlobUpload();
            DataControl.Abstraction.IFileProvider  objPathProv    = new DataControl.Impl.FileSystemProvider();
            string accKey = objPathProv.GetConfigValue("NBBLOBACCKEY");
            string apiKey = "a06abb07-d574-4a8c-b223-845635e0cb16";
            string value  = "";

            value += "<div class='col - xs - 12 clearfix' id='formtitle>< p >< b > Dear < span id = 'formUsername' ></ span >,</ b ></ p >";
            value += "< p > Greetings of the day,</ p > < br />< p style ='text-indent:40px' > As per clause 7 of the agreed Work Norms, you are expected to make the following minimum call average:</ p >";
            value += "< p style ='text-indent:100px' >< b > 1.Doctor Call Average - < span id = formExpcalAvg ></ span ></ b ></ p >< p style = 'text-indent:40px' >";
            value += "However, on review of your call average, we are shocked to note that your call average is only<b> < span id = 'formCurcalAvg' ></ span ></ b > for the month of < b >< span id = 'formmnth'>";
            value += "</ span ></ b >, < b >< span id = 'formyear' ></ span ></ b > which is much below the expectation.< br /> We also understand that your Regional Manager has already sent communication to you in this regard but has not received any assurance from you that you would improve upon the above.This is being viewed very seriously.You are cautioned to maintain doctor call average of < b >";
            value += "< span id = 'testexpavg' ></ span ></ b > month after month, which will also help you in improving our business in your territory.We are sure you will take note of the above very seriously and ensure compliance.</ p >";
            value += "< p style = 'position: relative;top: 9px;margin-bottom: 25px;' >< b > Regards,</ b ></ p >< p >< span id = 'ModRepusername' ></ span ></ p >";
            value += "</ div > "; // a direct HTML string
            string containerName = objCurInfo.GetCompanyCode().ToLower();

            using (var client = new System.Net.WebClient())
            {
                // Build the conversion options
                System.Collections.Specialized.NameValueCollection options = new System.Collections.Specialized.NameValueCollection();
                options.Add("apikey", apiKey);
                options.Add("value", value);
                string HtmlToPDF = System.Configuration.ConfigurationManager.AppSettings["AlertHtmlToPDF"].ToString();
                // Call the API convert to a PDF
                System.IO.MemoryStream ms = new System.IO.MemoryStream(client.UploadValues(HtmlToPDF, options));

                // Make the file a downloadable attachment - comment this out to show it directly inside
                var    fileName = objCurInfo.GetUserName() + DateTime.Now.ToString("ddMMyyyyHHmmssfff") + ".pdf";
                string blobURL  = objAzureUpload.PutAzureBlobStorage(ms, fileName, accKey, containerName);
                // Return the file as a PDF
                return(fileName);
            }
        }
Ejemplo n.º 15
0
        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);
            }
        }
Ejemplo n.º 16
0
        /// <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);
            }
        }
Ejemplo n.º 17
0
        /// <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);
            }
        }