Business ERP Part 42 Branch Focal Person Details in ASP.NET MVC
Hi, Dear's here we learn how to implement Auto Time Table Generator in Visual Studio using C# Windows Form. Ilyasoft software company provide full project step by step training on our YouTube Channel ilyasoft software company so now subscribe, share and like for more project base tutorials
In this part we are going to Implement Branch Focal Person Details, so now follow below code.
Source Code:
Action C# Code :
using DatabaseLayer;
using ERP_App.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace ERP_App.Controllers
{
public class AdminConfigController : Controller
{
private BusinessERPDbEntities DB = new BusinessERPDbEntities();
public ActionResult ShowBranchFocalPerson(int? branchID)
{
if (string.IsNullOrEmpty(Convert.ToString(Session["UserName"])))
{
return RedirectToAction("Login", "Home");
}
var focalperson = new FocalPersonMV();
focalperson.employeeMV = new EmployeeMV();
focalperson.userMV = new UserMV();
var employees = DB.tblEmployees.Where(e => e.BranchID == branchID && e.Designation.Contains("Focal"));
foreach (var employee in employees)
{
var user = DB.tblUsers.Where(u => u.UserID == employee.UserID && u.IsActive == true).FirstOrDefault();
if (user != null)
{
focalperson.CompanyID = employee.CompanyID;
focalperson.BranchID = employee.BranchID;
// Employee Detials
focalperson.employeeMV.Name = employee.Name;
focalperson.employeeMV.ContactNo = employee.ContactNo;
focalperson.employeeMV.Photo = employee.Photo;
focalperson.employeeMV.Email = employee.Email;
focalperson.employeeMV.Address = employee.Address;
focalperson.employeeMV.CNIC = employee.CNIC;
focalperson.employeeMV.Designation = employee.Designation;
focalperson.employeeMV.Description = employee.Description;
focalperson.employeeMV.MonthlySalary = employee.MonthlySalary;
// User Detials
focalperson.userMV.UserID = user.UserID;
focalperson.userMV.UserType = user.tblUserType.UserType;
focalperson.userMV.FullName = user.FullName;
focalperson.userMV.Email = user.Email;
focalperson.userMV.ContactNo = user.ContactNo;
focalperson.userMV.UserName = user.UserName;
focalperson.userMV.IsActive = user.IsActive;
focalperson.userMV.Address = user.Address;
}
}
return View(focalperson);
}
}
}
View Code :
@model ERP_App.Models.FocalPersonMV
@{
ViewBag.Title = "Focal Person";
}
<div class="col-lg-6">
<div class="card card-default mb-6">
<div class="card-header">Focal Person Details</div>
<div class="card-body">
<div>
<h4>Employee</h4>
<hr />
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.employeeMV.Name)
</dt>
<dd>
@Html.DisplayFor(model => model.employeeMV.Name)
</dd>
<dt>
@Html.DisplayNameFor(model => model.employeeMV.ContactNo)
</dt>
<dd>
@Html.DisplayFor(model => model.employeeMV.ContactNo)
</dd>
<dt>
@Html.DisplayNameFor(model => model.employeeMV.Photo)
</dt>
<dd>
@Html.DisplayFor(model => model.employeeMV.Photo)
</dd>
<dt>
@Html.DisplayNameFor(model => model.employeeMV.Email)
</dt>
<dd>
@Html.DisplayFor(model => model.employeeMV.Email)
</dd>
<dt>
@Html.DisplayNameFor(model => model.employeeMV.Address)
</dt>
<dd>
@Html.DisplayFor(model => model.employeeMV.Address)
</dd>
<dt>
@Html.DisplayNameFor(model => model.employeeMV.CNIC)
</dt>
<dd>
@Html.DisplayFor(model => model.employeeMV.CNIC)
</dd>
<dt>
@Html.DisplayNameFor(model => model.employeeMV.Designation)
</dt>
<dd>
@Html.DisplayFor(model => model.employeeMV.Designation)
</dd>
<dt>
@Html.DisplayNameFor(model => model.employeeMV.Description)
</dt>
<dd>
@Html.DisplayFor(model => model.employeeMV.Description)
</dd>
<dt>
@Html.DisplayNameFor(model => model.employeeMV.MonthlySalary)
</dt>
<dd>
@Html.DisplayFor(model => model.employeeMV.MonthlySalary)
</dd>
</dl>
</div>
<div>
<h4>User Details</h4>
<hr />
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.userMV.UserName)
</dt>
<dd>
@Html.DisplayFor(model => model.userMV.UserName)
</dd>
<dt>
@Html.DisplayNameFor(model => model.userMV.ContactNo)
</dt>
<dd>
@Html.DisplayFor(model => model.userMV.ContactNo)
</dd>
<dt>
@Html.DisplayNameFor(model => model.userMV.Email)
</dt>
<dd>
@Html.DisplayFor(model => model.userMV.Email)
</dd>
<dt>
@Html.DisplayNameFor(model => model.userMV.Address)
</dt>
<dd>
@Html.DisplayFor(model => model.userMV.Address)
</dd>
</dl>
</div>
<p>
@Html.ActionLink("Back", "AllCompanyBranchs", "Branch",null,new { @class="btn btn-default"})
</p>
</div>
</div>
</div>
Comments
Post a Comment