TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kalyani Shevale
NA
3.2k
705.6k
if Excel file uploading on Godadday Server that time Error
Aug 20 2019 12:02 AM
if Excel file is uploading that time THis Error Occured Please help me...
I have attached Error please check and Suggest me.
below code is Excel File Uploading
public
ActionResult UploadExcel()
{
try
{
int
intUploadedFiles = Request.Files.Count;
var files = Request[
"File"
];
HttpPostedFileBase file = Request.Files[0];
var fileName = Path.GetFileName(file.FileName);
if
(file !=
null
)
{
string
strPath =
"/ExcelFilePaySlipUploadMonthly/"
;
if
(!System.IO.Directory.Exists(Server.MapPath(strPath)))
{
System.IO.Directory.CreateDirectory(Server.MapPath(strPath));
}
file = Request.Files[0];
fileName = Path.GetFileName(file.FileName);
System.IO.DirectoryInfo dir =
new
System.IO.DirectoryInfo(Server.MapPath(strPath));
int
count = dir.GetFiles().Length;
fileName = fileName.Substring(0, fileName.IndexOf(
'.'
)) +
"_"
+ DateTime.Now.Millisecond +
"-"
+ DateTime.Now.Second +
"-"
+ DateTime.Now.Minute +
"-"
+ DateTime.Now.Hour +
"-"
+ DateTime.Now.Day +
"-"
+ DateTime.Now.Month +
"-"
+ DateTime.Now.Year +
"."
+ fileName.Substring(fileName.IndexOf(
'.'
) + 1);
var path = Path.Combine(Server.MapPath(strPath), fileName);
file.SaveAs(path);
var excel =
new
ExcelQueryFactory(path);
var punr = (from a
in
excel.Worksheet(
"PaySlip"
)
select a).Skip(1);
List
lst = (from _data
in
punr
select
new
ViewModel.Admin.PaySlip_SalaryData()
{
Month = _data[1],
Year = _data[2],
Location = _data[3],
Emp_Code = _data[4],
Department = _data[5],
Designation = _data[6],
Name = _data[7],
UAN_No = _data[8],
ESIC_No = _data[9],
Bank_Name = _data[10],
Bank_Account_No = _data[11],
Present_Days = _data[12],
Absent_Days = _data[13],
Basic =String.Format(
"{0:N}"
,Math.Round(Convert.ToDecimal(_data[14]))),
HRA = String.Format(
"{0:N}"
, Math.Round(Convert.ToDecimal(_data[15]))),
CONVEYANCE = String.Format(
"{0:N}"
, Math.Round(Convert.ToDecimal(_data[16]))),
Special_Allowance = String.Format(
"{0:N}"
, Math.Round(Convert.ToDecimal(_data[17]))),
Gross = String.Format(
"{0:N}"
, Math.Round(Convert.ToDecimal(_data[18]))),
PF_Emp = String.Format(
"{0:N}"
, Math.Round(Convert.ToDecimal(_data[19]))),
ESIC_Emp = ( _data[20]),
PT = _data[21],
TDS = _data[23],
Variable_Salary = _data[24],
Salary_Advance = _data[25],
LWF = _data[26],
Total_Deduction = String.Format(
"{0:N}"
, Math.Round(Convert.ToDecimal(_data[27]))),
Net_salary = String.Format(
"{0:N}"
, Math.Round(Convert.ToDecimal(_data[28]))),
PF_Comp = _data[29],
ESIC_Comp = _data[30],
Total_CTC = String.Format(
"{0:N}"
, Math.Round(Convert.ToDecimal(_data[31]))),
Leave_Balance_PL = _data[32],
Leave_Balance_GL = _data[33],
Other = String.Format(
"{0:N}"
, Math.Round(Convert.ToDecimal(_data[34])))
}).ToList
().FindAll(m => !
string
.IsNullOrEmpty(m.Emp_Code));
TempData[
"SalList"
] = lst;
}
ViewModel.Admin.PaySlip_SalaryData d =
new
ViewModel.Admin.PaySlip_SalaryData();
return
PartialView(
"UploadExcel"
, d);
}
catch
(IOException e)
{
return
View();
}
}
Attachment:
Error.zip
Reply
Answers (
5
)
the expression contains undefined function call cast().
Highchart is not showing in container in asp.net ?