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
Raju Fodse
1.5k
244
31.1k
Fetch Value from Third Level Table
Sep 26 2018 1:29 AM
I Have Three Table Linked with each other. I want to fetch Value from other table How do I write Code. I Try This but Variable 'mythkvalue' returns null value. How I will get value for mythkvalue
[HttpPost]
public
ActionResult CreateP3(Process process)
{
var tr = process.StageID + process.PIPENO + process.Status;
var checkme = (from x
in
db.Processes
where x.StageID + x.PIPENO + x.Status == tr && x.Status ==
"OK"
select x).ToList();
var mythkvalue = process.PipeAl.Order.THK;
if
(checkme.Count > 0)
{
ModelState.AddModelError(
"PIPENO"
,
"You are trying Duplicate Pipe Entry"
);
}
if
(ModelState.IsValid)
{
if
(mythkvalue > 1)
{
process.MPP = 25;
}
process.CuttingSpeed = (process.ActualMeter*1000)/process.CuttingTime;
db.Processes.Add(process);
db.SaveChanges();
return
RedirectToAction(
"IndexP3"
);
}
var EmpAtnList = db.Attens.ToList();
IEnumerable<SelectListItem> AttnList = from s
in
EmpAtnList.OrderByDescending(s => s.ATTNDATE)
select
new
SelectListItem
{
Value = s.ATTNSYSID.ToString(),
Text = s.ATTNDATE +
"--"
+ s.Emp.EmpName
};
ViewBag.ATTNSYSID =
new
SelectList(AttnList,
"Value"
,
"Text"
);
//ViewBag.ATTNSYSID = new SelectList(db.Attens, "ATTNSYSID", "EMPCODE", process.ATTNSYSID);
ViewBag.StageID =
new
SelectList(db.OMStages,
"StageID"
,
"StageName"
);
ViewBag.NextStageID =
new
SelectList(db.OMStages.OrderBy(x => x.StageValue),
"StageID"
,
"StageName"
);
ViewBag.PIPENO =
new
SelectList(db.PipeAls,
"PIPENO"
,
"PIPENO"
);
ViewBag.Status =
new
SelectList(db.ValueAddLists.Where(x => x.RefName ==
"PipeStatus"
),
"RefValue"
,
"Description"
, process.Status);
return
View(process);
}
Reply
Answers (
2
)
How to import excel multiples sheet in to SQL server
security of access token