I have a meeting table data and i am using it to send to server side page check my url and tell me why call is not sucessfull even data is passed correctly
here is my ajax call
$.ajax({
type: 'POST',
contentType: "application/json; charset=utf-8",
url: 'AddNewMeeting.aspx/SaveMeetingShechudar',
dataType: 'json',
data: JSON.stringify(Meeting),
success: function (response) {
alert("success ");
},
error: function (jqXHR, textStatus, errorThrown) //what to do if fails
{
// alert('bad, ' + errorThrown + ", " + jqXHR.responseText + ", " + textStatus);
alert("success failed ");
},
});
here is my code of AddNewMeeting.aspx file
public static void SaveMeetingShechudar(string MDate, string MTime, int MPurpose, int masterID, int RowNumber, string[] name, string[] nic, string[] designation, string[] company, string[] address)
{
int mID = 0;
try
{
#region master part save
MeetingSchedulMaster master = new MeetingSchedulMaster();
master.m_date = Convert.ToDateTime(MDate);
master.m_datetime = MTime;
master.m_host = UserID;
master.m_puposeid = Convert.ToInt32(MPurpose);
master.m_entry_date = DateTime.Now;
if (masterID == 0)
saveDataMaster(master);
else
{
master.mid = masterID;
UpdateData(master);
}
#endregion
#region detail part save
if (MasterIDForUpdation == 0)
mID = GetMaxMeetinNumber_ID("2");
else
mID = masterID;
for (int i = 1; i <= RowNumber; i++)
{
MeetingSchedulDetail detail = new MeetingSchedulDetail();
//TableRow row = tbladdnewmeeting.Rows[i-1];
detail.name = name[i];
detail.cnic = nic[i];
detail.designation = designation[i];
detail.company = company[i];
detail.address = address[i];
detail.mid = mID;
saveDataDetail(detail);
}
}
catch (Exception e) { }
}
error
http://localhost:57927/forms/AddNewMeeting.aspx/SaveMeetingShechudar
500 (Internal Server Error)
Try adding the [WebMethod] attribute.Which is in the System.Web.Services namespace:
**[WebMethod]**
public static void SaveMeetingShechudar(string MDate, string MTime, int MPurpose, int masterID, int RowNumber, string[] name, string[] nic, string[] designation, string[] company, string[] address)
{
int mID = 0;
try
{
#region master part save
MeetingSchedulMaster master = new MeetingSchedulMaster();
master.m_date = Convert.ToDateTime(MDate);
master.m_datetime = MTime;
master.m_host = UserID;
master.m_puposeid = Convert.ToInt32(MPurpose);
master.m_entry_date = DateTime.Now;
if (masterID == 0)
saveDataMaster(master);
else
{
master.mid = masterID;
UpdateData(master);
}
#endregion
#region detail part save
if (MasterIDForUpdation == 0)
mID = GetMaxMeetinNumber_ID("2");
else
mID = masterID;
for (int i = 1; i <= RowNumber; i++)
{
MeetingSchedulDetail detail = new MeetingSchedulDetail();
//TableRow row = tbladdnewmeeting.Rows[i-1];
detail.name = name[i];
detail.cnic = nic[i];
detail.designation = designation[i];
detail.company = company[i];
detail.address = address[i];
detail.mid = mID;
saveDataDetail(detail);
}
}
catch (Exception e) { }
}
Related
I have developed a test module for generating excel file from json format.
const bodyParser = require('body-parser');
const json2xls = require("json2xls");
const fs = require('fs/promises');
const app = express();
app.use(json2xls.middleware);
app.use(bodyParser.json())
app.post("/", (req, res) => {
if(req.query.token !== "----") res.send(JSON.stringify({isError: true, inf: "Token not valide!"}));
console.log(req.body.DataList);
var xlsq = json2xls(req.body.DataList);
fs.writeFile('data.xlsx', xlsq, 'binary');
res.xls(req.query.name + new Date().toLocaleDateString() + ".xlsx", req.body.data);
})
app.listen(4589, () => console.log("start"));
Next, I send json from the main application to get the converted excel file.
Part from controller С#
public async Task<FileContentResult> GetExcelFile([FromBody] List<GoodsModel> dataList)
{
SideServices sideServices = new(Db, Logger);
List<object> responseDataList = new List<object> { };
object fields = new { codeElem = "Код элемента", shortName = "Наименование", unit = "система измерения", baseNds = "НДС",
sellPrice = "Цена штю", unitWeight = "вес", sumUtd = "Всего, руб", priceUtd = "Цена парйс УТД", baseSale = "Базовая скидка",
remainder = "Cвободный остаток", priceEutd = "Цена eUTD", sumEutd = "Сумма eUTD"};
foreach (GoodsModel item in dataList)
{
responseDataList.Add(new {
codeElem = item.CodeElem,
shortName = item.ShortName,
unit = item.Unit,
baseNds = item.BaseNds,
sellPrice = item.SellPrice,
unitWeight = item.UnitWeight,
sumUtd = item.Sum,
priceUtd = item.PriceUtd,
baseSale = item.BaseSale,
remainder = item.Remainder,
priceEutd = item.PriceEutd,
sumEutd = item.SumEutd
});
}
ExcelImportModel importModel = new ExcelImportModel {
Fields = fields,
Styles = new { },
NameFile = $"Счёт на оплату oт " + SideServices.CurrentDate.ToString(),
DataList = responseDataList.ToArray()
};
Tuple<bool, string, byte[]> resultImport = await sideServices.ToExcelAsync(importModel);
if (resultImport.Item1 == false)
{
string contentType = "application/vnd.ms-excel";
string nameFile = $"Счёт на оплату oт " + SideServices.CurrentDate.ToString();
return File(resultImport.Item3, contentType, nameFile);
}
else
{
return File(new byte[] {1,2,3 }, string.Empty);
}
}
Next method ToExcelAsync():
internal async Task<Tuple<bool, string, byte[]>> ToExcelAsync(ExcelImportModel excelImport)
{
if (excelImport.DataList.Length == 0) return Tuple.Create(true, "Length data is null", new byte[] { 1, 2, 3 });
FileSettings fileSettings = new();
string settingString = await fileSettings.ReadSwitchAsync(TypeDo.settings);
SettingsModel settings = JsonSerializer.Deserialize<SettingsModel>(settingString);
RestClient restClient = new("http://127.0.0.1:4589?" + "token=" + settings.SiteSetModel.APITOKEN);
RestRequest restRequest = new(Method.POST);
restRequest.AddJsonBody(excelImport, "application/json");
IRestResponse response = await restClient.ExecuteAsync(restRequest);
if (response.StatusCode == HttpStatusCode.OK)
{
return Tuple.Create(false, string.Empty, Encoding.UTF8.GetBytes(response.Content));
}
else return Tuple.Create(true, response.ErrorMessage, new byte[] { 1, 2, 3 });
}
Further, on the client side, I get an array of bytes of the generated file.
export default function ExcelConvert(){
const [dataConvert, setDataConvert] = useState([]);
const [errorModal, setErrorModal] = useState({isVisible: false, errorText: ""});
const [appendData, setAppendData] = useState({url: ""});
const ref = useRef(null);
const selector = useSelector(state => state.mainElements);
useEffect(()=>{
const responseArray = [];
for (let i = 0; i < selector.length; i++) {
const element = selector[i];
const newObj = {
codeElem: element.codeElem,
shortName: element.shortName,
countUnit: element.countUnit,
baseUnit: element.baseUnit,
weight: element.unitWeight,
sellPrice: element.sellPrice,
priceUtd: element.sellPrice,
sumUtd: element.sumPrice,
priceEutd: element.priceEUTD,
sumEutd: element.sumEUTD,
baseSale: element.discountItem,
remainder: element.amountUnits
}
responseArray.push(newObj);
}
setDataConvert(responseArray)
}, [selector]);
const handlerClick = () => {
if(dataConvert.length <= 0) return undefined;
const userToken = sessionStorage.getItem("t");
fetch(`${baseurl}/connect/account/excel`, {
method: "POST",
headers: {"Authorization": `Bearer ${userToken}`, "Content-Type": "application/json"},
body: JSON.stringify(dataConvert)
}).then((response) => {
const status = response.status;
if(status === 200) return response.blob();
if(status === 401) deleteAuthData();
if(status >= 400 && status !== 401) setErrorModal({isVisible: true, errorText: "Невозможно загрузить файл!"})
}).then((result) => {
setAppendData({url: window.URL.createObjectURL([result])});
}).catch(e => setErrorModal({isVisible: true, errorText: e}));
}
return <>
<button onClick={handlerClick}>скачать Excel</button>
{appendData.url ? <a style={{display: "block"}} download={"qw.xlsx"} ref={ref} href={appendData.url}>test</a> : <></>}
</>
}
In the first visualization of the code, I added a function that saves the generated excel file;
This file is valid and opens normally.
But the file that I upload on the client side, the file does not open and indicates that the file is not valid and has the wrong format.
Help me solve this problem, what am I doing wrong?
In my current project using ASP.Net vs AngularJs. Now I have a problem about time response of the server.
When load page I send 2 requests ajax to get data.
If I send at the same time function getTopicInfo() and getAnswerList()
$scope.init = function (categoryId, topicId, answerId, commentId, userId) {
$scope.categoryId = categoryId;
$scope.topicId = topicId;
$scope.answerId = answerId;
$scope.commentId = commentId;
$scope.userId = userId;
$scope.currentPage = 1;
$scope.itemsPerPage = 10;
$scope.orderBy = getTopicOrderBy();
getTopicInfo();
getAnswerList();
}
Time response is slowly.
If I call function getAnswerList() after 200ms
$scope.init = function (categoryId, topicId, answerId, commentId, userId) {
$scope.categoryId = categoryId;
$scope.topicId = topicId;
$scope.answerId = answerId;
$scope.commentId = commentId;
$scope.userId = userId;
$scope.currentPage = 1;
$scope.itemsPerPage = 10;
$scope.orderBy = getTopicOrderBy();
getTopicInfo();
setTimeout(function () {
getAnswerList()
}, 200);
}
Time response is quick
I really don't understand. I spend a lot of time on this.
Code of function getTopicInfo() and getAnswerList()
function getTopicInfo() {
var data = {};
data.CategoryId = $scope.categoryId;
data.TopicId = $scope.topicId;
$.ajax({
type: "POST",
url: link("/Topic/GetInfo"),
data: data,
success: function (data) {
$scope.topicInfo = data.Data.TopicInfo;
$scope.load += 1;
$scope.$apply();
addListener();
}
});
}
function getAnswerList(page, scroll) {
page = page || 0;
scroll = scroll != false ? true : false;
var data = {};
data.CategoryId = $scope.categoryId;
data.TopicId = $scope.topicId;
if (page == 0) {
data.CurrentPage = $scope.currentPage;
data.AnswerId = $scope.answerId;
data.CommentId = $scope.commentId;
} else {
data.CurrentPage = page;
data.AnswerId = 0;
data.CommentId = 0;
}
data.ItemsPerPage = $scope.itemsPerPage;
data.OrderBy = $scope.orderBy;
$.ajax({
type: "POST",
url: link("/Answer/GetList"),
data: data,
success: function (data) {
$scope.answerList = data.Data.AnswerList;
$scope.currentPage = data.Data.CurrentPage;
$scope.totalItems = data.Data.TotalItems;
$scope.load += 1;
$scope.$apply();
if (page == 0 && $scope.answerId != 0) {
setTimeout(function () {
scrollToId("answer" + $scope.answerId);
if ($scope.commentId != 0) {
var commentId = $scope.commentId;
if (!$("#comment" + commentId).isInViewport()) {
scrollToId("comment" + commentId);
}
$("#comment" + commentId).css("background-color", "orange")
$("#comment" + commentId).animate({ 'backgroundColor': 'rgba(0, 0, 0, 0)' }, 1000);
}
}, 10);
}
if (page != 0 && scroll) {
scrollToId("answers-header");
}
addListener();
}
});
}
I have a web Api that allow me to add a multiple Image with with another parameter
(place_Id , is_Main)
I use this code bellow to upload the image
[Route("api/Image")]
[HttpPost]
public async Task<IHttpActionResult> PostImage()
{
// Check if the request contains multipart/form-data.
if (!Request.Content.IsMimeMultipartContent())
{
throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
}
string root = HttpContext.Current.Server.MapPath("~/Images/Places");
var provider = new CustomMultipartFormDataStreamProvider(root);
try
{
// Read the form data.
var task = await Request.Content.ReadAsMultipartAsync(provider).ContinueWith<IEnumerable<FileDesc>>(t =>
{
if (t.IsFaulted || t.IsCanceled)
{
throw new HttpResponseException(HttpStatusCode.InternalServerError);
}
var fileInfo = provider.FileData.Select(d =>
{
var info = new FileInfo(d.LocalFileName);
//return new FileDesc(info.Name);
return new FileDesc(info.Name);
});
return fileInfo;
});
int placeId = int.Parse(provider.FormData["placeId"]);
bool isMain = Convert.ToBoolean(provider.FormData["isMain"]);
var listOfAttchments = task.ToList();
string attachmentsPath = Request.RequestUri.Scheme +
System.Uri.SchemeDelimiter +
Request.RequestUri.Host +
(Request.RequestUri.IsDefaultPort ? "" : ":" + Request.RequestUri.Port) +
"/Images/Places/";
Images i = new Images();
if (listOfAttchments.Count > 0)
{
foreach (var item in listOfAttchments)
{
i.FileLocation = item.name;
i.FromUser = true;
i.TableName = "Places";
i.IsMain = isMain;
i.TableId = placeId;
db.Images.Add(i);
}
}
await db.SaveChangesAsync();
return Ok(new
{
result = true,
listAttachmment = listOfAttchments
}
);
}
catch (System.Exception e)
{
return BadRequest(e.StackTrace + "\nTest" + e.Data + "\nTest" + e.InnerException + "\nTest" + e.Message + "\nTest" + e.Source + "\nTest" + e.TargetSite);
}
}
The previous api is in another domain,
and I have a web forms application , that want to upload image from it, using the previous api
var data = new FormData();
jQuery.each(jQuery('#file')[0].files, function (i, file) {
data.append(" placeId: 7, isMain: 1");
data.append('image1' + i, file);
});
$("#btn2").click(function () {
jQuery.ajax({
url: '{url}/api/api/Image',
data: data,
contentType: false,
processData: false,
method: 'POST',
type: 'POST', // For jQuery < 1.9
success: function (data) {
alert(data);
}
});
});
I used the above code to invoke it, but I have a problem,
can you help me
Please ensure that you are not receiving XSS Error message (normally other domains are configured that you will not be able to trigger calls from a different domain addresses).
In the below code, i am not sure why do you have /api/api
url: '{url}/api/api/Image',
Please post us the error message you are receiving
In my _Layout.cshtml page there is a textbox that allows user to type his/her email address(this is for newsletter).if typed email address exists it does not insert to the database and if not it insert to the database. at the same time if not inserted I want to show an error message and if insert I want to show success message.this is how I insert to the database,
public ActionResult getNewsLetterMail(string N_id, string N_EmailAdd)
{
Session["Ealert"] = null;
Random random = new Random();
int idONe = random.Next(99, 999);
int idTwo = random.Next(999, 9999);
string middle = "menuka";
string fullID = idONe.ToString() + middle + idTwo.ToString();
var N_ID = fullID;
var N_Email = N_EmailAdd;
TourCenterDBEntities NewsLetterEntities = new TourCenterDBEntities();
var existing = NewsLetterEntities.News_Letter.Where(l => l.N_Email == N_EmailAdd);
Debug.WriteLine(existing.Count());
if (existing.Count() == 0)
{
News_Letter NewsLetterDetails = new News_Letter();
NewsLetterDetails.N_id = N_ID;
NewsLetterDetails.N_Email = N_Email;
NewsLetterEntities.News_Letter.Add(NewsLetterDetails);
NewsLetterEntities.SaveChanges();
//want to send success text
}
else
{
//want to send error text
}
return Json(new { });
}
if success or error it returns to the same _Layout.csthml page.
how can I do that.hope your help.
You can use. return content.
if (existing.Count() == 0)
{
News_Letter NewsLetterDetails = new News_Letter();
NewsLetterDetails.N_id = N_ID;
NewsLetterDetails.N_Email = N_Email;
NewsLetterEntities.News_Letter.Add(NewsLetterDetails);
NewsLetterEntities.SaveChanges();
//return Content("Your information saved successfully");
return new JavascriptResult { Script = "alert('Your information saved successfully');" };
}
else
{
//return Content("Already exist. Please choose another.");
return new JavascriptResult { Script = "alert('Your information saved successfully');" };
}
public ActionResult getNewsLetterMail(string N_id, string N_EmailAdd)
{
Session["Ealert"] = null;
Random random = new Random();
int idONe = random.Next(99, 999);
int idTwo = random.Next(999, 9999);
string middle = "menuka";
string fullID = idONe.ToString() + middle + idTwo.ToString();
var N_ID = fullID;
var N_Email = N_EmailAdd;
TourCenterDBEntities NewsLetterEntities = new TourCenterDBEntities();
var existing = NewsLetterEntities.News_Letter.Where(l => l.N_Email == N_EmailAdd);
Debug.WriteLine(existing.Count());
string myMessage="";
if (existing.Count() == 0)
{
News_Letter NewsLetterDetails = new News_Letter();
NewsLetterDetails.N_id = N_ID;
NewsLetterDetails.N_Email = N_Email;
NewsLetterEntities.News_Letter.Add(NewsLetterDetails);
NewsLetterEntities.SaveChanges();
myMessage="success";
}
else
{
myMessage="failed";
}
return Json(myMessage, JsonRequestBehavior.AllowGet);
}
In your view.
$.post('#Url.Action("getNewsLetterMail", "yourControllerName")', { N_id: N_id, N_EmailAdd: N_EmailAdd }).done(function (data) {
if (data == "success") {
alert("Success!");
}
if( data== "failed") {
alert("Failed!");
}
}
I have no experience but I would try something like that:
in my viewmodel I would put
string info
then in my razor view
#Html.DisplayFor(m=>m.info)
and in controller
if(existing){info="success"}
You would have to pass info to the viewmodel in your controller
public ActionResult getNewsLetterMail(string N_id, string N_EmailAdd)
{
Session["Ealert"] = null;
Random random = new Random();
int idONe = random.Next(99, 999);
int idTwo = random.Next(999, 9999);
string middle = "menuka";
string fullID = idONe.ToString() + middle + idTwo.ToString();
var N_ID = fullID;
var N_Email = N_EmailAdd;
TourCenterDBEntities NewsLetterEntities = new TourCenterDBEntities();
var existing = NewsLetterEntities.News_Letter.Where(l => l.N_Email == N_EmailAdd);
Debug.WriteLine(existing.Count());
string myMessage="";
if (existing.Count() == 0)
{
News_Letter NewsLetterDetails = new News_Letter();
NewsLetterDetails.N_id = N_ID;
NewsLetterDetails.N_Email = N_Email;
NewsLetterEntities.News_Letter.Add(NewsLetterDetails);
NewsLetterEntities.SaveChanges();
myMessage="success!";
}
else
{
myMessage="Failed!";
}
return Json(myMessage, JsonRequestBehavior.AllowGet);
}
In Views, you can add jquery to display the message. Following is an example to retrieve the message in Views. You can edit the names in your form accordingly.
`<script type="text/javascript">
$(document).ready(function () {
$("#yourForm").submit(function (e) {
e.preventDefault();
var valid = $("#yourForm").valid();
if (valid) {
$.ajax({
url: "/getNewsLetterMail",
type: "POST",
data: {
Name: $("#N_id").val(),
Email: $("#N_EmailAdd").val(),
},
success: function (data) {
alert(data);
reset();
}
});
}
});
});
</script>'
I have problem with signalR with multiple client and async background task.
Here is my Scenario:
I have multiple clients doing multiple downloads.. they can download files simultaneously, I use signalR to send them the progress of there download. I handled it fine but the problem is when a single user invokes the Disconnect Method or he leaves or refresh its page, signalR will Disconnect all its client not only the one who is disconnecting which will interrupt the progress report for other client. How will I resolve this issue.?? Is there Any other way handling it??
additional:
private async Task WriteRecords([DataSourceRequest] DataSourceRequest dataRequest,int countno, VMEXPORT[] arrVmExport, bool createHeaderyn, string filePath )
{
string fileName = filePath.Replace(System.Web.HttpContext.Current.Server.MapPath("~/") + "Csv\\", "").Replace(".csv", "");
int datapage = (countno / 192322)+1;
for (int i = 1; i <= datapage; )
{
dataRequest.Page = i;
dataRequest.PageSize = 192322;
var write = _serviceAgent.FetchByRole("", "", CurrentUser.Linkcd, CurrentUser.Rolecd).ToDataSourceResult(dataRequest);
await Task.Run(()=>write.Data.Cast<AGENT>().WriteToCSV(new AGENT(), createHeaderyn, arrVmExport, filePath));
createHeaderyn = false;
i = i + 1;
double percentage = (i * 100) / datapage;
SendProgress(percentage, countno,fileName);
}
}
Here is the set up in my BaseController which calls the hub context:
public void SendNotification(string fileNametx, bool createdyn)
{
var context = GlobalHost.ConnectionManager.GetHubContext<SignalRHubHelper>();
context.Clients.User(CurrentUser.Usernm + '-' + CurrentUser.GUID)
.receiveNotification("Export", CurrentUser.Usernm, "info", fileNametx, createdyn);
}
public void SendProgress(double recordCount, int totalCount,string fileName)
{
var context = GlobalHost.ConnectionManager.GetHubContext<SignalRHubHelper>();
context.Clients.User(CurrentUser.Usernm + '-' + CurrentUser.GUID).reportProgress(recordCount, totalCount,fileName);
}
And Here is my controller Method:
public async Task<ActionResult> _Export([DataSourceRequest] DataSourceRequest dataRequest, string columns,int countno, string menunm)
{
var fileNametx = AgentsPrompttx + DateTime.Now.ToString(GeneralConst.L_STRING_DATE4) + ".csv";
SendNotification(fileNametx, false);
var filePath = System.Web.HttpContext.Current.Server.MapPath("~/") + "Csv\\";
var vmexport = new JavaScriptSerializer().Deserialize<VMEXPORT[]>(columns);
dataRequest.GroupingToSorting();
dataRequest.PageSize = 0; // set to zero
await WriteRecords(dataRequest,countno, vmexport, true, filePath + fileNametx);
SendNotification(fileNametx, true);
return File(filePath + fileNametx, WebConst.L_CONTENTTYPE_APP_OCTET, fileNametx);
}
JavaSciprt:
init: function (element) {
var self = this;
self.msgno = undefined;
self.sfiHubConnection = $.connection.signalRHubHelper;
self.initSignalRClients();
$.connection.hub.logging = true;
$.connection.hub.start({ transport: "longPolling" }).done(function () {
setTimeout(function () {
self.sfiHubConnection.server.getAllStatus();
self.sfiHubConnection.server.brodcastLogIn($('#usernm').text());
}, 1000);
}).fail(function () {
alert("signal Failed")
});
},
triggerReconnect: function () {
var self = this;
$.connection.hub.stateChanged(function (change) {
if (change.newState === $.signalR.connectionState.disconnected) {
$.connection.hub.stop();
self.init();
}
});
},
deleteFile: function (controllertx, filenametx) {
$('#close_dl_link').on('click', function () {
$.get(GetAppPath() + controllertx + '/_DeleteFile/?Filenametx='+filenametx, function () {
return true;
});
});
},
initSignalRClients: function () {
var self = this;
self.sfiHubConnection = $.connection.signalRHubHelper
self.sfiHubConnection.client.setOnline = function (usernm) {
if ($('#user_kgrid').data('kendoGrid') != undefined)
$('#user_kgrid').data('kendoGrid').tbody.find('td:contains("' + usernm + '")').eq(0).parent('tr').find('td:contains("Offline")').html('<span><i class="icon-ok-sign"></i></span> Online')
};
self.sfiHubConnection.client.receiveNotification = function (controller, totx, type, fileNametx, createdyn) {
if (totx == $('#usernm').text()) {
if (!createdyn) {
self.init();
var fileId=fileNametx.replace(".csv","")
var icon = "icon-download";
var title = fileId +':'+ ' <span id="' + fileId + '"></span> <br>';
var message = "Creating file kindly wait..";
var delay = 0;
SfiNotify(icon, title, message, 'info', "", "", "", "", delay);
}
else if (createdyn && fileNametx !== "") {
console.log("download available: "+fileNametx)
var elementid = fileNametx.replace(".csv", "");
$('#' + elementid).parents(".alert").each(function () {
$(this).remove();
});
var icon = "icon-download";
var title = " File ready for download !<br>" + "<strong>" + fileNametx + "</strong><br>";
var message = "Click here to download the file!";
var url = GetAppPath() + controller + '/_Download/?filenametx=' + fileNametx;
var delay = 0;
SfiNotify(icon, title, message, 'info', url, "", "", "", delay);
if ($('#close_dl_link').length > 0) {
self.deleteFile(controller, fileNametx);
}
}
}
else
return false;
};
self.sfiHubConnection.client.reportProgress = function (recordCount, totalRecord, fileName) {
var progress = recordCount + "% of " + totalRecord;
console.log("PROGRESS FOR: " + fileName + "TOTAL: "+recordCount);
if ($('#' + fileName).length > 0) {
if (recordCount > 100)
return false;
$('#' + fileName).text(progress);
}
else if($('#' + fileName).length == 0)
{
if (recordCount > 100)
return false;
var icon = "icon-download";
var title = ' Processing Records <span id=' + fileName + '>' + progress + '</span> <br>';
var message = "Creating file kindly wait..";
var delay = 0;
SfiNotify(icon, title, message, 'info', "", "", "", "", delay);
}
};