3765 lines
187 KiB
C#
3765 lines
187 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using OSS.Repositories;
|
|
using System.Web.Mvc;
|
|
using OSS.Models;
|
|
using System.Security;
|
|
using Newtonsoft.Json.Linq;
|
|
using Newtonsoft.Json;
|
|
using System.Globalization;
|
|
using System.IO;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Security.Application;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
using System.Net.Http.Headers;
|
|
using System.Security.AccessControl;
|
|
using Rotativa;
|
|
using System.Data.Entity.Migrations;
|
|
using System.Web.WebPages;
|
|
|
|
namespace OSS.Controllers
|
|
{
|
|
[Authorize]
|
|
|
|
public class NewCOIController : Controller
|
|
{
|
|
private OSSDBContext myContext = new OSSDBContext();
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult IndexExpansion()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult IndexAmendment()
|
|
{
|
|
return View();
|
|
}
|
|
public ActionResult AmendmentApplication()
|
|
{
|
|
|
|
return View("AmendmentApplication");
|
|
}
|
|
public ActionResult Extension()
|
|
{
|
|
|
|
return View("Extension");
|
|
}
|
|
|
|
public ActionResult ExtensionIndex()
|
|
{
|
|
|
|
return View("ExtensionIndex");
|
|
}
|
|
public ActionResult PickUpOfficeAmendment()
|
|
{
|
|
|
|
return View("PickUpOfficeAmendment");
|
|
}
|
|
|
|
public ActionResult PickUpOfficeNew()
|
|
{
|
|
|
|
return View("PickUpOfficeNew");
|
|
}
|
|
public ActionResult PickUpOfficeExpansion()
|
|
{
|
|
|
|
return View("PickUpOfficeExpansion");
|
|
}
|
|
|
|
public ActionResult PickUpOfficeExtension()
|
|
{
|
|
|
|
return View("PickUpOfficeExtension");
|
|
}
|
|
|
|
public ActionResult ApplicationStatus(long Id)
|
|
{
|
|
var selectData = myContext.ApplicationManagers.Where(t => t.ApplicationID == Id).SingleOrDefault();
|
|
Session["CompanyName"] = selectData.CompanyName;
|
|
Session["ProjectName"] = selectData.ProjectName;
|
|
Session["ProjectCode"] = selectData.ProjectCode;
|
|
Session["ApplicationDate"] = selectData.CreatedDate;
|
|
Session["ApplicationType"] = selectData.ServiceName;
|
|
Session["EvaluationStatus"] = selectData.EvaluationStatus;
|
|
Session["Comment"] = selectData.Comments;
|
|
return View("ApplicationStatus");
|
|
}
|
|
|
|
public ActionResult ApplicationStatuAmend(long Id)
|
|
{
|
|
var selectData = myContext.ApplicationManagers.Where(t => t.ApplicationID == Id).SingleOrDefault();
|
|
Session["CompanyName"] = selectData.CompanyName;
|
|
Session["ProjectName"] = selectData.ProjectName;
|
|
Session["ProjectCode"] = selectData.ProjectCode;
|
|
Session["ApplicationDate"] = selectData.CreatedDate;
|
|
Session["ApplicationType"] = selectData.ServiceName;
|
|
Session["EvaluationStatus"] = selectData.EvaluationStatus;
|
|
Session["Comment"] = selectData.Comments;
|
|
|
|
return View("ApplicationStatuAmend");
|
|
}
|
|
|
|
|
|
public ActionResult ApplicationStatusComment(long Id)
|
|
{
|
|
var selectData = myContext.ApplicationManagers.Where(t => t.ApplicationID == Id).SingleOrDefault();
|
|
Session["CompanyName"] = selectData.CompanyName;
|
|
Session["ProjectName"] = selectData.ProjectName;
|
|
Session["ProjectCode"] = selectData.ProjectCode;
|
|
Session["ApplicationDate"] = selectData.CreatedDate;
|
|
Session["ApplicationType"] = selectData.ServiceName;
|
|
Session["Comment"] = selectData.Comments;
|
|
return View("ApplicationStatusComment");
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult ApplicationStatusExtension(long Id)
|
|
{
|
|
var selectData = myContext.ApplicationManagers.Where(t => t.ApplicationID == Id).SingleOrDefault();
|
|
Session["CompanyName"] = selectData.CompanyName;
|
|
Session["ProjectName"] = selectData.ProjectName;
|
|
Session["ProjectCode"] = selectData.ProjectCode;
|
|
Session["ApplicationDate"] = selectData.CreatedDate;
|
|
Session["ApplicationType"] = selectData.ServiceName;
|
|
Session["Comment"] = selectData.Comments;
|
|
return View("ApplicationStatusExtension");
|
|
}
|
|
public ActionResult ValidateAttachments()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkApplicationForm = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Application Form");
|
|
if (checkApplicationForm == null)
|
|
{
|
|
TempData["error"] = " Please upload Application form";
|
|
return RedirectToAction("AttachmentsNew");
|
|
}
|
|
var checkAttachmentBank = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Bank Statement");
|
|
if (checkAttachmentBank == null)
|
|
{
|
|
TempData["error"] = " Please upload Bank Statement";
|
|
return RedirectToAction("AttachmentsNew");
|
|
}
|
|
|
|
var checkAttachmentBoard = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Board Resolution");
|
|
if (checkAttachmentBoard == null)
|
|
{
|
|
TempData["error"] = " Please upload Board Resolution";
|
|
return RedirectToAction("AttachmentsNew");
|
|
}
|
|
var checkAttachmentBusinesP = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Business Plan");
|
|
if (checkAttachmentBusinesP == null)
|
|
{
|
|
TempData["error"] = " Please upload Business Plan";
|
|
return RedirectToAction("AttachmentsNew");
|
|
}
|
|
var checkAttachmentInc = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "INCORPORATION");
|
|
if (checkAttachmentInc == null)
|
|
{
|
|
TempData["error"] = " Please upload Certificate of Incorporation";
|
|
return RedirectToAction("AttachmentsNew");
|
|
}
|
|
|
|
return RedirectToAction("PickUpOfficeNew");
|
|
}
|
|
|
|
public ActionResult ValidateAttachmentsDeffered()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkApplicationForm = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Application Form");
|
|
if (checkApplicationForm == null)
|
|
{
|
|
|
|
TempData["error"] = " Please upload Application form";
|
|
return RedirectToAction("AttachmentsNewDeffered");
|
|
}
|
|
var checkAttachmentBank = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Bank Statement");
|
|
if (checkAttachmentBank == null)
|
|
{
|
|
TempData["error"] = " Please upload Bank Statement";
|
|
return RedirectToAction("AttachmentsNewDeffered");
|
|
}
|
|
|
|
var checkAttachmentBoard = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Board Resolution");
|
|
if (checkAttachmentBoard == null)
|
|
{
|
|
TempData["error"] = " Please upload Board Resolution";
|
|
return RedirectToAction("AttachmentsNewDeffered");
|
|
}
|
|
var checkAttachmentBusinesP = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Business Plan");
|
|
if (checkAttachmentBusinesP == null)
|
|
{
|
|
TempData["error"] = " Please upload Business Plan";
|
|
return RedirectToAction("AttachmentsNewDeffered");
|
|
}
|
|
var checkAttachmentInc = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "INCORPORATION");
|
|
if (checkAttachmentInc == null)
|
|
{
|
|
TempData["error"] = " Please upload Certificate of Incorporation";
|
|
return RedirectToAction("AttachmentsNewDeffered");
|
|
}
|
|
|
|
return RedirectToAction("ResubmitNew");
|
|
}
|
|
public ActionResult ValidateAttachmentsAmendment()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkApplicationForm = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Application Letter");
|
|
if (checkApplicationForm == null)
|
|
{
|
|
|
|
TempData["error"] = " Please upload Application Letter";
|
|
return RedirectToAction("AttachmentsAmendments");
|
|
}
|
|
var checkAttachmentBank = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "TIC Certificate");
|
|
if (checkAttachmentBank == null)
|
|
{
|
|
TempData["error"] = " Please upload TIC Certificate";
|
|
return RedirectToAction("AttachmentsAmendments");
|
|
}
|
|
|
|
var checkAttachmentBoard = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Brela Offical Search");
|
|
if (checkAttachmentBoard == null)
|
|
{
|
|
TempData["error"] = " Please upload Brela Offical Search";
|
|
return RedirectToAction("AttachmentsAmendments");
|
|
}
|
|
var checkAttachmentBusinesP = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Progresss Report");
|
|
if (checkAttachmentBusinesP == null)
|
|
{
|
|
TempData["error"] = " Please upload Progresss Report";
|
|
return RedirectToAction("AttachmentsAmendments");
|
|
}
|
|
var checkAttachmentInc = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Pictures of your Project");
|
|
if (checkAttachmentInc == null)
|
|
{
|
|
TempData["error"] = " Please upload Pictures of your Project";
|
|
return RedirectToAction("AttachmentsAmendments");
|
|
}
|
|
return RedirectToAction("PickUpOfficeAmendment");
|
|
}
|
|
public ActionResult ValidateAttachmentsExpansion()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkApplicationForm = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Application Form");
|
|
if (checkApplicationForm == null)
|
|
{
|
|
|
|
TempData["error"] = " Please upload Application form";
|
|
return RedirectToAction("AttachmentsExpansion");
|
|
}
|
|
var checkAttachmentBank = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Bank Statement");
|
|
if (checkAttachmentBank == null)
|
|
{
|
|
TempData["error"] = " Please upload Bank Statement";
|
|
return RedirectToAction("AttachmentsExpansion");
|
|
}
|
|
|
|
var checkAttachmentBoard = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Board Resolution");
|
|
if (checkAttachmentBoard == null)
|
|
{
|
|
TempData["error"] = " Please upload Board Resolution";
|
|
return RedirectToAction("AttachmentsExpansion");
|
|
}
|
|
var checkAttachmentBusinesP = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Business Plan");
|
|
if (checkAttachmentBusinesP == null)
|
|
{
|
|
TempData["error"] = " Please upload Business Plan";
|
|
return RedirectToAction("AttachmentsExpansion");
|
|
}
|
|
var checkAttachmentCert = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "TIC Certificate");
|
|
if (checkAttachmentBank == null)
|
|
{
|
|
TempData["error"] = " Please upload TIC Certificate";
|
|
return RedirectToAction("AttachmentsExpansion");
|
|
}
|
|
var checkAttachmentInc = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "INCORPORATION");
|
|
if (checkAttachmentInc == null)
|
|
{
|
|
TempData["error"] = " Please upload Certificate of Incorporation";
|
|
return RedirectToAction("AttachmentsExpansion");
|
|
}
|
|
|
|
return RedirectToAction("PickUpOfficeExpansion");
|
|
}
|
|
public ActionResult ValidateAttachmentsAmendmentDeffered()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkApplicationForm = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Application Letter");
|
|
if (checkApplicationForm == null)
|
|
{
|
|
|
|
TempData["error"] = " Please upload Application Letter";
|
|
return RedirectToAction("AttachmentsAmendmentDeffered");
|
|
}
|
|
var checkAttachmentBank = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "TIC Certificate");
|
|
if (checkAttachmentBank == null)
|
|
{
|
|
TempData["error"] = " Please upload TIC Certificate";
|
|
return RedirectToAction("AttachmentsAmendmentDeffered");
|
|
}
|
|
|
|
var checkAttachmentBoard = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Brela Offical Search");
|
|
if (checkAttachmentBoard == null)
|
|
{
|
|
TempData["error"] = " Please upload Brela Offical Search";
|
|
return RedirectToAction("AttachmentsAmendmentDeffered");
|
|
}
|
|
var checkAttachmentBusinesP = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Progresss Report");
|
|
if (checkAttachmentBusinesP == null)
|
|
{
|
|
TempData["error"] = " Please upload Progresss Report";
|
|
return RedirectToAction("AttachmentsAmendmentDeffered");
|
|
}
|
|
var checkAttachmentInc = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Pictures of your Project");
|
|
if (checkAttachmentInc == null)
|
|
{
|
|
TempData["error"] = " Please upload Pictures of your Project";
|
|
return RedirectToAction("AttachmentsAmendmentDeffered");
|
|
}
|
|
|
|
return RedirectToAction("ResubmitAmendment");
|
|
}
|
|
public ActionResult ValidateAttachmentsExtension()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkApplicationForm = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Application Letter");
|
|
if (checkApplicationForm == null)
|
|
{
|
|
|
|
TempData["error"] = " Please upload Application Letter";
|
|
return RedirectToAction("AttachmentsExtension");
|
|
}
|
|
var checkAttachmentAForm = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Application form");
|
|
if (checkAttachmentAForm == null)
|
|
{
|
|
TempData["error"] = " Please upload Application form ";
|
|
return RedirectToAction("AttachmentsExtension");
|
|
}
|
|
var checkAttachmentBank = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "TIC Certificate");
|
|
if (checkAttachmentBank == null)
|
|
{
|
|
TempData["error"] = " Please upload TIC Certificate";
|
|
return RedirectToAction("AttachmentsExtension");
|
|
}
|
|
|
|
var checkAttachmentBoard = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Brela Offical Search");
|
|
if (checkAttachmentBoard == null)
|
|
{
|
|
TempData["error"] = " Please upload Brela Offical Search";
|
|
return RedirectToAction("AttachmentsExtension");
|
|
}
|
|
var checkAttachmentBusinesP = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Progresss Report");
|
|
if (checkAttachmentBusinesP == null)
|
|
{
|
|
TempData["error"] = " Please upload Progresss Report";
|
|
return RedirectToAction("AttachmentsExtension");
|
|
}
|
|
var checkAttachmentInc = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Pictures of your Project");
|
|
if (checkAttachmentInc == null)
|
|
{
|
|
TempData["error"] = " Please upload Pictures of your Project";
|
|
return RedirectToAction("AttachmentsExtension");
|
|
}
|
|
TempData["success"] = " Your application has been submitted , waiting for approval before generating control number";
|
|
//
|
|
return RedirectToAction("PickUpOfficeExtension");
|
|
|
|
//return RedirectToAction("WaitingApproval");
|
|
}
|
|
public ActionResult ValidateAttachmentsExtensionDeffered()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkApplicationForm = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Application Letter");
|
|
if (checkApplicationForm == null)
|
|
{
|
|
TempData["error"] = " Please upload Application Letter";
|
|
return RedirectToAction("AttachmentsExtensionDeffered");
|
|
}
|
|
var checkAttachmentBank = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "TIC Certificate");
|
|
if (checkAttachmentBank == null)
|
|
{
|
|
TempData["error"] = " Please upload TIC Certificate";
|
|
return RedirectToAction("AttachmentsExtensionDeffered");
|
|
}
|
|
|
|
var checkAttachmentBoard = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Brela Offical Search");
|
|
if (checkAttachmentBoard == null)
|
|
{
|
|
TempData["error"] = " Please upload Brela Offical Search";
|
|
return RedirectToAction("AttachmentsExtensionDeffered");
|
|
}
|
|
var checkAttachmentAForm = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Application form");
|
|
if (checkAttachmentAForm == null)
|
|
{
|
|
TempData["error"] = " Please upload Application form ";
|
|
return RedirectToAction("AttachmentsExtensionDeffered");
|
|
}
|
|
var checkAttachmentBusinesP = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Progresss Report");
|
|
if (checkAttachmentBusinesP == null)
|
|
{
|
|
TempData["error"] = " Please upload Progresss Report";
|
|
return RedirectToAction("AttachmentsExtensionDeffered");
|
|
}
|
|
var checkAttachmentInc = myContext.AttachmentsList.SingleOrDefault(t => t.ProjectCode == ProjectCode && t.AttachmentName == "Pictures of your Project");
|
|
if (checkAttachmentInc == null)
|
|
{
|
|
TempData["error"] = " Please upload Pictures of your Project";
|
|
return RedirectToAction("AttachmentsExtensionDeffered");
|
|
}
|
|
TempData["success"] = " Your application has been submitted , waiting for approval before generating control number";
|
|
return RedirectToAction("ResubmitExtension");
|
|
}
|
|
[HttpPost]
|
|
public ActionResult PostAppoloadedFile(HttpPostedFileBase UploadedPdf, Attachments model)
|
|
{
|
|
|
|
String FileExt = Path.GetExtension(UploadedPdf.FileName).ToUpper();
|
|
if (FileExt == ".PDF")
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkFileExists = myContext.AttachmentsList.SingleOrDefault(t => t.AttachmentName == model.AttachmentName && t.ProjectCode == ProjectCode);
|
|
|
|
if (checkFileExists == null)
|
|
{
|
|
string fileName = null;
|
|
string path = @"\\192.168.2.32\Attachments\" + Session["ProjectCode"].ToString();
|
|
|
|
if (model.UploadedPdf != null && model.UploadedPdf.ContentLength > 0 && model.UploadedPdf.ContentLength <= 7000000)
|
|
{
|
|
try
|
|
{
|
|
fileName = model.AttachmentName+FileExt;
|
|
if (!Directory.Exists(path))
|
|
{
|
|
DirectoryInfo directory = new DirectoryInfo(path);
|
|
Directory.CreateDirectory(path);
|
|
}
|
|
string newpath = Path.Combine(path, fileName);
|
|
UploadedPdf.SaveAs(newpath);
|
|
Attachments addAttchment = new Attachments();
|
|
addAttchment.AttachmentPath = Session["ProjectCode"].ToString() + "/" + fileName;
|
|
addAttchment.ProjectCode = Session["ProjectCode"].ToString();
|
|
addAttchment.UploadedBy = Session["CompanyEmail"].ToString();
|
|
addAttchment.UploadedDate = DateTime.Now;
|
|
addAttchment.AttachmentName = model.AttachmentName;
|
|
myContext.AttachmentsList.Add(addAttchment);
|
|
myContext.SaveChangesAsync();
|
|
TempData["success"] = model.AttachmentName + " successfully saved";
|
|
return RedirectToAction("AttachmentsNew");
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
{
|
|
TempData["error"] = "Error!... Failed to upload attachement";
|
|
return RedirectToAction("AttachmentsNew");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Maximum file size 7Mb";
|
|
return RedirectToAction("AttachmentsNew");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["success"] = model.AttachmentName + " Already uploaded";
|
|
return RedirectToAction("AttachmentsNew");
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Please upload pdf file";
|
|
return RedirectToAction("AttachmentsNew");
|
|
}
|
|
|
|
|
|
}
|
|
[HttpPost]
|
|
public ActionResult PostAppoloadedFileExpansion(HttpPostedFileBase UploadedPdf, Attachments model)
|
|
{
|
|
|
|
String FileExt = Path.GetExtension(UploadedPdf.FileName).ToUpper();
|
|
if (FileExt == ".PDF")
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkFileExists = myContext.AttachmentsList.SingleOrDefault(t => t.AttachmentName == model.AttachmentName && t.ProjectCode == ProjectCode);
|
|
if (checkFileExists == null)
|
|
{
|
|
string fileName = null;
|
|
string path = @"\\192.168.2.32\Attachments\" + Session["ProjectCode"].ToString();
|
|
|
|
if (model.UploadedPdf != null && model.UploadedPdf.ContentLength > 0 && model.UploadedPdf.ContentLength <= 7000000)
|
|
{
|
|
try
|
|
{
|
|
fileName = model.AttachmentName+FileExt;
|
|
if (!Directory.Exists(path))
|
|
{
|
|
DirectoryInfo directory = new DirectoryInfo(path);
|
|
|
|
Directory.CreateDirectory(path);
|
|
}
|
|
string newpath = Path.Combine(path, fileName);
|
|
UploadedPdf.SaveAs(newpath);
|
|
Attachments addAttchment = new Attachments();
|
|
addAttchment.AttachmentPath = Session["ProjectCode"].ToString() + "/" + fileName; ;
|
|
addAttchment.ProjectCode = Session["ProjectCode"].ToString();
|
|
addAttchment.UploadedBy = Session["CompanyEmail"].ToString();
|
|
addAttchment.UploadedDate = DateTime.Now;
|
|
addAttchment.AttachmentName = model.AttachmentName;
|
|
myContext.AttachmentsList.Add(addAttchment);
|
|
myContext.SaveChangesAsync();
|
|
TempData["success"] = model.AttachmentName + " successfully saved";
|
|
return RedirectToAction("AttachmentsExpansion");
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
TempData["error"] = "Error!...Failed to upload attachement";
|
|
return RedirectToAction("AttachmentsExpansion");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Maximum file size 7Mb";
|
|
return RedirectToAction("AttachmentsExpansion");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = model.AttachmentName + " Already uploaded";
|
|
return RedirectToAction("AttachmentsExpansion");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Please pdf file only ";
|
|
return RedirectToAction("AttachmentsExpansion");
|
|
}
|
|
|
|
|
|
}
|
|
[HttpPost]
|
|
public ActionResult PostAppoloadedFileAmendment(HttpPostedFileBase UploadedPdf, Attachments model)
|
|
{
|
|
|
|
String FileExt = Path.GetExtension(UploadedPdf.FileName).ToUpper();
|
|
if (FileExt == ".PDF")
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkFileExists = myContext.AttachmentsList.SingleOrDefault(t => t.AttachmentName == model.AttachmentName && t.ProjectCode == ProjectCode);
|
|
if (checkFileExists == null)
|
|
{
|
|
string fileName = null;
|
|
string path = @"\\192.168.2.32\Attachments\" + Session["ProjectCode"].ToString();
|
|
|
|
if (model.UploadedPdf != null && model.UploadedPdf.ContentLength > 0 && model.UploadedPdf.ContentLength <= 7000000)
|
|
{
|
|
try
|
|
{
|
|
fileName = model.AttachmentName+FileExt;
|
|
if (!Directory.Exists(path))
|
|
{
|
|
DirectoryInfo directory = new DirectoryInfo(path);
|
|
|
|
Directory.CreateDirectory(path);
|
|
}
|
|
string newpath = Path.Combine(path, fileName);
|
|
UploadedPdf.SaveAs(newpath);
|
|
Attachments addAttchment = new Attachments();
|
|
addAttchment.AttachmentPath = Session["ProjectCode"].ToString() + "/" + fileName;
|
|
addAttchment.ProjectCode = Session["ProjectCode"].ToString();
|
|
addAttchment.UploadedBy = Session["CompanyEmail"].ToString();
|
|
addAttchment.UploadedDate = DateTime.Now;
|
|
addAttchment.AttachmentName = model.AttachmentName;
|
|
myContext.AttachmentsList.Add(addAttchment);
|
|
myContext.SaveChangesAsync();
|
|
TempData["success"] = model.AttachmentName + " successfully saved";
|
|
return RedirectToAction("AttachmentsAmendments");
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
TempData["error"] = "Error!...Failed to upload attachement";
|
|
return RedirectToAction("AttachmentsAmendments");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Maximum file size 7Mb";
|
|
return RedirectToAction("AttachmentsAmendments");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["success"] = model.AttachmentName + " Already Uploaded";
|
|
return RedirectToAction("AttachmentsAmendments");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Please upload pdf documents only";
|
|
return RedirectToAction("AttachmentsAmendments");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
[HttpPost]
|
|
public ActionResult PostAppoloadedFileAmendmentDeffered(HttpPostedFileBase UploadedPdf, Attachments model)
|
|
{
|
|
|
|
String FileExt = Path.GetExtension(UploadedPdf.FileName).ToUpper();
|
|
if (FileExt == ".PDF")
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkFileExists = myContext.AttachmentsList.SingleOrDefault(t => t.AttachmentName == model.AttachmentName && t.ProjectCode == ProjectCode);
|
|
if (checkFileExists == null)
|
|
{
|
|
string fileName = null;
|
|
string path = @"\\192.168.2.32\Attachments\" + Session["ProjectCode"].ToString();
|
|
|
|
if (model.UploadedPdf != null && model.UploadedPdf.ContentLength > 0 && model.UploadedPdf.ContentLength <= 7000000)
|
|
{
|
|
try
|
|
{
|
|
fileName = GenerateINoCN() + model.AttachmentName+FileExt;
|
|
if (!Directory.Exists(path))
|
|
{
|
|
DirectoryInfo directory = new DirectoryInfo(path);
|
|
|
|
Directory.CreateDirectory(path);
|
|
}
|
|
string newpath = Path.Combine(path, fileName);
|
|
UploadedPdf.SaveAs(newpath);
|
|
Attachments addAttchment = new Attachments();
|
|
addAttchment.AttachmentPath = Session["ProjectCode"].ToString() + "/" + fileName;
|
|
addAttchment.ProjectCode = Session["ProjectCode"].ToString();
|
|
addAttchment.UploadedBy = Session["CompanyEmail"].ToString();
|
|
addAttchment.UploadedDate = DateTime.Now;
|
|
addAttchment.AttachmentName = model.AttachmentName;
|
|
myContext.AttachmentsList.Add(addAttchment);
|
|
myContext.SaveChangesAsync();
|
|
TempData["success"] = model.AttachmentName + " successfully saved";
|
|
return RedirectToAction("AttachmentsAmendmentDeffered");
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
{
|
|
TempData["error"] = "Error!...Failed to upload attachement";
|
|
return RedirectToAction("AttachmentsAmendmentDeffered");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Maximum file size 7Mb";
|
|
return RedirectToAction("AttachmentsAmendmentDeffered");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["success"] = model.AttachmentName + " Already Uploaded";
|
|
return RedirectToAction("AttachmentsAmendmentDeffered");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Please upload pdf documents only";
|
|
return RedirectToAction("AttachmentsAmendmentDeffered");
|
|
}
|
|
}
|
|
|
|
|
|
[HttpPost]
|
|
public ActionResult PostAppoloadedFileExtension(HttpPostedFileBase UploadedPdf, Attachments model)
|
|
{
|
|
|
|
String FileExt = Path.GetExtension(UploadedPdf.FileName).ToUpper();
|
|
if (FileExt == ".PDF")
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkFileExists = myContext.AttachmentsList.SingleOrDefault(t => t.AttachmentName == model.AttachmentName && t.ProjectCode == ProjectCode);
|
|
if (checkFileExists == null)
|
|
{
|
|
string fileName = null;
|
|
string path = @"\\192.168.2.32\Attachments\" + Session["ProjectCode"].ToString();
|
|
|
|
if (model.UploadedPdf != null && model.UploadedPdf.ContentLength > 0 && model.UploadedPdf.ContentLength <= 7000000)
|
|
{
|
|
try
|
|
{
|
|
fileName = model.AttachmentName+FileExt;
|
|
if (!Directory.Exists(path))
|
|
{
|
|
DirectoryInfo directory = new DirectoryInfo(path);
|
|
|
|
Directory.CreateDirectory(path);
|
|
}
|
|
string newpath = Path.Combine(path, fileName);
|
|
UploadedPdf.SaveAs(newpath);
|
|
Attachments addAttchment = new Attachments();
|
|
addAttchment.AttachmentPath = Session["ProjectCode"].ToString() + "/" + fileName;
|
|
addAttchment.ProjectCode = Session["ProjectCode"].ToString();
|
|
addAttchment.UploadedBy = Session["CompanyEmail"].ToString();
|
|
addAttchment.UploadedDate = DateTime.Now;
|
|
addAttchment.AttachmentName = model.AttachmentName;
|
|
myContext.AttachmentsList.Add(addAttchment);
|
|
myContext.SaveChangesAsync();
|
|
TempData["success"] = model.AttachmentName + " successfully saved";
|
|
return RedirectToAction("AttachmentsExtension");
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
{
|
|
TempData["error"] = "Error!...Failed to upload attachement";
|
|
return RedirectToAction("AttachmentsExtension");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return RedirectToAction("AttachmentsExtension");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["success"] = model.AttachmentName + " Already Uploaded";
|
|
return RedirectToAction("AttachmentsExtension");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Please upload pdf documents only";
|
|
return RedirectToAction("AttachmentsExtension");
|
|
}
|
|
|
|
|
|
}
|
|
|
|
[HttpPost]
|
|
public ActionResult PostAppoloadedFileExtensionDeffered(HttpPostedFileBase UploadedPdf, Attachments model)
|
|
{
|
|
|
|
String FileExt = Path.GetExtension(UploadedPdf.FileName).ToUpper();
|
|
if (FileExt == ".PDF")
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkFileExists = myContext.AttachmentsList.SingleOrDefault(t => t.AttachmentName == model.AttachmentName && t.ProjectCode == ProjectCode);
|
|
if (checkFileExists == null)
|
|
{
|
|
string fileName = null;
|
|
string path = @"\\192.168.2.32\Attachments\" + Session["ProjectCode"].ToString();
|
|
|
|
if (model.UploadedPdf != null && model.UploadedPdf.ContentLength > 0 && model.UploadedPdf.ContentLength <= 7000000)
|
|
{
|
|
try
|
|
{
|
|
fileName = GenerateINoCN() + model.AttachmentName + FileExt;
|
|
if (!Directory.Exists(path))
|
|
{
|
|
DirectoryInfo directory = new DirectoryInfo(path);
|
|
|
|
Directory.CreateDirectory(path);
|
|
}
|
|
string newpath = Path.Combine(path, fileName);
|
|
UploadedPdf.SaveAs(newpath);
|
|
Attachments addAttchment = new Attachments();
|
|
addAttchment.AttachmentPath = Session["ProjectCode"].ToString() + "/" + fileName;
|
|
addAttchment.ProjectCode = Session["ProjectCode"].ToString();
|
|
addAttchment.UploadedBy = Session["CompanyEmail"].ToString();
|
|
addAttchment.UploadedDate = DateTime.Now;
|
|
addAttchment.AttachmentName = model.AttachmentName;
|
|
myContext.AttachmentsList.Add(addAttchment);
|
|
myContext.SaveChangesAsync();
|
|
TempData["success"] = model.AttachmentName + " successfully saved";
|
|
return RedirectToAction("AttachmentsExtensionDeffered");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
TempData["error"] = "Error!...Failed to upload attachement";
|
|
return RedirectToAction("AttachmentsExtensionDeffered");
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
return RedirectToAction("AttachmentsExtensionDeffered");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["success"] = model.AttachmentName + " Already Uploaded";
|
|
return RedirectToAction("AttachmentsExtensionDeffered");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Please upload pdf documents only";
|
|
return RedirectToAction("AttachmentsExtensionDeffered");
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
[HttpPost]
|
|
public ActionResult PostAppoloadedFileNewDeffered(HttpPostedFileBase UploadedPdf, Attachments model)
|
|
{
|
|
|
|
|
|
String FileExt = Path.GetExtension(UploadedPdf.FileName).ToUpper();
|
|
if (FileExt == ".PDF")
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkFileExists = myContext.AttachmentsList.SingleOrDefault(t => t.AttachmentName == model.AttachmentName && t.ProjectCode == ProjectCode);
|
|
if (checkFileExists == null)
|
|
{
|
|
string fileName = null;
|
|
string path = @"\\192.168.2.32\Attachments\" + Session["ProjectCode"].ToString();
|
|
|
|
if (model.UploadedPdf != null && model.UploadedPdf.ContentLength > 0 && model.UploadedPdf.ContentLength <= 7000000)
|
|
{
|
|
try
|
|
{
|
|
fileName = GenerateINoCN() + model.AttachmentName+FileExt;
|
|
if (!Directory.Exists(path))
|
|
{
|
|
DirectoryInfo directory = new DirectoryInfo(path);
|
|
|
|
Directory.CreateDirectory(path);
|
|
}
|
|
string newpath = Path.Combine(path, fileName);
|
|
UploadedPdf.SaveAs(newpath);
|
|
Attachments addAttchment = new Attachments();
|
|
addAttchment.AttachmentPath = Session["ProjectCode"].ToString() + "/" + fileName;
|
|
addAttchment.ProjectCode = Session["ProjectCode"].ToString();
|
|
addAttchment.UploadedBy = Session["CompanyEmail"].ToString();
|
|
addAttchment.UploadedDate = DateTime.Now;
|
|
addAttchment.AttachmentName = model.AttachmentName;
|
|
myContext.AttachmentsList.Add(addAttchment);
|
|
myContext.SaveChangesAsync();
|
|
TempData["success"] = model.AttachmentName + " successfully saved";
|
|
return RedirectToAction("AttachmentsNewDeffered");
|
|
}
|
|
|
|
catch (Exception ex)
|
|
{
|
|
TempData["error"] = "Error!...Failed to upload attachement";
|
|
return RedirectToAction("AttachmentsNewDeffered");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return RedirectToAction("AttachmentsNewDeffered");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["success"] = model.AttachmentName + " Already uploaded";
|
|
return RedirectToAction("AttachmentsNewDeffered");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Please upload pdf file";
|
|
return RedirectToAction("AttachmentsNewDeffered");
|
|
}
|
|
|
|
}
|
|
|
|
public ActionResult LoadgeNewCOI()
|
|
|
|
{
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var checkCMProfile = myContext.CompanyProfileExternal.Where(t => t.AddedBy == Username.ToString()).SingleOrDefault();
|
|
if (checkCMProfile != null)
|
|
{
|
|
StepsManagement stManager = new StepsManagement();
|
|
stManager.CompanyName = checkCMProfile.CompanyName;
|
|
stManager.StepNo = "1";
|
|
stManager.CreatedDate = DateTime.Now;
|
|
stManager.CompanyTIN = checkCMProfile.CompanyTIN;
|
|
stManager.CompanyEmail = Username;
|
|
stManager.UpdatedDate = DateTime.Now;
|
|
stManager.EvaluationStatus = "Company Details";
|
|
stManager.SubmittedStatus = "Not Submitted";
|
|
stManager.ApplicationType = "New";
|
|
Session["CompanyName"] = checkCMProfile.CompanyName;
|
|
Session["CompanyTIN"] = checkCMProfile.CompanyTIN;
|
|
Session["ProjectCode"] = GenerateINo();
|
|
stManager.ProjectCode = Session["ProjectCode"].ToString();
|
|
myContext.StepsManagements.Add(stManager);
|
|
myContext.SaveChanges();
|
|
var pobj = new ProjectRepository();
|
|
var _birthObjectp = pobj.CreateLocation();
|
|
return View("ProjectDetails", _birthObjectp);
|
|
}
|
|
|
|
return View("LoadgeNewCOI", _birthObject);
|
|
}
|
|
public ActionResult LoadgeNewExpansion()
|
|
|
|
{
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var checkCMProfile = myContext.CompanyProfileExternal.Where(t => t.AddedBy == Username.ToString()).SingleOrDefault();
|
|
if (checkCMProfile != null)
|
|
{
|
|
StepsManagement stManager = new StepsManagement();
|
|
stManager.CompanyName = checkCMProfile.CompanyName;
|
|
stManager.StepNo = "1";
|
|
stManager.CreatedDate = DateTime.Now;
|
|
stManager.CompanyTIN = checkCMProfile.CompanyTIN;
|
|
stManager.CompanyEmail = Username;
|
|
stManager.UpdatedDate = DateTime.Now;
|
|
stManager.ApplicationType = "Expansion";
|
|
stManager.EvaluationStatus = "Company Details";
|
|
stManager.SubmittedStatus = "Not Submitted";
|
|
Session["CompanyName"] = checkCMProfile.CompanyName;
|
|
Session["CompanyTIN"] = checkCMProfile.CompanyTIN;
|
|
Session["ProjectCode"] = GenerateINo();
|
|
stManager.ProjectCode = Session["ProjectCode"].ToString();
|
|
myContext.StepsManagements.Add(stManager);
|
|
myContext.SaveChanges();
|
|
var pobj = new ProjectRepository();
|
|
var _birthObjectp = pobj.CreateLocation();
|
|
return View("ExpansionProject", _birthObjectp);
|
|
}
|
|
|
|
return View("LoadgeNewExpansion", _birthObject);
|
|
}
|
|
|
|
|
|
public ActionResult LoadgeNewAmendment()
|
|
|
|
{
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var checkCMProfile = myContext.CompanyProfileExternal.Where(t => t.AddedBy == Username.ToString()).SingleOrDefault();
|
|
if (checkCMProfile != null)
|
|
{
|
|
StepsManagement stManager = new StepsManagement();
|
|
stManager.CompanyName = checkCMProfile.CompanyName;
|
|
stManager.StepNo = "1";
|
|
stManager.CreatedDate = DateTime.Now;
|
|
stManager.CompanyTIN = checkCMProfile.CompanyTIN;
|
|
stManager.CompanyEmail = Username;
|
|
stManager.UpdatedDate = DateTime.Now;
|
|
stManager.ApplicationType = "Amendment";
|
|
stManager.EvaluationStatus = "Company Details";
|
|
stManager.SubmittedStatus = "Not Submitted";
|
|
Session["CompanyName"] = checkCMProfile.CompanyName;
|
|
Session["CompanyTIN"] = checkCMProfile.CompanyTIN;
|
|
Session["ProjectCode"] = GenerateINo();
|
|
stManager.ProjectCode = Session["ProjectCode"].ToString();
|
|
myContext.StepsManagements.Add(stManager);
|
|
myContext.SaveChanges();
|
|
var pobj = new ProjectRepository();
|
|
var _birthObjectp = pobj.CreateLocation();
|
|
return View("AmendmentApplication");
|
|
}
|
|
|
|
return View("LoadgeNewAmendment", _birthObject);
|
|
}
|
|
public ActionResult LoadgeNewExtesion()
|
|
|
|
{
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var checkCMProfile = myContext.CompanyProfileExternal.Where(t => t.AddedBy == Username.ToString()).SingleOrDefault();
|
|
if (checkCMProfile != null)
|
|
{
|
|
StepsManagement stManager = new StepsManagement();
|
|
stManager.CompanyName = checkCMProfile.CompanyName;
|
|
stManager.StepNo = "1";
|
|
stManager.CreatedDate = DateTime.Now;
|
|
stManager.CompanyTIN = checkCMProfile.CompanyTIN;
|
|
stManager.CompanyEmail = Username;
|
|
stManager.UpdatedDate = DateTime.Now;
|
|
stManager.ApplicationType = "Extension";
|
|
stManager.EvaluationStatus = "Company Details";
|
|
stManager.SubmittedStatus = "Not Submitted";
|
|
Session["CompanyName"] = checkCMProfile.CompanyName;
|
|
Session["CompanyTIN"] = checkCMProfile.CompanyTIN;
|
|
Session["ProjectCode"] = GenerateINo();
|
|
stManager.ProjectCode = Session["ProjectCode"].ToString();
|
|
myContext.StepsManagements.Add(stManager);
|
|
myContext.SaveChanges();
|
|
var pobj = new ProjectRepository();
|
|
var _birthObjectp = pobj.CreateLocation();
|
|
return View("Extension");
|
|
}
|
|
|
|
return View("LoadgeNewExtesion", _birthObject);
|
|
}
|
|
|
|
|
|
|
|
|
|
public ActionResult ProjectDetails()
|
|
{
|
|
var obj = new ProjectRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
Session["InvestorNo"] = GenerateINo();
|
|
return View("ProjectDetails", _birthObject);
|
|
}
|
|
public ActionResult ShowCompleteCompany()
|
|
{
|
|
var Username = Session["CompanyEmail"];
|
|
var ProjectCode = Session["ProjectCode"];
|
|
var checkIfExists = myContext.CompanyProfileExternal.Where(t => t.AddedBy == Username.ToString()).SingleOrDefault();
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
IEnumerable<SelectListItem> selectListRegion =
|
|
from s in _birthObject.ListofRegions // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.Region),
|
|
Text = checkIfExists.Region,
|
|
Value = checkIfExists.Region
|
|
};
|
|
|
|
checkIfExists.ListofRegions = selectListRegion;
|
|
checkIfExists.IncorpCertDate.ToString();
|
|
IEnumerable<SelectListItem> selectListDistrict =
|
|
from t in _birthObject.ListofDistricts // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (t.Text == checkIfExists.District),
|
|
Text = checkIfExists.District,
|
|
Value = checkIfExists.District
|
|
};
|
|
checkIfExists.ListofDistricts = selectListDistrict;
|
|
IEnumerable<SelectListItem> selectListWard =
|
|
from y in _birthObject.ListofWards // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (y.Text == checkIfExists.Ward),
|
|
Text = checkIfExists.Ward,
|
|
Value = checkIfExists.Ward
|
|
};
|
|
checkIfExists.ListofWards = selectListWard;
|
|
return View(checkIfExists);
|
|
}
|
|
public ActionResult ShowCompleteCompanyExtension()
|
|
{
|
|
var Username = Session["CompanyEmail"];
|
|
var ProjectCode = Session["ProjectCode"];
|
|
var checkIfExists = myContext.CompanyProfileExternal.Where(t => t.AddedBy == Username.ToString()).SingleOrDefault();
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
IEnumerable<SelectListItem> selectListRegion =
|
|
from s in _birthObject.ListofRegions // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.Region),
|
|
Text = checkIfExists.Region,
|
|
Value = checkIfExists.Region
|
|
};
|
|
|
|
checkIfExists.ListofRegions = selectListRegion;
|
|
checkIfExists.IncorpCertDate.ToString();
|
|
IEnumerable<SelectListItem> selectListDistrict =
|
|
from t in _birthObject.ListofDistricts // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (t.Text == checkIfExists.District),
|
|
Text = checkIfExists.District,
|
|
Value = checkIfExists.District
|
|
};
|
|
checkIfExists.ListofDistricts = selectListDistrict;
|
|
IEnumerable<SelectListItem> selectListWard =
|
|
from y in _birthObject.ListofWards // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (y.Text == checkIfExists.Ward),
|
|
Text = checkIfExists.Ward,
|
|
Value = checkIfExists.Ward
|
|
};
|
|
checkIfExists.ListofWards = selectListWard;
|
|
return View(checkIfExists);
|
|
}
|
|
public ActionResult ShowCompleteCompanyExpansion()
|
|
{
|
|
var Username = Session["CompanyEmail"];
|
|
var ProjectCode = Session["ProjectCode"];
|
|
var checkIfExists = myContext.CompanyProfileExternal.Where(t => t.AddedBy == Username.ToString()).SingleOrDefault();
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
IEnumerable<SelectListItem> selectListRegion =
|
|
from s in _birthObject.ListofRegions // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.Region),
|
|
Text = checkIfExists.Region,
|
|
Value = checkIfExists.Region
|
|
};
|
|
|
|
checkIfExists.ListofRegions = selectListRegion;
|
|
checkIfExists.IncorpCertDate.ToString();
|
|
IEnumerable<SelectListItem> selectListDistrict =
|
|
from t in _birthObject.ListofDistricts // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (t.Text == checkIfExists.District),
|
|
Text = checkIfExists.District,
|
|
Value = checkIfExists.District
|
|
};
|
|
checkIfExists.ListofDistricts = selectListDistrict;
|
|
IEnumerable<SelectListItem> selectListWard =
|
|
from y in _birthObject.ListofWards // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (y.Text == checkIfExists.Ward),
|
|
Text = checkIfExists.Ward,
|
|
Value = checkIfExists.Ward
|
|
};
|
|
checkIfExists.ListofWards = selectListWard;
|
|
return View(checkIfExists);
|
|
}
|
|
public ActionResult ShowAmendmentDetails()
|
|
{
|
|
var Username = Session["CompanyEmail"];
|
|
var ProjectCode = Session["ProjectCode"];
|
|
var checkIfExists = myContext.CompanyAmmendmentsExternal.Where(t => t.ProjectCode == ProjectCode.ToString()).SingleOrDefault();
|
|
return View(checkIfExists);
|
|
}
|
|
public ActionResult ShowExtensionDetails()
|
|
{
|
|
var Username = Session["CompanyEmail"];
|
|
var ProjectCode = Session["ProjectCode"];
|
|
var checkIfExists = myContext.CompanyAmmendmentsExternal.Where(t => t.ProjectCode == ProjectCode.ToString()).SingleOrDefault();
|
|
return View(checkIfExists);
|
|
}
|
|
public ActionResult ShowCompleteCompanyAmendment()
|
|
{
|
|
var Username = Session["CompanyEmail"];
|
|
var ProjectCode = Session["ProjectCode"];
|
|
var checkIfExists = myContext.CompanyProfileExternal.Where(t => t.AddedBy == Username.ToString()).SingleOrDefault();
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
IEnumerable<SelectListItem> selectListRegion =
|
|
from s in _birthObject.ListofRegions // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.Region),
|
|
Text = checkIfExists.Region,
|
|
Value = checkIfExists.Region
|
|
};
|
|
|
|
checkIfExists.ListofRegions = selectListRegion;
|
|
checkIfExists.IncorpCertDate.ToString();
|
|
IEnumerable<SelectListItem> selectListDistrict =
|
|
from t in _birthObject.ListofDistricts // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (t.Text == checkIfExists.District),
|
|
Text = checkIfExists.District,
|
|
Value = checkIfExists.District
|
|
|
|
};
|
|
checkIfExists.ListofDistricts = selectListDistrict;
|
|
IEnumerable<SelectListItem> selectListWard =
|
|
from y in _birthObject.ListofWards // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (y.Text == checkIfExists.Ward),
|
|
Text = checkIfExists.Ward,
|
|
Value = checkIfExists.Ward
|
|
|
|
};
|
|
checkIfExists.ListofWards = selectListWard;
|
|
return View(checkIfExists);
|
|
}
|
|
public ActionResult ShowFinancingProfile()
|
|
{
|
|
var Username = Session["CompanyEmail"];
|
|
var ProjectCode = Session["ProjectCode"];
|
|
var checkIfExists = myContext.FinancingProfilesExternals.SingleOrDefault(t => t.ProjectCode == ProjectCode.ToString());
|
|
var checkIfPExists = myContext.ProjectProfilesExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode.ToString());
|
|
var obj = new FinancingRepository();
|
|
var objC = new Countries();
|
|
|
|
var _birthObject = obj.CreateCountry();
|
|
IEnumerable<SelectListItem> selectForeignCountry =
|
|
from s in _birthObject.ListofForeignEquity // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.SourceCountryEquity),
|
|
Text = checkIfExists.SourceCountryEquity,
|
|
Value = checkIfExists.SourceCountryEquity
|
|
};
|
|
|
|
checkIfExists.ListofForeignEquity = objC.GetCountries();
|
|
IEnumerable<SelectListItem> selectForeignLoan =
|
|
from s in _birthObject.ListofForeignLoan
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.SourceCountryLoan),
|
|
Text = checkIfExists.SourceCountryLoan,
|
|
Value = checkIfExists.SourceCountryLoan
|
|
};
|
|
|
|
checkIfExists.ListofForeignLoan = objC.GetCountries();
|
|
Session["TypeOfOwnership"] = checkIfPExists.TypeofOwnership;
|
|
return View(checkIfExists);
|
|
}
|
|
public ActionResult ShowErrorPage()
|
|
{
|
|
|
|
return View();
|
|
}
|
|
public ActionResult ShowFinancingProfileExpansion()
|
|
{
|
|
var Username = Session["CompanyEmail"];
|
|
var ProjectCode = Session["ProjectCode"];
|
|
var checkIfExists = myContext.FinancingProfilesExternals.SingleOrDefault(t => t.ProjectCode == ProjectCode.ToString());
|
|
var obj = new FinancingRepository();
|
|
var objC = new Countries();
|
|
|
|
var _birthObject = obj.CreateCountry();
|
|
IEnumerable<SelectListItem> selectForeignCountry =
|
|
from s in _birthObject.ListofForeignEquity // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.SourceCountryEquity),
|
|
Text = checkIfExists.SourceCountryEquity,
|
|
Value = checkIfExists.SourceCountryEquity
|
|
};
|
|
|
|
checkIfExists.ListofForeignEquity = objC.GetCountries();
|
|
IEnumerable<SelectListItem> selectForeignLoan =
|
|
from s in _birthObject.ListofForeignLoan
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.SourceCountryLoan),
|
|
Text = checkIfExists.SourceCountryLoan,
|
|
Value = checkIfExists.SourceCountryLoan
|
|
};
|
|
|
|
checkIfExists.ListofForeignLoan = objC.GetCountries();
|
|
return View(checkIfExists);
|
|
}
|
|
|
|
public IEnumerable<SelectListItem> GetListofRegionsEdit(string RegionName)
|
|
{
|
|
using (var context1 = new OSSDBContext())
|
|
{
|
|
List<SelectListItem> Attachment = context1.Regions.AsNoTracking()
|
|
|
|
.Select(n =>
|
|
new SelectListItem
|
|
{
|
|
Value = n.RegionName,
|
|
Text = n.RegionName
|
|
}).ToList();
|
|
|
|
var countrytip2 = new SelectListItem()
|
|
{
|
|
Value = RegionName,
|
|
Text = RegionName
|
|
|
|
};
|
|
Attachment.Insert(0, countrytip2);
|
|
return new SelectList(Attachment, "Value", "Text");
|
|
}
|
|
}
|
|
public ActionResult ShowProjectDetails()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"];
|
|
var checkIfExists = myContext.ProjectProfilesExternal.Where(t => t.ProjectCode == ProjectCode.ToString()).SingleOrDefault();
|
|
var obj = new ProjectRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
IEnumerable<SelectListItem> selectListRegion =
|
|
from s in _birthObject.ListofRegions // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.Region),
|
|
Text = checkIfExists.Region,
|
|
Value = checkIfExists.Region
|
|
};
|
|
|
|
checkIfExists.ListofRegions = GetListofRegionsEdit(checkIfExists.Region);
|
|
|
|
IEnumerable<SelectListItem> SelectSectors =
|
|
from s in _birthObject.ListofSectors // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.Sector),
|
|
Text = checkIfExists.Sector,
|
|
Value = checkIfExists.Sector
|
|
};
|
|
|
|
checkIfExists.ListofSectors = SelectSectors;
|
|
IEnumerable<SelectListItem> SelectSubSector =
|
|
from s in _birthObject.ListofSubectors // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.SubSector),
|
|
Text = checkIfExists.SubSector,
|
|
Value = checkIfExists.SubSector
|
|
};
|
|
|
|
checkIfExists.ListofSubectors = SelectSubSector;
|
|
|
|
IEnumerable<SelectListItem> selectListDistrict =
|
|
from t in _birthObject.ListofDistricts // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (t.Text == checkIfExists.District),
|
|
Text = checkIfExists.District,
|
|
Value = checkIfExists.District
|
|
};
|
|
checkIfExists.ListofDistricts = selectListDistrict;
|
|
IEnumerable<SelectListItem> selectListWard =
|
|
from y in _birthObject.ListofWards // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (y.Text == checkIfExists.Ward),
|
|
Text = checkIfExists.Ward,
|
|
Value = checkIfExists.Ward
|
|
};
|
|
checkIfExists.ListofWards = selectListWard;
|
|
return View(checkIfExists);
|
|
}
|
|
public ActionResult ShowDMDetailsDetails()
|
|
{
|
|
var Username = Session["CompanyEmail"];
|
|
|
|
var checkIfExists = myContext.CompanyProfileExternal.Where(t => t.AddedBy == Username.ToString()).SingleOrDefault();
|
|
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
IEnumerable<SelectListItem> selectListRegion =
|
|
from s in _birthObject.ListofRegions // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.Region),
|
|
Text = checkIfExists.Region,
|
|
Value = checkIfExists.Region
|
|
};
|
|
|
|
|
|
|
|
checkIfExists.ListofRegions = GetListofRegionsEdit(checkIfExists.Region);
|
|
checkIfExists.IncorpCertDate.ToString();
|
|
IEnumerable<SelectListItem> selectListDistrict =
|
|
from t in _birthObject.ListofDistricts // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (t.Text == checkIfExists.District),
|
|
Text = checkIfExists.District,
|
|
Value = checkIfExists.District
|
|
|
|
};
|
|
checkIfExists.ListofDistricts = selectListDistrict;
|
|
IEnumerable<SelectListItem> selectListWard =
|
|
from y in _birthObject.ListofWards // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (y.Text == checkIfExists.Ward),
|
|
Text = checkIfExists.Ward,
|
|
Value = checkIfExists.Ward
|
|
|
|
};
|
|
checkIfExists.ListofWards = selectListWard;
|
|
return View(checkIfExists);
|
|
}
|
|
|
|
|
|
public ActionResult ShowDMDetailsDetailsDetails()
|
|
{
|
|
var Username = Session["CompanyEmail"];
|
|
|
|
var checkIfExists = myContext.CompanyProfileExternal.Where(t => t.AddedBy == Username.ToString()).SingleOrDefault();
|
|
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
IEnumerable<SelectListItem> selectListRegion =
|
|
from s in _birthObject.ListofRegions // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.Region),
|
|
Text = checkIfExists.Region,
|
|
Value = checkIfExists.Region
|
|
};
|
|
|
|
|
|
|
|
checkIfExists.ListofRegions = selectListRegion;
|
|
checkIfExists.IncorpCertDate.ToString();
|
|
IEnumerable<SelectListItem> selectListDistrict =
|
|
from t in _birthObject.ListofDistricts // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (t.Text == checkIfExists.District),
|
|
Text = checkIfExists.District,
|
|
Value = checkIfExists.District
|
|
|
|
};
|
|
checkIfExists.ListofDistricts = selectListDistrict;
|
|
IEnumerable<SelectListItem> selectListWard =
|
|
from y in _birthObject.ListofWards // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (y.Text == checkIfExists.Ward),
|
|
Text = checkIfExists.Ward,
|
|
Value = checkIfExists.Ward
|
|
|
|
};
|
|
checkIfExists.ListofWards = selectListWard;
|
|
return View(checkIfExists);
|
|
}
|
|
public ActionResult ShowDMDetailsDetailsExtension()
|
|
{
|
|
var Username = Session["CompanyEmail"];
|
|
|
|
var checkIfExists = myContext.CompanyProfileExternal.Where(t => t.AddedBy == Username.ToString()).SingleOrDefault();
|
|
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
IEnumerable<SelectListItem> selectListRegion =
|
|
from s in _birthObject.ListofRegions // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.Region),
|
|
Text = checkIfExists.Region,
|
|
Value = checkIfExists.Region
|
|
};
|
|
|
|
|
|
|
|
checkIfExists.ListofRegions = selectListRegion;
|
|
checkIfExists.IncorpCertDate.ToString();
|
|
IEnumerable<SelectListItem> selectListDistrict =
|
|
from t in _birthObject.ListofDistricts // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (t.Text == checkIfExists.District),
|
|
Text = checkIfExists.District,
|
|
Value = checkIfExists.District
|
|
|
|
};
|
|
checkIfExists.ListofDistricts = selectListDistrict;
|
|
IEnumerable<SelectListItem> selectListWard =
|
|
from y in _birthObject.ListofWards // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (y.Text == checkIfExists.Ward),
|
|
Text = checkIfExists.Ward,
|
|
Value = checkIfExists.Ward
|
|
|
|
};
|
|
checkIfExists.ListofWards = selectListWard;
|
|
return View(checkIfExists);
|
|
}
|
|
public ActionResult ShowDMDetailsDetailsExpansion()
|
|
{
|
|
var Username = Session["CompanyEmail"];
|
|
|
|
var checkIfExists = myContext.CompanyProfileExternal.Where(t => t.AddedBy == Username.ToString()).SingleOrDefault();
|
|
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
IEnumerable<SelectListItem> selectListRegion =
|
|
from s in _birthObject.ListofRegions // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.Region),
|
|
Text = checkIfExists.Region,
|
|
Value = checkIfExists.Region
|
|
};
|
|
|
|
|
|
|
|
checkIfExists.ListofRegions = selectListRegion;
|
|
checkIfExists.IncorpCertDate.ToString();
|
|
IEnumerable<SelectListItem> selectListDistrict =
|
|
from t in _birthObject.ListofDistricts // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (t.Text == checkIfExists.District),
|
|
Text = checkIfExists.District,
|
|
Value = checkIfExists.District
|
|
|
|
};
|
|
checkIfExists.ListofDistricts = selectListDistrict;
|
|
IEnumerable<SelectListItem> selectListWard =
|
|
from y in _birthObject.ListofWards // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (y.Text == checkIfExists.Ward),
|
|
Text = checkIfExists.Ward,
|
|
Value = checkIfExists.Ward
|
|
|
|
};
|
|
checkIfExists.ListofWards = selectListWard;
|
|
return View(checkIfExists);
|
|
}
|
|
public ActionResult ShowProjectDetailsExpansion()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"];
|
|
var checkIfExists = myContext.ProjectProfilesExternal.Where(t => t.ProjectCode == ProjectCode.ToString()).SingleOrDefault();
|
|
var obj = new ProjectRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
IEnumerable<SelectListItem> selectListRegion =
|
|
from s in _birthObject.ListofRegions // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.Region),
|
|
Text = checkIfExists.Region,
|
|
Value = checkIfExists.Region
|
|
};
|
|
|
|
checkIfExists.ListofRegions = selectListRegion;
|
|
|
|
IEnumerable<SelectListItem> SelectSectors =
|
|
from s in _birthObject.ListofSectors // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.Sector),
|
|
Text = checkIfExists.Sector,
|
|
Value = checkIfExists.Sector
|
|
};
|
|
|
|
checkIfExists.ListofSectors = SelectSectors;
|
|
IEnumerable<SelectListItem> SelectSubSector =
|
|
from s in _birthObject.ListofSubectors // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.SubSector),
|
|
Text = checkIfExists.SubSector,
|
|
Value = checkIfExists.SubSector
|
|
};
|
|
|
|
checkIfExists.ListofSubectors = SelectSubSector;
|
|
|
|
IEnumerable<SelectListItem> selectListDistrict =
|
|
from t in _birthObject.ListofDistricts // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (t.Text == checkIfExists.District),
|
|
Text = checkIfExists.District,
|
|
Value = checkIfExists.District
|
|
};
|
|
checkIfExists.ListofDistricts = selectListDistrict;
|
|
IEnumerable<SelectListItem> selectListWard =
|
|
from y in _birthObject.ListofWards // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (y.Text == checkIfExists.Ward),
|
|
Text = checkIfExists.Ward,
|
|
Value = checkIfExists.Ward
|
|
};
|
|
checkIfExists.ListofWards = selectListWard;
|
|
return View(checkIfExists);
|
|
}
|
|
public ActionResult ShowDMDetailsDetailsAmendment()
|
|
{
|
|
var Username = Session["CompanyEmail"];
|
|
|
|
var checkIfExists = myContext.CompanyProfileExternal.Where(t => t.AddedBy == Username.ToString()).SingleOrDefault();
|
|
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
IEnumerable<SelectListItem> selectListRegion =
|
|
from s in _birthObject.ListofRegions // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (s.Text == checkIfExists.Region),
|
|
Text = checkIfExists.Region,
|
|
Value = checkIfExists.Region
|
|
};
|
|
|
|
|
|
|
|
checkIfExists.ListofRegions = selectListRegion;
|
|
checkIfExists.IncorpCertDate.ToString();
|
|
IEnumerable<SelectListItem> selectListDistrict =
|
|
from t in _birthObject.ListofDistricts // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (t.Text == checkIfExists.District),
|
|
Text = checkIfExists.District,
|
|
Value = checkIfExists.District
|
|
|
|
};
|
|
checkIfExists.ListofDistricts = selectListDistrict;
|
|
IEnumerable<SelectListItem> selectListWard =
|
|
from y in _birthObject.ListofWards // where ever you get this from, database etc.
|
|
select new SelectListItem
|
|
{
|
|
Selected = (y.Text == checkIfExists.Ward),
|
|
Text = checkIfExists.Ward,
|
|
Value = checkIfExists.Ward
|
|
|
|
};
|
|
checkIfExists.ListofWards = selectListWard;
|
|
return View(checkIfExists);
|
|
}
|
|
public ActionResult FinancingDetailsExternal()
|
|
{
|
|
|
|
var obj = new FinancingRepository();
|
|
var _birthObject = obj.CreateCountry();
|
|
return View("FinancingDetailsExternal", _birthObject);
|
|
}
|
|
|
|
public ActionResult FinancingDetailsExpansion()
|
|
{
|
|
|
|
var obj = new FinancingRepository();
|
|
var _birthObject = obj.CreateCountry();
|
|
return View("FinancingDetailsExpansion", _birthObject);
|
|
}
|
|
public ActionResult RedirectCompany()
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var checkIfExist = myContext.CompanyProfileExternal.SingleOrDefault(t => t.AddedBy == Username && t.CleaningStatus == "Submitted");
|
|
if (checkIfExist != null)
|
|
{
|
|
return RedirectToAction("ShowCompleteCompany", "NewCOI");
|
|
}
|
|
return RedirectToAction("ShowDMDetailsDetails", "NewCOI");
|
|
}
|
|
|
|
public ActionResult RedirectCompanyExpansion()
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var checkIfExist = myContext.CompanyProfileExternal.SingleOrDefault(t => t.AddedBy == Username && t.CleaningStatus == "Submitted");
|
|
if (checkIfExist != null)
|
|
{
|
|
return RedirectToAction("ShowCompleteCompanyExpansion", "NewCOI");
|
|
}
|
|
return RedirectToAction("ShowDMDetailsDetailsExpansion", "NewCOI");
|
|
}
|
|
|
|
|
|
public ActionResult RedirectCompanyAmendment()
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var checkIfExist = myContext.CompanyProfileExternal.SingleOrDefault(t => t.AddedBy == Username && t.CleaningStatus == "Submitted");
|
|
if (checkIfExist != null)
|
|
{
|
|
return RedirectToAction("ShowCompleteCompanyAmendment", "NewCOI");
|
|
}
|
|
return RedirectToAction("ShowDMDetailsDetailsAmendment", "NewCOI");
|
|
}
|
|
public ActionResult RedirectCompanyExtension()
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var checkIfExist = myContext.CompanyProfileExternal.SingleOrDefault(t => t.AddedBy == Username && t.CleaningStatus == "Submitted");
|
|
if (checkIfExist != null)
|
|
{
|
|
return RedirectToAction("ShowCompleteCompanyExtension", "NewCOI");
|
|
}
|
|
return RedirectToAction("ShowDMDetailsDetailsExtension", "NewCOI");
|
|
}
|
|
public ActionResult RedirectProject()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkIfExist = myContext.ProjectProfilesExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
if (checkIfExist != null)
|
|
{
|
|
return RedirectToAction("ShowProjectDetails", "NewCOI");
|
|
}
|
|
return RedirectToAction("ProjectDetails", "NewCOI");
|
|
}
|
|
public ActionResult RedirectProjectExpansion()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkIfExist = myContext.ProjectProfilesExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
if (checkIfExist != null)
|
|
{
|
|
return RedirectToAction("ShowProjectDetailsExpansion", "NewCOI");
|
|
}
|
|
return RedirectToAction("ExpansionProject", "NewCOI");
|
|
}
|
|
public ActionResult RedirectProjectAmendment()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkIfExist = myContext.CompanyAmmendmentsExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
if (checkIfExist != null)
|
|
{
|
|
return RedirectToAction("ShowAmendmentDetails", "NewCOI");
|
|
}
|
|
return RedirectToAction("AmendmentApplication", "NewCOI");
|
|
}
|
|
public ActionResult RedirectProjectExtension()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkIfExist = myContext.CompanyAmmendmentsExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
if (checkIfExist != null)
|
|
{
|
|
return RedirectToAction("ShowExtensionDetails", "NewCOI");
|
|
}
|
|
return RedirectToAction("Extension", "NewCOI");
|
|
}
|
|
public ActionResult RedirectFinancing()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkIfExist = myContext.FinancingProfilesExternals.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
if (checkIfExist != null)
|
|
{
|
|
return RedirectToAction("ShowFinancingProfile", "NewCOI");
|
|
}
|
|
return RedirectToAction("FinancingDetailsExternal", "NewCOI");
|
|
}
|
|
|
|
|
|
public ActionResult RedirectFinancingExpansion()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkIfExist = myContext.FinancingProfilesExternals.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
if (checkIfExist != null)
|
|
{
|
|
return RedirectToAction("ShowFinancingProfileExpansion", "NewCOI");
|
|
}
|
|
return RedirectToAction("FinancingDetailsExpansion", "NewCOI");
|
|
}
|
|
public ActionResult AttachmentsNew()
|
|
{
|
|
return View("AttachmentsNew");
|
|
}
|
|
public ActionResult AttachmentsNewDeffered()
|
|
{
|
|
return View("AttachmentsNewDeffered");
|
|
}
|
|
public ActionResult AttachmentsExpansion()
|
|
{
|
|
return View("AttachmentsExpansion");
|
|
}
|
|
public ActionResult AttachmentsAmendments()
|
|
{
|
|
return View("AttachmentsAmendments");
|
|
}
|
|
|
|
public ActionResult AttachmentsAmendmentDeffered()
|
|
{
|
|
return View("AttachmentsAmendmentDeffered");
|
|
}
|
|
|
|
public ActionResult AttachmentsExtension()
|
|
{
|
|
return View("AttachmentsExtension");
|
|
}
|
|
public ActionResult AttachmentsExtensionDeffered()
|
|
{
|
|
return View("AttachmentsExtensionDeffered");
|
|
}
|
|
[HttpPost]
|
|
public ActionResult WaitingApproval(ApplicationManager model)
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkIfExist = myContext.ApplicationManagers.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
var checkApplicant = myContext.InvestorExternl.SingleOrDefault(t => t.CompanyEmail == Username);
|
|
var checkAmentExist = myContext.CompanyAmmendmentsExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
if (checkIfExist == null)
|
|
{
|
|
var getPDetails = myContext.CompanyAmmendmentsExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
ApplicationManager inv = new ApplicationManager();
|
|
inv.ProjectCode = ProjectCode;
|
|
inv.ProjectName = getPDetails.ProjectName;
|
|
inv.CompanyName = getPDetails.CompanyName;
|
|
if(model.Currency=="TZS")
|
|
{
|
|
inv.Amount = 2300000;
|
|
|
|
Session["Amount"] = "2300000";
|
|
Session["AmountinWords"] = "Two million, five hundred thirty thousand Tanzanian Shillings";
|
|
Session["Currency"] = model.Currency;
|
|
}
|
|
if (model.Currency == "USD")
|
|
{
|
|
inv.Amount = 1000;
|
|
Session["Amount"] = "1000";
|
|
Session["AmountinWords"] = "ONE THOUSAND ONE HUNDRED AMERICAN DOLLARS";
|
|
Session["Currency"] = model.Currency;
|
|
}
|
|
inv.Currency = model.Currency;
|
|
inv.Station = model.Station;
|
|
inv.ServiceName = Session["ServiceName"].ToString();
|
|
inv.MobileNo = checkApplicant.Mobile;
|
|
inv.CreatedDate = DateTime.Now;
|
|
inv.CompanyTIN = Session["CompanyTIN"].ToString();
|
|
inv.CompanyEmail = Username;
|
|
var checkSteps = myContext.StepsManagements.Where(t => t.ProjectCode == ProjectCode.ToString()).SingleOrDefault();
|
|
checkSteps.StepNo = "Completed";
|
|
checkSteps.SubmittedStatus = "Submitted";
|
|
checkSteps.UpdatedDate = DateTime.Now;
|
|
checkAmentExist.ApprovalStatus = "Waiting_Approval";
|
|
|
|
myContext.ApplicationManagers.Add(inv);
|
|
myContext.SaveChanges();
|
|
|
|
return RedirectToAction("ExtensionIndex");
|
|
}
|
|
else
|
|
{
|
|
|
|
return RedirectToAction("ExtensionIndex");
|
|
}
|
|
}
|
|
public ActionResult ResubmitExtension()
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkIfExist = myContext.ApplicationManagers.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
var checkApplicant = myContext.InvestorExternl.SingleOrDefault(t => t.CompanyEmail == Username);
|
|
var checkAmentExist = myContext.CompanyAmmendmentsExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
if (checkIfExist != null)
|
|
{
|
|
var getPDetails = myContext.CompanyAmmendmentsExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
getPDetails.AssignedStatus = "Investor_Returned";
|
|
checkIfExist.EvaluationStatus = "Investor_Returned";
|
|
checkAmentExist.ApprovalStatus = "Waiting_Approval";
|
|
|
|
myContext.SaveChanges();
|
|
TempData["success"] = "Application successfully returned for evaluation";
|
|
return RedirectToAction("ExtensionIndex");
|
|
}
|
|
else
|
|
{
|
|
|
|
return RedirectToAction("ExtensionIndex");
|
|
}
|
|
}
|
|
public ActionResult ResubmitAmendment()
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkIfExist = myContext.ApplicationManagers.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
var checkAmendDetails = myContext.CompanyAmmendments.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
var checkApplicant = myContext.InvestorExternl.SingleOrDefault(t => t.CompanyEmail == Username);
|
|
var checkAmentExist = myContext.CompanyAmmendmentsExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
if (checkIfExist != null)
|
|
{
|
|
var getPDetails = myContext.CompanyAmmendmentsExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
checkAmendDetails.CurrentlyWith = "Returned";
|
|
checkAmendDetails.ProcessingStatus = "DIF";
|
|
checkIfExist.EvaluationStatus = "DIF";
|
|
checkAmentExist.ApprovalStatus = "DIF";
|
|
|
|
myContext.SaveChanges();
|
|
TempData["success"] = "Application successfully returned for evaluation";
|
|
return RedirectToAction("IndexAmendment");
|
|
}
|
|
else
|
|
{
|
|
|
|
return RedirectToAction("IndexAmendment");
|
|
}
|
|
}
|
|
public ActionResult ResubmitNew()
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkIfExist = myContext.ApplicationManagers.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
var checkApplicant = myContext.InvestorExternl.SingleOrDefault(t => t.CompanyEmail == Username);
|
|
var checkPExist = myContext.ProjectProfiles.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
if (checkIfExist != null)
|
|
{
|
|
|
|
checkIfExist.EvaluationStatus = "DIF";
|
|
checkPExist.ProcessingStatus = "DIF";
|
|
checkPExist.CurrentlyWith = "Returned";
|
|
myContext.ApplicationManagers.AddOrUpdate();
|
|
myContext.ProjectProfiles.AddOrUpdate();
|
|
myContext.SaveChanges();
|
|
TempData["success"] = "Application successfully returned for evaluation";
|
|
return View("Index");
|
|
}
|
|
else
|
|
{
|
|
|
|
return View("Index");
|
|
}
|
|
}
|
|
|
|
|
|
public ActionResult Payment(ApplicationManager model)
|
|
{
|
|
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkIfExist = myContext.ApplicationManagers.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
var checkIfCompany = myContext.CompanyProfileExternal.SingleOrDefault(t => t.AddedBy == Username);
|
|
var checkApplicant = myContext.InvestorExternl.SingleOrDefault(t => t.CompanyEmail == Username);
|
|
if (checkIfExist == null)
|
|
{
|
|
var getPDetails = myContext.ProjectProfilesExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
ApplicationManager inv = new ApplicationManager();
|
|
inv.ProjectCode = ProjectCode;
|
|
inv.ProjectName = getPDetails.ProjectName;
|
|
inv.CompanyName = getPDetails.CompanyName;
|
|
inv.ServiceName = Session["ServiceName"].ToString();
|
|
inv.MobileNo = checkApplicant.Mobile;
|
|
inv.CreatedDate = DateTime.Now;
|
|
inv.CompanyTIN = Session["CompanyTIN"].ToString();
|
|
inv.CompanyEmail = Username;
|
|
var checkSteps = myContext.StepsManagements.Where(t => t.ProjectCode == ProjectCode.ToString()).SingleOrDefault();
|
|
checkSteps.StepNo = "Completed";
|
|
checkSteps.SubmittedStatus = "Submitted";
|
|
checkSteps.UpdatedDate = DateTime.Now;
|
|
inv.Currency = model.Currency;
|
|
inv.Station = model.Station;
|
|
inv.CompanyTIN = Session["CompanyTIN"].ToString();
|
|
if (model.Currency == "USD")
|
|
{
|
|
inv.Amount = 1100;
|
|
Session["Amount"] = "1100";
|
|
Session["AmountinWords"] = "ONE THOUSAND ONE HUNDRED AMERICAN DOLLARS";
|
|
Session["Currency"] = model.Currency;
|
|
}
|
|
else
|
|
{
|
|
inv.Amount = 2530000;
|
|
Session["Amount"] = "2530000";
|
|
Session["AmountinWords"] = "Two million, five hundred thirty thousand Tanzanian Shillings";
|
|
Session["Currency"] = model.Currency;
|
|
}
|
|
myContext.ApplicationManagers.Add(inv);
|
|
checkIfCompany.CleaningStatus = "Submitted";
|
|
myContext.SaveChanges();
|
|
if (Session["ServiceName"].ToString() == "Expansion")
|
|
{
|
|
return View("PaymentExpansion");
|
|
}
|
|
return View("Payment");
|
|
}
|
|
else
|
|
{
|
|
|
|
return View("Payment");
|
|
}
|
|
}
|
|
|
|
[HttpPost]
|
|
public ActionResult PaymentAmendment(ApplicationManager model)
|
|
{
|
|
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkIfExist = myContext.ApplicationManagers.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
var checkApplicant = myContext.InvestorExternl.SingleOrDefault(t => t.CompanyEmail == Username);
|
|
if (checkIfExist == null)
|
|
{
|
|
var getPDetails = myContext.CompanyAmmendmentsExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
ApplicationManager inv = new ApplicationManager();
|
|
inv.ProjectCode = ProjectCode;
|
|
inv.ProjectName = getPDetails.ProjectName;
|
|
inv.CompanyName = getPDetails.CompanyName;
|
|
inv.ServiceName = Session["ServiceName"].ToString();
|
|
inv.MobileNo = checkApplicant.Mobile;
|
|
inv.CreatedDate = DateTime.Now;
|
|
inv.Currency = model.Currency;
|
|
inv.Station = model.Station;
|
|
inv.CompanyTIN = Session["CompanyTIN"].ToString();
|
|
if (model.Currency == "USD")
|
|
{
|
|
inv.Amount = 1000;
|
|
Session["Amount"] = "1000";
|
|
Session["AmountinWords"] = "ONE THOUSAND AMERICAN DOLLARS";
|
|
Session["Currency"] = model.Currency;
|
|
}
|
|
else
|
|
{
|
|
inv.Amount = 2300000;
|
|
Session["Amount"] = "2300000";
|
|
Session["AmountinWords"] = "Two million three hundred thousand Tanzanian Shillings";
|
|
Session["Currency"] = model.Currency;
|
|
}
|
|
|
|
inv.CompanyEmail = Username;
|
|
var checkSteps = myContext.StepsManagements.Where(t => t.ProjectCode == ProjectCode.ToString()).SingleOrDefault();
|
|
checkSteps.StepNo = "Completed";
|
|
checkSteps.SubmittedStatus = "Submitted";
|
|
checkSteps.UpdatedDate = DateTime.Now;
|
|
myContext.ApplicationManagers.Add(inv);
|
|
myContext.SaveChanges();
|
|
|
|
return View("PaymentAmendment");
|
|
}
|
|
else
|
|
{
|
|
|
|
return View("PaymentAmendment");
|
|
}
|
|
}
|
|
|
|
public ActionResult PaymentExtension()
|
|
{
|
|
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkIfExist = myContext.ApplicationManagers.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
var checkApplicant = myContext.InvestorExternl.SingleOrDefault(t => t.CompanyEmail == Username);
|
|
if (checkIfExist == null)
|
|
{
|
|
var getPDetails = myContext.CompanyAmmendmentsExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
ApplicationManager inv = new ApplicationManager();
|
|
inv.ProjectCode = ProjectCode;
|
|
inv.ProjectName = getPDetails.ProjectName;
|
|
inv.CompanyName = getPDetails.CompanyName;
|
|
inv.ServiceName = Session["ServiceName"].ToString();
|
|
inv.MobileNo = checkApplicant.Mobile;
|
|
inv.CreatedDate = DateTime.Now;
|
|
inv.CompanyTIN = Session["CompanyTIN"].ToString();
|
|
inv.Amount = 1000;
|
|
Session["Amount"] = "1000";
|
|
inv.CompanyEmail = Username;
|
|
var checkSteps = myContext.StepsManagements.Where(t => t.ProjectCode == ProjectCode.ToString()).SingleOrDefault();
|
|
checkSteps.StepNo = "Completed";
|
|
checkSteps.SubmittedStatus = "Submitted";
|
|
checkSteps.UpdatedDate = DateTime.Now;
|
|
myContext.ApplicationManagers.Add(inv);
|
|
myContext.SaveChanges();
|
|
|
|
return View("PaymentExtension");
|
|
}
|
|
else
|
|
{
|
|
|
|
return View("PaymentExtension");
|
|
}
|
|
}
|
|
public ActionResult PaymentExpansion()
|
|
{
|
|
return View("PaymentExpansion");
|
|
}
|
|
|
|
public async Task<ActionResult> GenerateControlNo()
|
|
{
|
|
await Task.Delay(4000);
|
|
return View();
|
|
}
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public async Task<ActionResult> ProceControlNumber()
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var Currency = Session["Currency"].ToString();
|
|
|
|
|
|
|
|
var getPDetails = myContext.ApplicationManagers.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
if(getPDetails.Currency=="USD")
|
|
{
|
|
Session["EqAmount"] = (2300) * (getPDetails.Amount);
|
|
}
|
|
else
|
|
{
|
|
Session["EqAmount"] = getPDetails.Amount;
|
|
}
|
|
|
|
try
|
|
{
|
|
getPDetails.UpdatedDate = DateTime.Now;
|
|
using (var client = new HttpClient())
|
|
{
|
|
client.DefaultRequestHeaders.Accept.Clear();
|
|
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
|
var mymodel = new mymodel
|
|
{
|
|
gepgCtrlno = new gepgCtrlno()
|
|
{
|
|
BillId = getPDetails.InvoiceID.ToString(),
|
|
BillAmt = getPDetails.Amount.ToString(),
|
|
BillEqvAmt = Session["EqAmount"].ToString(),
|
|
BillExprDt = DateTime.Now.AddDays(30).ToString("yyyy-MM-ddTHH:mm:ss"),
|
|
PyrId = getPDetails.CompanyName.ToString(),
|
|
PyrName = getPDetails.CompanyName.ToString(),
|
|
BillGenDt = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss"),
|
|
PyrCellNum = getPDetails.MobileNo.ToString(),
|
|
Ccy = getPDetails.Currency.ToString(),
|
|
BillDesc = getPDetails.ServiceName.ToString(),
|
|
BillItems = new BillItems
|
|
{
|
|
BillItem = new List<BillItem>
|
|
{
|
|
new BillItem { BillItemRef = getPDetails.InvoiceID.ToString() , BillItemAmt=getPDetails.Amount.ToString(), BillItemEqvAmt=Session["EqAmount"].ToString(), GfsCode="142201370002"}
|
|
}
|
|
},
|
|
systemInfo = new systemInfo
|
|
{
|
|
SpSysId = "TTIC003",
|
|
SpCode = "SP536",
|
|
SubSpCode = "1002"
|
|
}
|
|
}
|
|
};
|
|
|
|
var stringPayload = await Task.Run(() => JsonConvert.SerializeObject(mymodel));
|
|
var httpContent = new StringContent(stringPayload, Encoding.UTF8, "application/json");
|
|
HttpResponseMessage responseMessage = await client.PostAsync("http://192.168.2.31:8090/tic/generate-controlno", httpContent);
|
|
var responseJson = await responseMessage.Content.ReadAsStringAsync();
|
|
var jObject = JObject.Parse(responseJson);
|
|
return RedirectToAction("GenerateControlNo", "NewCOI");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
var getGepgResponse = myContext.ApplicationManagers.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
TempData["error"] = "Network timeout..please try again";
|
|
return RedirectToAction("GenerateControlNo", "NewCOI");
|
|
}
|
|
|
|
}
|
|
public ActionResult ExpansionProject()
|
|
{
|
|
var obj = new ProjectRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
return View("ExpansionProject", _birthObject);
|
|
}
|
|
|
|
|
|
public ActionResult ProceedNext(string TrackingNo)
|
|
{
|
|
var checkData = myContext.StepsManagements.Where(t => t.ProjectCode == TrackingNo).SingleOrDefault();
|
|
var checkType = myContext.ProjectProfilesExternal.Where(t => t.ProjectCode == TrackingNo).SingleOrDefault();
|
|
Session["CompanyTIN"] = checkData.CompanyTIN;
|
|
Session["CompanyName"] = checkData.CompanyName;
|
|
Session["ProjectCode"] = checkData.ProjectCode;
|
|
Session["ServiceName"] = checkData.ApplicationType;
|
|
|
|
|
|
|
|
if (checkData.StepNo == "1")
|
|
{
|
|
return RedirectToAction("ProjectDetails");
|
|
}
|
|
if (checkData.StepNo == "2")
|
|
{
|
|
|
|
Session["TypeofOwnership"] = checkType.TypeofOwnership;
|
|
return RedirectToAction("FinancingDetailsExternal");
|
|
}
|
|
if (checkData.StepNo == "3")
|
|
{
|
|
Session["ServiceName"] = checkType.ServiceName;
|
|
return RedirectToAction("AttachmentsNew");
|
|
}
|
|
return View("Index");
|
|
}
|
|
public ActionResult RegenerateCNAmendment(string TrackingNo)
|
|
{
|
|
var checkData = myContext.ApplicationManagers.Where(t => t.ProjectCode == TrackingNo).SingleOrDefault();
|
|
if(checkData!=null)
|
|
{
|
|
Session["CompanyTIN"] = checkData.CompanyTIN;
|
|
Session["CompanyName"] = checkData.CompanyName;
|
|
Session["ProjectCode"] = checkData.ProjectCode;
|
|
Session["ServiceName"] = checkData.ServiceName;
|
|
Session["Currency"] = checkData.Currency;
|
|
Session["Amount"] = checkData.Amount;
|
|
if (checkData.Currency == "USD")
|
|
{
|
|
|
|
Session["AmountinWords"] = "ONE THOUSAND AMERICAN DOLLARS";
|
|
|
|
}
|
|
else
|
|
{
|
|
Session["AmountinWords"] = "Two million three hundred thousand Tanzanian Shillings";
|
|
}
|
|
return View("PaymentAmendment");
|
|
}
|
|
|
|
|
|
|
|
return View("IndexAmendment");
|
|
}
|
|
public ActionResult RegenerateCN(string TrackingNo)
|
|
{
|
|
var checkData = myContext.ApplicationManagers.Where(t => t.ProjectCode == TrackingNo).SingleOrDefault();
|
|
|
|
|
|
|
|
if (checkData != null)
|
|
{
|
|
Session["CompanyTIN"] = checkData.CompanyTIN;
|
|
Session["CompanyName"] = checkData.CompanyName;
|
|
Session["ProjectCode"] = checkData.ProjectCode;
|
|
Session["ServiceName"] = checkData.ServiceName;
|
|
Session["Currency"] = checkData.Currency;
|
|
Session["Amount"] = checkData.Amount;
|
|
if (checkData.Currency == "USD")
|
|
{
|
|
|
|
|
|
Session["AmountinWords"] = "ONE THOUSAND ONE HUNDRED AMERICAN DOLLARS";
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
|
|
Session["AmountinWords"] = "Two million, five hundred thirty thousand Tanzanian Shillings";
|
|
|
|
}
|
|
return View("Payment");
|
|
}
|
|
|
|
|
|
|
|
return View("Index");
|
|
}
|
|
public ActionResult ProceedNextExpansion(string TrackingNo)
|
|
{
|
|
var checkData = myContext.StepsManagements.Where(t => t.ProjectCode == TrackingNo).SingleOrDefault();
|
|
var checkType = myContext.ProjectProfilesExternal.Where(t => t.ProjectCode == TrackingNo).SingleOrDefault();
|
|
Session["CompanyTIN"] = checkData.CompanyTIN;
|
|
Session["CompanyName"] = checkData.CompanyName;
|
|
Session["ProjectCode"] = checkData.ProjectCode;
|
|
Session["ServiceName"] = checkData.ApplicationType;
|
|
|
|
|
|
|
|
if (checkData.StepNo == "1")
|
|
{
|
|
return RedirectToAction("LoadgeNewExpansion");
|
|
}
|
|
if (checkData.StepNo == "2")
|
|
{
|
|
|
|
Session["TypeofOwnership"] = checkType.TypeofOwnership;
|
|
return RedirectToAction("FinancingDetailsExpansion");
|
|
}
|
|
if (checkData.StepNo == "3")
|
|
{
|
|
Session["ServiceName"] = checkType.ServiceName;
|
|
return RedirectToAction("AttachmentsExpansion");
|
|
}
|
|
return View("Index");
|
|
}
|
|
public ActionResult ProceedNextAmendment(string TrackingNo)
|
|
{
|
|
var checkData = myContext.StepsManagements.Where(t => t.ProjectCode == TrackingNo).SingleOrDefault();
|
|
Session["CompanyTIN"] = checkData.CompanyTIN;
|
|
Session["CompanyName"] = checkData.CompanyName;
|
|
Session["ProjectCode"] = checkData.ProjectCode;
|
|
Session["ServiceName"] = checkData.ApplicationType;
|
|
|
|
if (checkData.StepNo == "1")
|
|
{
|
|
return RedirectToAction("AmendmentApplication");
|
|
}
|
|
|
|
if (checkData.StepNo == "2")
|
|
{
|
|
return RedirectToAction("AttachmentsAmendments");
|
|
}
|
|
return View("Index");
|
|
}
|
|
public ActionResult ProceedNextExtention(string TrackingNo)
|
|
{
|
|
var checkData = myContext.StepsManagements.Where(t => t.ProjectCode == TrackingNo).SingleOrDefault();
|
|
Session["CompanyTIN"] = checkData.CompanyTIN;
|
|
Session["CompanyName"] = checkData.CompanyName;
|
|
Session["ProjectCode"] = checkData.ProjectCode;
|
|
Session["ServiceName"] = checkData.ApplicationType;
|
|
if (checkData.StepNo == "1")
|
|
{
|
|
return RedirectToAction("Extension");
|
|
}
|
|
|
|
if (checkData.StepNo == "2")
|
|
{
|
|
return RedirectToAction("AttachmentsExtension");
|
|
}
|
|
return View("Index");
|
|
}
|
|
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public ActionResult PostProjectProfile(ProjectProfileExternal model)
|
|
{
|
|
try
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"];
|
|
var checkIfPExists = myContext.ProjectProfilesExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode.ToString());
|
|
ProjectProfileExternal addnewPProfile = new ProjectProfileExternal();
|
|
var checkIfExists = myContext.CompanyProfileExternal.SingleOrDefault(t => t.CompanyTIN == model.CompanyTIN || t.AddedBy == Username);
|
|
Session["CompanyTIN"] = checkIfExists.CompanyTIN;
|
|
Session["CompanyName"] = checkIfExists.CompanyName;
|
|
Session["ServiceName"] = "New";
|
|
if (ModelState.IsValid)
|
|
{
|
|
if (checkIfPExists == null)
|
|
|
|
addnewPProfile.ProjectName = Sanitizer.GetSafeHtmlFragment(model.ProjectName);
|
|
addnewPProfile.TypeofOwnership = Sanitizer.GetSafeHtmlFragment(model.TypeofOwnership);
|
|
addnewPProfile.UnitMeasure = Sanitizer.GetSafeHtmlFragment(model.UnitMeasure);
|
|
addnewPProfile.MainActivity = Sanitizer.GetSafeHtmlFragment(model.MainActivity);
|
|
addnewPProfile.Region = Sanitizer.GetSafeHtmlFragment(model.Region);
|
|
addnewPProfile.District = Sanitizer.GetSafeHtmlFragment(model.District);
|
|
addnewPProfile.ServiceName = Session["ServiceName"].ToString();
|
|
addnewPProfile.Email = Sanitizer.GetSafeHtmlFragment(model.ContactEmail);
|
|
addnewPProfile.Mobile = Sanitizer.GetSafeHtmlFragment(model.Mobile);
|
|
addnewPProfile.ProductionCapacity = Sanitizer.GetSafeHtmlFragment(model.ProductionCapacity);
|
|
addnewPProfile.Ward = Sanitizer.GetSafeHtmlFragment(model.Ward);
|
|
addnewPProfile.Sector = model.Sector;
|
|
addnewPProfile.SubSector = model.SubSector;
|
|
addnewPProfile.MenForeign = model.MenForeign;
|
|
addnewPProfile.WomenForeign = model.WomenForeign;
|
|
addnewPProfile.MenLocal = model.MenLocal;
|
|
addnewPProfile.PostalAddress = Sanitizer.GetSafeHtmlFragment(model.PostalAddress);
|
|
addnewPProfile.ContactMobile = Sanitizer.GetSafeHtmlFragment(model.ContactMobile);
|
|
addnewPProfile.WomenLocal = model.WomenLocal;
|
|
addnewPProfile.Street = Sanitizer.GetSafeHtmlFragment(model.Street);
|
|
addnewPProfile.AreaType = Sanitizer.GetSafeHtmlFragment(model.AreaType);
|
|
addnewPProfile.Area = Sanitizer.GetSafeHtmlFragment(model.Area);
|
|
addnewPProfile.LandMarkType = Sanitizer.GetSafeHtmlFragment(model.LandMarkType);
|
|
addnewPProfile.LandMarkDescription = Sanitizer.GetSafeHtmlFragment(model.LandMarkDescription);
|
|
addnewPProfile.PlotNumber = Sanitizer.GetSafeHtmlFragment(model.PlotNumber);
|
|
addnewPProfile.LastUpdateDate = DateTime.Now;
|
|
addnewPProfile.UpdatedBy = Session["CompanyEmail"].ToString();
|
|
addnewPProfile.Telephone = model.ContactMobile;
|
|
addnewPProfile.CompanyTIN = Session["CompanyTIN"].ToString();
|
|
addnewPProfile.CompanyName = Session["CompanyName"].ToString();
|
|
addnewPProfile.BlockPlotNumber = Sanitizer.GetSafeHtmlFragment(model.BlockPlotNumber);
|
|
addnewPProfile.HouseNo = Sanitizer.GetSafeHtmlFragment(model.HouseNo);
|
|
addnewPProfile.StepName = "2";
|
|
addnewPProfile.AddedBy = Session["CompanyEmail"].ToString();
|
|
addnewPProfile.CreatedDate = DateTime.Now;
|
|
addnewPProfile.ContactPerson = Sanitizer.GetSafeHtmlFragment(model.ContactPerson);
|
|
addnewPProfile.ContactEmail = Sanitizer.GetSafeHtmlFragment(model.ContactEmail);
|
|
addnewPProfile.ProjectCode = Session["ProjectCode"].ToString();
|
|
addnewPProfile.Title = Sanitizer.GetSafeHtmlFragment(model.Title);
|
|
Session["TypeofOwnership"] = Sanitizer.GetSafeHtmlFragment(model.TypeofOwnership);
|
|
TempData["success"] = "Project Information Successfully Saved";
|
|
myContext.ProjectProfilesExternal.Add(addnewPProfile);
|
|
var checkSteps = myContext.StepsManagements.Where(t => t.ProjectCode == ProjectCode.ToString()).SingleOrDefault();
|
|
checkSteps.StepNo = "2";
|
|
checkSteps.ApplicationType = "New";
|
|
checkSteps.SubmittedStatus = "Not Submitted";
|
|
checkSteps.UpdatedDate = DateTime.Now;
|
|
if (checkIfPExists == null)
|
|
{
|
|
myContext.SaveChanges();
|
|
return RedirectToAction("FinancingDetailsExternal");
|
|
}
|
|
else
|
|
{
|
|
checkIfPExists.ProjectName = Sanitizer.GetSafeHtmlFragment(model.ProjectName);
|
|
checkIfPExists.TypeofOwnership = Sanitizer.GetSafeHtmlFragment(model.TypeofOwnership);
|
|
checkIfPExists.UnitMeasure = Sanitizer.GetSafeHtmlFragment(model.UnitMeasure);
|
|
checkIfPExists.MainActivity = Sanitizer.GetSafeHtmlFragment(model.MainActivity);
|
|
checkIfPExists.Region = Sanitizer.GetSafeHtmlFragment(model.Region);
|
|
checkIfPExists.District = Sanitizer.GetSafeHtmlFragment(model.District);
|
|
checkIfPExists.ServiceName = Session["ServiceName"].ToString();
|
|
checkIfPExists.Email = Sanitizer.GetSafeHtmlFragment(model.ContactEmail);
|
|
checkIfPExists.Mobile = Sanitizer.GetSafeHtmlFragment(model.Mobile);
|
|
checkIfPExists.ProductionCapacity = Sanitizer.GetSafeHtmlFragment(model.ProductionCapacity);
|
|
checkIfPExists.Ward = Sanitizer.GetSafeHtmlFragment(model.Ward);
|
|
checkIfPExists.Sector = model.Sector;
|
|
checkIfPExists.SubSector = model.SubSector;
|
|
checkIfPExists.MenForeign = model.MenForeign;
|
|
checkIfPExists.WomenForeign = model.WomenForeign;
|
|
checkIfPExists.MenLocal = model.MenLocal;
|
|
checkIfPExists.PostalAddress = Sanitizer.GetSafeHtmlFragment(model.PostalAddress);
|
|
checkIfPExists.ContactMobile = Sanitizer.GetSafeHtmlFragment(model.ContactMobile);
|
|
checkIfPExists.WomenLocal = model.WomenLocal;
|
|
checkIfPExists.Street = Sanitizer.GetSafeHtmlFragment(model.Street);
|
|
checkIfPExists.AreaType = Sanitizer.GetSafeHtmlFragment(model.AreaType);
|
|
checkIfPExists.Area = Sanitizer.GetSafeHtmlFragment(model.Area);
|
|
checkIfPExists.LandMarkType = Sanitizer.GetSafeHtmlFragment(model.LandMarkType);
|
|
checkIfPExists.LandMarkDescription = Sanitizer.GetSafeHtmlFragment(model.LandMarkDescription);
|
|
checkIfPExists.PlotNumber = Sanitizer.GetSafeHtmlFragment(model.PlotNumber);
|
|
checkIfPExists.LastUpdateDate = DateTime.Now;
|
|
checkIfPExists.UpdatedBy = Session["CompanyEmail"].ToString();
|
|
checkIfPExists.Telephone = model.ContactMobile;
|
|
checkIfPExists.CompanyTIN = Session["CompanyTIN"].ToString();
|
|
checkIfPExists.CompanyName = Session["CompanyName"].ToString();
|
|
checkIfPExists.BlockPlotNumber = Sanitizer.GetSafeHtmlFragment(model.BlockPlotNumber);
|
|
checkIfPExists.HouseNo = Sanitizer.GetSafeHtmlFragment(model.HouseNo);
|
|
checkIfPExists.StepName = "2";
|
|
checkIfPExists.AddedBy = Session["CompanyEmail"].ToString();
|
|
checkIfPExists.CreatedDate = DateTime.Now;
|
|
checkIfPExists.ContactPerson = Sanitizer.GetSafeHtmlFragment(model.ContactPerson);
|
|
checkIfPExists.ContactEmail = Sanitizer.GetSafeHtmlFragment(model.ContactEmail);
|
|
checkIfPExists.ProjectCode = Session["ProjectCode"].ToString();
|
|
checkIfPExists.Title = Sanitizer.GetSafeHtmlFragment(model.Title);
|
|
myContext.SaveChanges();
|
|
return RedirectToAction("FinancingDetailsExternal");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Error !..Failed to add details";
|
|
var obj = new ProjectRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
return View("ProjectDetails", _birthObject);
|
|
}
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
TempData["error"] = "Error !..Failed to add details";
|
|
var obj = new ProjectRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
return View("ProjectDetails", _birthObject);
|
|
}
|
|
}
|
|
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public ActionResult PostProjectProfileChange(ProjectProfileExternal model)
|
|
{
|
|
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
ProjectProfileExternal addnewPProfile = new ProjectProfileExternal();
|
|
var checkIfExists = myContext.CompanyProfileExternal.SingleOrDefault(t => t.CompanyTIN == model.CompanyTIN || t.AddedBy == Username);
|
|
var checkProjectDetails = myContext.ProjectProfilesExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
Session["CompanyTIN"] = checkIfExists.CompanyTIN;
|
|
Session["CompanyName"] = checkIfExists.CompanyName;
|
|
Session["ServiceName"] = "New";
|
|
checkProjectDetails.ProjectName = model.ProjectName;
|
|
checkProjectDetails.TypeofOwnership = model.TypeofOwnership;
|
|
checkProjectDetails.UnitMeasure = model.UnitMeasure;
|
|
checkProjectDetails.MainActivity = model.MainActivity;
|
|
checkProjectDetails.Region = model.Region;
|
|
checkProjectDetails.District = model.District;
|
|
checkProjectDetails.ServiceName = Session["ServiceName"].ToString();
|
|
checkProjectDetails.Email = model.ContactEmail;
|
|
checkProjectDetails.Mobile = model.Mobile;
|
|
checkProjectDetails.ProductionCapacity = model.ProductionCapacity;
|
|
checkProjectDetails.Ward = model.Ward;
|
|
checkProjectDetails.Sector = model.Sector;
|
|
checkProjectDetails.SubSector = model.SubSector;
|
|
checkProjectDetails.MenForeign = model.MenForeign;
|
|
checkProjectDetails.WomenForeign = model.WomenForeign;
|
|
checkProjectDetails.MenLocal = model.MenLocal;
|
|
checkProjectDetails.PostalAddress = model.PostalAddress;
|
|
checkProjectDetails.ContactMobile = model.ContactMobile;
|
|
checkProjectDetails.WomenLocal = model.WomenLocal;
|
|
checkProjectDetails.Street = model.Street;
|
|
checkProjectDetails.AreaType = model.AreaType;
|
|
checkProjectDetails.Area = model.Area;
|
|
checkProjectDetails.LandMarkType = model.LandMarkType;
|
|
checkProjectDetails.LandMarkDescription = model.LandMarkDescription;
|
|
checkProjectDetails.PlotNumber = model.PlotNumber;
|
|
checkProjectDetails.LastUpdateDate = DateTime.Now;
|
|
checkProjectDetails.UpdatedBy = Session["CompanyEmail"].ToString();
|
|
checkProjectDetails.Telephone = model.ContactMobile;
|
|
checkProjectDetails.CompanyTIN = Session["CompanyTIN"].ToString();
|
|
checkProjectDetails.CompanyName = Session["CompanyName"].ToString();
|
|
checkProjectDetails.BlockPlotNumber = model.BlockPlotNumber;
|
|
checkProjectDetails.HouseNo = model.HouseNo;
|
|
checkProjectDetails.StepName = "2";
|
|
|
|
checkProjectDetails.AddedBy = Session["CompanyEmail"].ToString();
|
|
checkProjectDetails.CreatedDate = DateTime.Now;
|
|
checkProjectDetails.ContactPerson = model.ContactPerson;
|
|
checkProjectDetails.ContactEmail = model.ContactEmail;
|
|
checkProjectDetails.ProjectCode = Session["ProjectCode"].ToString();
|
|
checkProjectDetails.Title = model.Title;
|
|
Session["TypeofOwnership"] = model.TypeofOwnership;
|
|
TempData["success"] = "Project Information Successfully Saved";
|
|
|
|
myContext.SaveChanges();
|
|
return RedirectToAction("RedirectFinancing");
|
|
|
|
}
|
|
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public ActionResult PostAmendmentApplication(CompanyAmmendmentExternal model)
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
CompanyAmmendmentExternal addnewAmendment = new CompanyAmmendmentExternal();
|
|
var checkIfExists = myContext.CompanyProfileExternal.SingleOrDefault(t => t.CompanyTIN == model.CompanyTIN || t.AddedBy == Username);
|
|
Session["CompanyTIN"] = checkIfExists.CompanyTIN;
|
|
Session["CompanyName"] = checkIfExists.CompanyName;
|
|
Session["ServiceName"] = "Amendment";
|
|
addnewAmendment.ChangeofCompanyName = model.ChangeofCompanyName;
|
|
addnewAmendment.ChangeOfLocation = model.ChangeOfLocation;
|
|
addnewAmendment.ChangeofImplementationPeriod = model.ChangeofImplementationPeriod;
|
|
addnewAmendment.LostCertificate = model.LostCertificate;
|
|
addnewAmendment.ReIssueCertificate = model.ReIssueCertificate;
|
|
addnewAmendment.CompanyName = checkIfExists.CompanyName;
|
|
addnewAmendment.ProjectName = model.ProjectName;
|
|
addnewAmendment.CompanyTIN = checkIfExists.CompanyTIN;
|
|
addnewAmendment.ChangeofShareholders = model.ChangeofShareholders;
|
|
addnewAmendment.ChangeOfAddress = model.ChangeOfAddress;
|
|
addnewAmendment.CertificateNo = model.CertificateNo;
|
|
|
|
addnewAmendment.IssuedDate = model.IssuedDate;
|
|
addnewAmendment.ProjectCode = Session["ProjectCode"].ToString();
|
|
addnewAmendment.LoadgeBy = Session["ProjectCode"].ToString();
|
|
addnewAmendment.CreatedDate = DateTime.Now;
|
|
addnewAmendment.LoadgeBy = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"];
|
|
var checkSteps = myContext.StepsManagements.Where(t => t.ProjectCode == ProjectCode.ToString()).SingleOrDefault();
|
|
checkSteps.StepNo = "2";
|
|
checkSteps.SubmittedStatus = "Not Submitted";
|
|
checkSteps.UpdatedDate = DateTime.Now;
|
|
TempData["success"] = "Project Information Successfully Saved";
|
|
var checkIfAExists = myContext.CompanyAmmendmentsExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode.ToString());
|
|
if (checkIfAExists == null)
|
|
{
|
|
myContext.CompanyAmmendmentsExternal.Add(addnewAmendment);
|
|
myContext.SaveChanges();
|
|
return RedirectToAction("AttachmentsAmendments");
|
|
}
|
|
else
|
|
{
|
|
checkIfAExists.ChangeofCompanyName = model.ChangeofCompanyName;
|
|
checkIfAExists.ChangeOfLocation = model.ChangeOfLocation;
|
|
checkIfAExists.ChangeofImplementationPeriod = model.ChangeofImplementationPeriod;
|
|
checkIfAExists.LostCertificate = model.LostCertificate;
|
|
checkIfAExists.ReIssueCertificate = model.ReIssueCertificate;
|
|
checkIfAExists.CompanyName = checkIfExists.CompanyName;
|
|
checkIfAExists.ProjectName = model.ProjectName;
|
|
checkIfAExists.CompanyTIN = checkIfExists.CompanyTIN;
|
|
checkIfAExists.ChangeofShareholders = model.ChangeofShareholders;
|
|
checkIfAExists.ChangeOfAddress = model.ChangeOfAddress;
|
|
checkIfAExists.CertificateNo = model.CertificateNo;
|
|
|
|
checkIfAExists.IssuedDate = model.IssuedDate;
|
|
checkIfAExists.ProjectCode = Session["ProjectCode"].ToString();
|
|
checkIfAExists.LoadgeBy = Session["ProjectCode"].ToString();
|
|
checkIfAExists.CreatedDate = DateTime.Now;
|
|
checkIfAExists.LoadgeBy = Session["CompanyEmail"].ToString();
|
|
myContext.SaveChanges();
|
|
return RedirectToAction("AttachmentsAmendments");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public ActionResult PostExtension(CompanyAmmendmentExternal model)
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
CompanyAmmendmentExternal addnewAmendment = new CompanyAmmendmentExternal();
|
|
var checkIfExists = myContext.CompanyProfileExternal.SingleOrDefault(t => t.CompanyTIN == model.CompanyTIN || t.AddedBy == Username);
|
|
Session["CompanyTIN"] = checkIfExists.CompanyTIN;
|
|
Session["CompanyName"] = checkIfExists.CompanyName;
|
|
Session["ServiceName"] = "Extension";
|
|
addnewAmendment.ChangeofCompanyName = model.ChangeofCompanyName;
|
|
addnewAmendment.ChangeOfLocation = model.ChangeOfLocation;
|
|
addnewAmendment.ChangeofImplementationPeriod = model.ChangeofImplementationPeriod;
|
|
addnewAmendment.LostCertificate = model.LostCertificate;
|
|
addnewAmendment.ReIssueCertificate = model.ReIssueCertificate;
|
|
addnewAmendment.CompanyName = checkIfExists.CompanyName;
|
|
addnewAmendment.ProjectName = model.ProjectName;
|
|
addnewAmendment.CompanyTIN = checkIfExists.CompanyTIN;
|
|
addnewAmendment.ChangeofShareholders = model.ChangeofShareholders;
|
|
addnewAmendment.ChangeOfAddress = model.ChangeOfAddress;
|
|
addnewAmendment.CertificateNo = model.CertificateNo;
|
|
addnewAmendment.Reason = model.Reason;
|
|
|
|
addnewAmendment.IssuedDate = model.IssuedDate;
|
|
addnewAmendment.ProjectCode = Session["ProjectCode"].ToString();
|
|
addnewAmendment.LoadgeBy = Session["ProjectCode"].ToString();
|
|
addnewAmendment.CreatedDate = DateTime.Now;
|
|
addnewAmendment.LoadgeBy = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"];
|
|
var checkSteps = myContext.StepsManagements.Where(t => t.ProjectCode == ProjectCode.ToString()).SingleOrDefault();
|
|
checkSteps.StepNo = "2";
|
|
checkSteps.SubmittedStatus = "Not Submitted";
|
|
checkSteps.UpdatedDate = DateTime.Now;
|
|
TempData["success"] = "Project Information Successfully Saved";
|
|
var checkIfAExists = myContext.CompanyAmmendmentsExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode.ToString());
|
|
if (checkIfAExists == null)
|
|
{
|
|
myContext.CompanyAmmendmentsExternal.Add(addnewAmendment);
|
|
myContext.SaveChanges();
|
|
return RedirectToAction("AttachmentsExtension");
|
|
}
|
|
else
|
|
{
|
|
checkIfAExists.ChangeofCompanyName = model.ChangeofCompanyName;
|
|
checkIfAExists.ChangeOfLocation = model.ChangeOfLocation;
|
|
checkIfAExists.ChangeofImplementationPeriod = model.ChangeofImplementationPeriod;
|
|
checkIfAExists.LostCertificate = model.LostCertificate;
|
|
checkIfAExists.ReIssueCertificate = model.ReIssueCertificate;
|
|
checkIfAExists.CompanyName = checkIfExists.CompanyName;
|
|
checkIfAExists.ProjectName = model.ProjectName;
|
|
checkIfAExists.CompanyTIN = checkIfExists.CompanyTIN;
|
|
checkIfAExists.ChangeofShareholders = model.ChangeofShareholders;
|
|
checkIfAExists.ChangeOfAddress = model.ChangeOfAddress;
|
|
checkIfAExists.CertificateNo = model.CertificateNo;
|
|
checkIfAExists.Reason = model.Reason;
|
|
|
|
checkIfAExists.IssuedDate = model.IssuedDate;
|
|
checkIfAExists.ProjectCode = Session["ProjectCode"].ToString();
|
|
checkIfAExists.LoadgeBy = Session["ProjectCode"].ToString();
|
|
checkIfAExists.CreatedDate = DateTime.Now;
|
|
checkIfAExists.LoadgeBy = Session["CompanyEmail"].ToString();
|
|
myContext.SaveChanges();
|
|
return RedirectToAction("AttachmentsExtension");
|
|
}
|
|
|
|
}
|
|
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public ActionResult PostProjectProfileExpansion(ProjectProfileExternal model)
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
ProjectProfileExternal addnewPProfile = new ProjectProfileExternal();
|
|
var checkIfExists = myContext.CompanyProfileExternal.SingleOrDefault(t => t.CompanyTIN == model.CompanyTIN || t.AddedBy == Username);
|
|
Session["CompanyTIN"] = checkIfExists.CompanyTIN;
|
|
Session["CompanyName"] = checkIfExists.CompanyName;
|
|
Session["ServiceName"] = "Expansion";
|
|
addnewPProfile.ProjectName = model.ProjectName;
|
|
addnewPProfile.TypeofOwnership = model.TypeofOwnership;
|
|
addnewPProfile.UnitMeasure = model.UnitMeasure;
|
|
addnewPProfile.MainActivity = model.MainActivity;
|
|
addnewPProfile.Region = model.Region;
|
|
addnewPProfile.District = model.District;
|
|
addnewPProfile.ServiceName = Session["ServiceName"].ToString();
|
|
addnewPProfile.Email = model.ContactEmail;
|
|
addnewPProfile.Mobile = model.ContactMobile;
|
|
addnewPProfile.TICCertificateNo = model.TICCertificateNo;
|
|
addnewPProfile.IssuedDate = model.IssuedDate;
|
|
addnewPProfile.ProductionCapacity = model.ProductionCapacity;
|
|
addnewPProfile.Ward = model.Ward;
|
|
addnewPProfile.Sector = model.Sector;
|
|
addnewPProfile.SubSector = model.SubSector;
|
|
addnewPProfile.MenForeign = model.MenForeign;
|
|
addnewPProfile.WomenForeign = model.WomenForeign;
|
|
addnewPProfile.MenLocal = model.MenLocal;
|
|
addnewPProfile.PostalAddress = model.PostalAddress;
|
|
addnewPProfile.ContactMobile = model.ContactMobile;
|
|
addnewPProfile.WomenLocal = model.WomenLocal;
|
|
addnewPProfile.Street = model.Street;
|
|
addnewPProfile.AreaType = model.AreaType;
|
|
addnewPProfile.Area = model.Area;
|
|
addnewPProfile.LandMarkType = model.LandMarkType;
|
|
addnewPProfile.LandMarkDescription = model.LandMarkDescription;
|
|
addnewPProfile.PlotNumber = model.PlotNumber;
|
|
addnewPProfile.LastUpdateDate = DateTime.Now;
|
|
addnewPProfile.UpdatedBy = Session["CompanyEmail"].ToString();
|
|
addnewPProfile.Telephone = model.ContactMobile;
|
|
addnewPProfile.CompanyTIN = Session["CompanyTIN"].ToString();
|
|
addnewPProfile.CompanyName = Session["CompanyName"].ToString();
|
|
addnewPProfile.BlockPlotNumber = model.BlockPlotNumber;
|
|
addnewPProfile.HouseNo = model.HouseNo;
|
|
addnewPProfile.StepName = "2";
|
|
addnewPProfile.AddedBy = Session["CompanyEmail"].ToString();
|
|
addnewPProfile.CreatedDate = DateTime.Now;
|
|
addnewPProfile.ContactPerson = model.ContactPerson;
|
|
addnewPProfile.OriginalCOI = model.OriginalCOI;
|
|
addnewPProfile.IssuedDate = model.IssuedDate;
|
|
addnewPProfile.ContactEmail = model.ContactEmail;
|
|
addnewPProfile.ProjectCode = Session["ProjectCode"].ToString();
|
|
addnewPProfile.Title = model.Title;
|
|
Session["TypeofOwnership"] = model.TypeofOwnership;
|
|
TempData["success"] = "Project Information Successfully Saved";
|
|
myContext.ProjectProfilesExternal.Add(addnewPProfile);
|
|
var ProjectCode = Session["ProjectCode"];
|
|
var checkSteps = myContext.StepsManagements.Where(t => t.ProjectCode == ProjectCode.ToString()).SingleOrDefault();
|
|
checkSteps.StepNo = "2";
|
|
checkSteps.SubmittedStatus = "Not Submitted";
|
|
checkSteps.UpdatedDate = DateTime.Now;
|
|
myContext.SaveChanges();
|
|
return RedirectToAction("FinancingDetailsExpansion");
|
|
}
|
|
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public ActionResult PostProjectProfileExpansionChange(ProjectProfileExternal model)
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
ProjectProfileExternal addnewPProfile = new ProjectProfileExternal();
|
|
var checkIfExists = myContext.CompanyProfileExternal.SingleOrDefault(t => t.CompanyTIN == model.CompanyTIN || t.AddedBy == Username);
|
|
var checkIfPExists = myContext.ProjectProfilesExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
Session["CompanyTIN"] = checkIfExists.CompanyTIN;
|
|
Session["CompanyName"] = checkIfExists.CompanyName;
|
|
Session["ServiceName"] = "Expansion";
|
|
|
|
checkIfPExists.ProjectName = model.ProjectName;
|
|
checkIfPExists.TypeofOwnership = model.TypeofOwnership;
|
|
checkIfPExists.UnitMeasure = model.UnitMeasure;
|
|
checkIfPExists.MainActivity = model.MainActivity;
|
|
checkIfPExists.Region = model.Region;
|
|
checkIfPExists.District = model.District;
|
|
checkIfPExists.ServiceName = Session["ServiceName"].ToString();
|
|
checkIfPExists.Email = model.ContactEmail;
|
|
checkIfPExists.Mobile = model.ContactMobile;
|
|
checkIfPExists.TICCertificateNo = model.TICCertificateNo;
|
|
checkIfPExists.IssuedDate = model.IssuedDate;
|
|
checkIfPExists.ProductionCapacity = model.ProductionCapacity;
|
|
checkIfPExists.Ward = model.Ward;
|
|
checkIfPExists.Sector = model.Sector;
|
|
checkIfPExists.SubSector = model.SubSector;
|
|
checkIfPExists.MenForeign = model.MenForeign;
|
|
checkIfPExists.WomenForeign = model.WomenForeign;
|
|
checkIfPExists.MenLocal = model.MenLocal;
|
|
checkIfPExists.PostalAddress = model.PostalAddress;
|
|
checkIfPExists.ContactMobile = model.ContactMobile;
|
|
checkIfPExists.WomenLocal = model.WomenLocal;
|
|
checkIfPExists.Street = model.Street;
|
|
checkIfPExists.AreaType = model.AreaType;
|
|
checkIfPExists.Area = model.Area;
|
|
checkIfPExists.LandMarkType = model.LandMarkType;
|
|
checkIfPExists.LandMarkDescription = model.LandMarkDescription;
|
|
checkIfPExists.PlotNumber = model.PlotNumber;
|
|
checkIfPExists.LastUpdateDate = DateTime.Now;
|
|
checkIfPExists.UpdatedBy = Session["CompanyEmail"].ToString();
|
|
checkIfPExists.Telephone = model.ContactMobile;
|
|
checkIfPExists.CompanyTIN = Session["CompanyTIN"].ToString();
|
|
checkIfPExists.CompanyName = Session["CompanyName"].ToString();
|
|
checkIfPExists.BlockPlotNumber = model.BlockPlotNumber;
|
|
checkIfPExists.HouseNo = model.HouseNo;
|
|
|
|
checkIfPExists.AddedBy = Session["CompanyEmail"].ToString();
|
|
checkIfPExists.CreatedDate = DateTime.Now;
|
|
checkIfPExists.ContactPerson = model.ContactPerson;
|
|
checkIfPExists.OriginalCOI = model.OriginalCOI;
|
|
checkIfPExists.IssuedDate = model.IssuedDate;
|
|
checkIfPExists.ContactEmail = model.ContactEmail;
|
|
checkIfPExists.ProjectCode = Session["ProjectCode"].ToString();
|
|
checkIfPExists.Title = model.Title;
|
|
Session["TypeofOwnership"] = model.TypeofOwnership;
|
|
TempData["success"] = "Project Information Successfully Saved";
|
|
|
|
myContext.SaveChanges();
|
|
return RedirectToAction("RedirectFinancingExpansion");
|
|
}
|
|
|
|
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public ActionResult PostCompanyProfile(CompanyProfileExternal model)
|
|
{
|
|
try
|
|
{
|
|
|
|
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
CompanyProfileExternal addnewCMProfile = new CompanyProfileExternal();
|
|
var checkIfSaved = myContext.CompanyProfileExternal.SingleOrDefault(t => t.CompanyTIN == model.CompanyTIN && t.AddedBy != Username);
|
|
if (checkIfSaved != null)
|
|
{
|
|
TempData["error"] = "Failed to save Company Details, Company already exists created by " + checkIfSaved.AddedBy;
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
return View("LoadgeNewCOI", _birthObject);
|
|
}
|
|
else
|
|
{
|
|
var checkIfExists = myContext.CompanyProfileExternal.SingleOrDefault(t => t.CompanyTIN == model.CompanyTIN && t.AddedBy == Username);
|
|
if (checkIfExists == null)
|
|
{
|
|
addnewCMProfile.CompanyName = Sanitizer.GetSafeHtmlFragment(model.CompanyName);
|
|
addnewCMProfile.CompanyTIN = Sanitizer.GetSafeHtmlFragment(model.CompanyTIN);
|
|
addnewCMProfile.Category = Sanitizer.GetSafeHtmlFragment(model.Category);
|
|
addnewCMProfile.IncorpCertNo = Sanitizer.GetSafeHtmlFragment(model.IncorpCertNo);
|
|
addnewCMProfile.IncorpCertDate = model.IncorpCertDate;
|
|
addnewCMProfile.Region = model.Region;
|
|
addnewCMProfile.District = model.District;
|
|
addnewCMProfile.Ward = model.Ward;
|
|
addnewCMProfile.CompanyEmail = Sanitizer.GetSafeHtmlFragment(model.CompanyEmail);
|
|
addnewCMProfile.CompanyMobile = Sanitizer.GetSafeHtmlFragment(model.CompanyMobile);
|
|
addnewCMProfile.Street = Sanitizer.GetSafeHtmlFragment(model.Street);
|
|
addnewCMProfile.PostalAddress = Sanitizer.GetSafeHtmlFragment(model.PostalAddress);
|
|
addnewCMProfile.AreaType = Sanitizer.GetSafeHtmlFragment(model.AreaType);
|
|
addnewCMProfile.Area = Sanitizer.GetSafeHtmlFragment(model.Area);
|
|
addnewCMProfile.LandMarkType = Sanitizer.GetSafeHtmlFragment(model.LandMarkType);
|
|
addnewCMProfile.LandMarkDescription = Sanitizer.GetSafeHtmlFragment(model.LandMarkDescription);
|
|
addnewCMProfile.PlotNumber = Sanitizer.GetSafeHtmlFragment(model.PlotNumber);
|
|
addnewCMProfile.Telephone = Sanitizer.GetSafeHtmlFragment(model.Telephone);
|
|
addnewCMProfile.BlockPlotNumber = Sanitizer.GetSafeHtmlFragment(model.BlockPlotNumber);
|
|
addnewCMProfile.HouseNo = Sanitizer.GetSafeHtmlFragment(model.HouseNo);
|
|
addnewCMProfile.StepName = "1";
|
|
addnewCMProfile.AddedBy = Session["CompanyEmail"].ToString();
|
|
addnewCMProfile.CreatedDate = DateTime.Now;
|
|
addnewCMProfile.OperatingStatus = "Operating";
|
|
Session["CompanyName"] = Sanitizer.GetSafeHtmlFragment(model.CompanyName);
|
|
Session["CompanyTIN"] = Sanitizer.GetSafeHtmlFragment(model.CompanyTIN);
|
|
Session["ProjectCode"] = GenerateINo();
|
|
var getInvestorProfile = myContext.InvestorExternl.Where(t => t.CompanyEmail == Username).SingleOrDefault();
|
|
getInvestorProfile.CompanyTIN = model.CompanyTIN;
|
|
getInvestorProfile.CompanyName = model.CompanyName;
|
|
TempData["success"] = "Company Information Successfully Saved";
|
|
myContext.CompanyProfileExternal.Add(addnewCMProfile);
|
|
StepsManagement stManager = new StepsManagement();
|
|
stManager.ProjectCode = Session["ProjectCode"].ToString();
|
|
stManager.CompanyName = Session["CompanyName"].ToString();
|
|
stManager.StepNo = "1";
|
|
stManager.CreatedDate = DateTime.Now;
|
|
stManager.CompanyTIN = Session["CompanyTIN"].ToString();
|
|
stManager.CompanyEmail = Username;
|
|
stManager.UpdatedDate = DateTime.Now;
|
|
stManager.EvaluationStatus = "Company Details";
|
|
stManager.SubmittedStatus = "Not Submitted";
|
|
stManager.ApplicationType = "New";
|
|
myContext.StepsManagements.Add(stManager);
|
|
myContext.SaveChanges();
|
|
TempData["success"] = "Project profile page";
|
|
return RedirectToAction("RedirectProject");
|
|
|
|
}
|
|
|
|
else
|
|
{
|
|
TempData["error"] = "Failed to save Company Details, Company already exists created by " + checkIfExists.AddedBy;
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
return View("LoadgeNewCOI", _birthObject);
|
|
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
TempData["error"] = "Error!....failed to register company";
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
return View("LoadgeNewCOI", _birthObject);
|
|
}
|
|
|
|
|
|
}
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public ActionResult PostCompanyProfileUpdate(CompanyProfileExternal model)
|
|
{
|
|
try
|
|
{
|
|
|
|
//if (ModelState.IsValid)
|
|
//{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
CompanyProfileExternal addnewCMProfile = new CompanyProfileExternal();
|
|
var checkIfExists = myContext.CompanyProfileExternal.SingleOrDefault(t => t.CompanyTIN == model.CompanyTIN && t.AddedBy==Username);
|
|
if (checkIfExists != null)
|
|
{
|
|
|
|
checkIfExists.CompanyName = Sanitizer.GetSafeHtmlFragment(model.CompanyName);
|
|
checkIfExists.CompanyTIN = Sanitizer.GetSafeHtmlFragment(model.CompanyTIN);
|
|
checkIfExists.Category = Sanitizer.GetSafeHtmlFragment(model.Category);
|
|
checkIfExists.IncorpCertNo = Sanitizer.GetSafeHtmlFragment(model.IncorpCertNo);
|
|
checkIfExists.IncorpCertDate = model.IncorpCertDate;
|
|
checkIfExists.Region = model.Region;
|
|
checkIfExists.District = model.District;
|
|
checkIfExists.Ward = model.Ward;
|
|
checkIfExists.CompanyEmail = Sanitizer.GetSafeHtmlFragment(model.CompanyEmail);
|
|
checkIfExists.CompanyMobile = Sanitizer.GetSafeHtmlFragment(model.CompanyMobile);
|
|
checkIfExists.Street = Sanitizer.GetSafeHtmlFragment(model.Street);
|
|
checkIfExists.PostalAddress = Sanitizer.GetSafeHtmlFragment(model.PostalAddress);
|
|
checkIfExists.AreaType = Sanitizer.GetSafeHtmlFragment(model.AreaType);
|
|
checkIfExists.Area = Sanitizer.GetSafeHtmlFragment(model.Area);
|
|
checkIfExists.LandMarkType = Sanitizer.GetSafeHtmlFragment(model.LandMarkType);
|
|
checkIfExists.LandMarkDescription = Sanitizer.GetSafeHtmlFragment(model.LandMarkDescription);
|
|
checkIfExists.PlotNumber = Sanitizer.GetSafeHtmlFragment(model.PlotNumber);
|
|
checkIfExists.Telephone = Sanitizer.GetSafeHtmlFragment(model.Telephone);
|
|
checkIfExists.BlockPlotNumber = Sanitizer.GetSafeHtmlFragment(model.BlockPlotNumber);
|
|
checkIfExists.HouseNo = Sanitizer.GetSafeHtmlFragment(model.HouseNo);
|
|
addnewCMProfile.AddedBy = Session["CompanyEmail"].ToString();
|
|
addnewCMProfile.CreatedDate = DateTime.Now;
|
|
myContext.SaveChanges();
|
|
TempData["success"] = "Project profile page";
|
|
return RedirectToAction("RedirectProject");
|
|
|
|
}
|
|
|
|
else
|
|
{
|
|
TempData["error"] = "Failed to update Company Profiles";
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
return View("LoadgeNewCOI", _birthObject);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
TempData["error"] = "Error!....failed to register company";
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
return View("LoadgeNewCOI", _birthObject);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public ActionResult PostCompanyProfileExpansion(CompanyProfileExternal model)
|
|
{
|
|
if (ModelState.IsValid)
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
CompanyProfileExternal addnewCMProfile = new CompanyProfileExternal();
|
|
var checkIfExists = myContext.CompanyProfileExternal.SingleOrDefault(t => t.CompanyTIN == model.CompanyTIN || t.AddedBy == Username);
|
|
if (checkIfExists == null)
|
|
{
|
|
|
|
addnewCMProfile.CompanyName = Sanitizer.GetSafeHtmlFragment(model.CompanyName);
|
|
addnewCMProfile.CompanyTIN = Sanitizer.GetSafeHtmlFragment(model.CompanyTIN);
|
|
addnewCMProfile.Category = Sanitizer.GetSafeHtmlFragment(model.Category);
|
|
addnewCMProfile.IncorpCertNo = Sanitizer.GetSafeHtmlFragment(model.IncorpCertNo);
|
|
addnewCMProfile.IncorpCertDate = model.IncorpCertDate;
|
|
addnewCMProfile.Region = model.Region;
|
|
addnewCMProfile.District = model.District;
|
|
addnewCMProfile.Ward = model.Ward;
|
|
addnewCMProfile.CompanyEmail = Sanitizer.GetSafeHtmlFragment(model.CompanyEmail);
|
|
addnewCMProfile.CompanyMobile = Sanitizer.GetSafeHtmlFragment(model.CompanyMobile);
|
|
addnewCMProfile.Street = Sanitizer.GetSafeHtmlFragment(model.Street);
|
|
addnewCMProfile.PostalAddress = Sanitizer.GetSafeHtmlFragment(model.PostalAddress);
|
|
addnewCMProfile.AreaType = Sanitizer.GetSafeHtmlFragment( model.AreaType);
|
|
addnewCMProfile.Area = Sanitizer.GetSafeHtmlFragment(model.Area);
|
|
addnewCMProfile.LandMarkType = Sanitizer.GetSafeHtmlFragment(model.LandMarkType);
|
|
addnewCMProfile.LandMarkDescription = Sanitizer.GetSafeHtmlFragment(model.LandMarkDescription);
|
|
addnewCMProfile.PlotNumber = Sanitizer.GetSafeHtmlFragment(model.PlotNumber);
|
|
addnewCMProfile.Telephone = Sanitizer.GetSafeHtmlFragment(model.Telephone);
|
|
addnewCMProfile.BlockPlotNumber = Sanitizer.GetSafeHtmlFragment(model.BlockPlotNumber);
|
|
addnewCMProfile.HouseNo = Sanitizer.GetSafeHtmlFragment(model.HouseNo);
|
|
addnewCMProfile.StepName = "1";
|
|
addnewCMProfile.AddedBy = Session["CompanyEmail"].ToString();
|
|
addnewCMProfile.CreatedDate = DateTime.Now;
|
|
addnewCMProfile.OperatingStatus = "Operating";
|
|
Session["CompanyName"] = Sanitizer.GetSafeHtmlFragment(model.CompanyName);
|
|
Session["CompanyTIN"] = Sanitizer.GetSafeHtmlFragment(model.CompanyTIN);
|
|
Session["ProjectCode"] = GenerateINo();
|
|
var getInvestorProfile = myContext.InvestorExternl.Where(t => t.CompanyEmail == Username).SingleOrDefault();
|
|
getInvestorProfile.CompanyTIN = model.CompanyTIN;
|
|
getInvestorProfile.CompanyName = model.CompanyName;
|
|
TempData["success"] = "Company Information Successfully Saved";
|
|
myContext.CompanyProfileExternal.Add(addnewCMProfile);
|
|
StepsManagement stManager = new StepsManagement();
|
|
stManager.ProjectCode = Session["ProjectCode"].ToString();
|
|
stManager.CompanyName = Session["CompanyName"].ToString();
|
|
stManager.StepNo = "1";
|
|
stManager.CreatedDate = DateTime.Now;
|
|
stManager.CompanyTIN = Session["CompanyTIN"].ToString();
|
|
stManager.CompanyEmail = Username;
|
|
stManager.UpdatedDate = DateTime.Now;
|
|
stManager.EvaluationStatus = "Company Details";
|
|
stManager.SubmittedStatus = "Not Submitted";
|
|
myContext.StepsManagements.Add(stManager);
|
|
myContext.SaveChanges();
|
|
return RedirectToAction("ExpansionProject");
|
|
}
|
|
|
|
else
|
|
{
|
|
var CheckIfApproved = myContext.ApplicationManagers.Where(t => t.CompanyTIN == model.CompanyTIN);
|
|
if (CheckIfApproved != null)
|
|
{
|
|
checkIfExists.CompanyName = Sanitizer.GetSafeHtmlFragment(model.CompanyName);
|
|
checkIfExists.CompanyTIN = Sanitizer.GetSafeHtmlFragment(model.CompanyTIN);
|
|
checkIfExists.Category = Sanitizer.GetSafeHtmlFragment(model.Category);
|
|
checkIfExists.IncorpCertNo = Sanitizer.GetSafeHtmlFragment(model.IncorpCertNo);
|
|
checkIfExists.IncorpCertDate = model.IncorpCertDate;
|
|
checkIfExists.Region = model.Region;
|
|
checkIfExists.District = model.District;
|
|
checkIfExists.Ward = model.Ward;
|
|
checkIfExists.CompanyEmail = Sanitizer.GetSafeHtmlFragment( model.CompanyEmail);
|
|
checkIfExists.CompanyMobile = Sanitizer.GetSafeHtmlFragment(model.CompanyMobile);
|
|
checkIfExists.Street = Sanitizer.GetSafeHtmlFragment(model.Street);
|
|
checkIfExists.PostalAddress = Sanitizer.GetSafeHtmlFragment(model.PostalAddress);
|
|
checkIfExists.AreaType = Sanitizer.GetSafeHtmlFragment(model.AreaType);
|
|
checkIfExists.Area = Sanitizer.GetSafeHtmlFragment(model.Area);
|
|
checkIfExists.LandMarkType = Sanitizer.GetSafeHtmlFragment(model.LandMarkType);
|
|
checkIfExists.LandMarkDescription = Sanitizer.GetSafeHtmlFragment( model.LandMarkDescription);
|
|
checkIfExists.PlotNumber = Sanitizer.GetSafeHtmlFragment( model.PlotNumber);
|
|
checkIfExists.Telephone = Sanitizer.GetSafeHtmlFragment(model.Telephone);
|
|
checkIfExists.BlockPlotNumber = Sanitizer.GetSafeHtmlFragment(model.BlockPlotNumber);
|
|
checkIfExists.HouseNo = model.HouseNo;
|
|
addnewCMProfile.AddedBy = Session["CompanyEmail"].ToString();
|
|
addnewCMProfile.CreatedDate = DateTime.Now;
|
|
myContext.SaveChanges();
|
|
TempData["success"] = "Project profile page";
|
|
return RedirectToAction("RedirectProjectExpansion");
|
|
}
|
|
|
|
TempData["success"] = "Project profile page";
|
|
var obj = new ProjectRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
return View("ExpansionProject", _birthObject);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Please fill proper company details";
|
|
var obj = new CompanyRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
return View("LoadgeNewExpansion", _birthObject);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public ActionResult PostCompanyProfileAmendment(CompanyProfileExternal model)
|
|
{
|
|
|
|
try
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
CompanyProfileExternal addnewCMProfile = new CompanyProfileExternal();
|
|
var checkIfExists = myContext.CompanyProfileExternal.SingleOrDefault(t => t.CompanyTIN == model.CompanyTIN);
|
|
if (checkIfExists == null)
|
|
{
|
|
addnewCMProfile.CompanyName = model.CompanyName;
|
|
addnewCMProfile.CompanyTIN = model.CompanyTIN;
|
|
addnewCMProfile.Category = model.Category;
|
|
addnewCMProfile.IncorpCertNo = model.IncorpCertNo;
|
|
addnewCMProfile.IncorpCertDate = model.IncorpCertDate;
|
|
addnewCMProfile.Region = model.Region;
|
|
addnewCMProfile.District = model.District;
|
|
addnewCMProfile.Ward = model.Ward;
|
|
addnewCMProfile.CompanyEmail = model.CompanyEmail;
|
|
addnewCMProfile.CompanyMobile = model.CompanyMobile;
|
|
addnewCMProfile.Street = model.Street;
|
|
addnewCMProfile.PostalAddress = model.PostalAddress;
|
|
addnewCMProfile.AreaType = model.AreaType;
|
|
addnewCMProfile.Area = model.Area;
|
|
addnewCMProfile.LandMarkType = model.LandMarkType;
|
|
addnewCMProfile.LandMarkDescription = model.LandMarkDescription;
|
|
addnewCMProfile.PlotNumber = model.PlotNumber;
|
|
addnewCMProfile.Telephone = model.Telephone;
|
|
addnewCMProfile.BlockPlotNumber = model.BlockPlotNumber;
|
|
addnewCMProfile.HouseNo = model.HouseNo;
|
|
addnewCMProfile.StepName = "1";
|
|
addnewCMProfile.AddedBy = Session["CompanyEmail"].ToString();
|
|
addnewCMProfile.CreatedDate = DateTime.Now;
|
|
addnewCMProfile.OperatingStatus = "Operating";
|
|
Session["CompanyName"] = model.CompanyName;
|
|
Session["CompanyTIN"] = model.CompanyTIN;
|
|
Session["ProjectCode"] = GenerateINo();
|
|
var getInvestorProfile = myContext.InvestorExternl.Where(t => t.CompanyEmail == Username).SingleOrDefault();
|
|
getInvestorProfile.CompanyTIN = model.CompanyTIN;
|
|
getInvestorProfile.CompanyName = model.CompanyName;
|
|
TempData["success"] = "Company Information Successfully Saved";
|
|
myContext.CompanyProfileExternal.Add(addnewCMProfile);
|
|
StepsManagement stManager = new StepsManagement();
|
|
stManager.ProjectCode = Session["ProjectCode"].ToString();
|
|
stManager.CompanyName = Session["CompanyName"].ToString();
|
|
stManager.StepNo = "1";
|
|
stManager.CreatedDate = DateTime.Now;
|
|
stManager.ApplicationType = "Amendment";
|
|
stManager.CompanyTIN = Session["CompanyTIN"].ToString();
|
|
stManager.CompanyEmail = Username;
|
|
stManager.UpdatedDate = DateTime.Now;
|
|
stManager.EvaluationStatus = "Company Details";
|
|
stManager.SubmittedStatus = "Not Submitted";
|
|
myContext.StepsManagements.Add(stManager);
|
|
myContext.SaveChanges();
|
|
return RedirectToAction("AmendmentApplication");
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Failed to save Company Details, Company already exists created by " + checkIfExists.AddedBy;
|
|
var pobj = new CompanyRepository();
|
|
var _birthObjectp = pobj.CreateLocation();
|
|
return View("LoadgeNewAmendment", _birthObjectp);
|
|
}
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
TempData["error"] = "Error occured while saving details.. Please contact TIC call centre";
|
|
var pobj = new CompanyRepository();
|
|
var _birthObjectp = pobj.CreateLocation();
|
|
return View("LoadgeNewAmendment", _birthObjectp);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public ActionResult PostCompanyProfileExtension(CompanyProfileExternal model)
|
|
{
|
|
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
CompanyProfileExternal addnewCMProfile = new CompanyProfileExternal();
|
|
var checkIfExists = myContext.CompanyProfileExternal.SingleOrDefault(t => t.CompanyTIN == model.CompanyTIN || t.AddedBy == Username);
|
|
if (checkIfExists == null)
|
|
{
|
|
addnewCMProfile.CompanyName = model.CompanyName;
|
|
addnewCMProfile.CompanyTIN = model.CompanyTIN;
|
|
addnewCMProfile.Category = model.Category;
|
|
addnewCMProfile.IncorpCertNo = model.IncorpCertNo;
|
|
addnewCMProfile.IncorpCertDate = model.IncorpCertDate;
|
|
addnewCMProfile.Region = model.Region;
|
|
addnewCMProfile.District = model.District;
|
|
addnewCMProfile.Ward = model.Ward;
|
|
addnewCMProfile.CompanyEmail = model.CompanyEmail;
|
|
addnewCMProfile.CompanyMobile = model.CompanyMobile;
|
|
addnewCMProfile.Street = model.Street;
|
|
addnewCMProfile.PostalAddress = model.PostalAddress;
|
|
addnewCMProfile.AreaType = model.AreaType;
|
|
addnewCMProfile.Area = model.Area;
|
|
addnewCMProfile.LandMarkType = model.LandMarkType;
|
|
addnewCMProfile.LandMarkDescription = model.LandMarkDescription;
|
|
addnewCMProfile.PlotNumber = model.PlotNumber;
|
|
addnewCMProfile.Telephone = model.Telephone;
|
|
addnewCMProfile.BlockPlotNumber = model.BlockPlotNumber;
|
|
addnewCMProfile.HouseNo = model.HouseNo;
|
|
addnewCMProfile.StepName = "1";
|
|
|
|
addnewCMProfile.AddedBy = Session["CompanyEmail"].ToString();
|
|
addnewCMProfile.CreatedDate = DateTime.Now;
|
|
addnewCMProfile.OperatingStatus = "Operating";
|
|
Session["CompanyName"] = model.CompanyName;
|
|
Session["CompanyTIN"] = model.CompanyTIN;
|
|
Session["ProjectCode"] = GenerateINo();
|
|
var getInvestorProfile = myContext.InvestorExternl.Where(t => t.CompanyEmail == Username).SingleOrDefault();
|
|
getInvestorProfile.CompanyTIN = model.CompanyTIN;
|
|
getInvestorProfile.CompanyName = model.CompanyName;
|
|
TempData["success"] = "Company Information Successfully Saved";
|
|
myContext.CompanyProfileExternal.Add(addnewCMProfile);
|
|
StepsManagement stManager = new StepsManagement();
|
|
stManager.ProjectCode = Session["ProjectCode"].ToString();
|
|
stManager.CompanyName = Session["CompanyName"].ToString();
|
|
stManager.StepNo = "1";
|
|
stManager.ApplicationType = "Extension";
|
|
stManager.CreatedDate = DateTime.Now;
|
|
stManager.CompanyTIN = Session["CompanyTIN"].ToString();
|
|
stManager.CompanyEmail = Username;
|
|
stManager.UpdatedDate = DateTime.Now;
|
|
stManager.EvaluationStatus = "Company Details";
|
|
stManager.SubmittedStatus = "Not Submitted";
|
|
myContext.StepsManagements.Add(stManager);
|
|
myContext.SaveChanges();
|
|
return RedirectToAction("Extension");
|
|
}
|
|
else
|
|
{
|
|
TempData["success"] = "Project profile page";
|
|
return RedirectToAction("Extension");
|
|
}
|
|
|
|
|
|
}
|
|
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public ActionResult PostCompanyProfileAmendmentChange(CompanyProfileExternal model)
|
|
{
|
|
if (ModelState.IsValid)
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
CompanyProfileExternal addnewCMProfile = new CompanyProfileExternal();
|
|
var checkIfExists = myContext.CompanyProfileExternal.SingleOrDefault(t => t.CompanyTIN == model.CompanyTIN || t.AddedBy == Username);
|
|
if (checkIfExists != null)
|
|
{
|
|
var CheckIfApproved = myContext.ApplicationManagers.Where(t => t.CompanyTIN == model.CompanyTIN);
|
|
if (CheckIfApproved != null)
|
|
{
|
|
checkIfExists.CompanyName = Sanitizer.GetSafeHtmlFragment(model.CompanyName);
|
|
checkIfExists.CompanyTIN = Sanitizer.GetSafeHtmlFragment(model.CompanyTIN);
|
|
checkIfExists.Category = model.Category;
|
|
checkIfExists.IncorpCertNo = model.IncorpCertNo;
|
|
checkIfExists.IncorpCertDate = model.IncorpCertDate;
|
|
checkIfExists.Region = model.Region;
|
|
checkIfExists.District = model.District;
|
|
checkIfExists.Ward = model.Ward;
|
|
checkIfExists.CompanyEmail = model.CompanyEmail;
|
|
checkIfExists.CompanyMobile = model.CompanyMobile;
|
|
checkIfExists.Street = model.Street;
|
|
checkIfExists.PostalAddress = model.PostalAddress;
|
|
checkIfExists.AreaType = model.AreaType;
|
|
checkIfExists.Area = model.Area;
|
|
checkIfExists.LandMarkType = model.LandMarkType;
|
|
checkIfExists.LandMarkDescription = model.LandMarkDescription;
|
|
checkIfExists.PlotNumber = model.PlotNumber;
|
|
checkIfExists.Telephone = model.Telephone;
|
|
checkIfExists.BlockPlotNumber = model.BlockPlotNumber;
|
|
checkIfExists.HouseNo = model.HouseNo;
|
|
addnewCMProfile.AddedBy = Session["CompanyEmail"].ToString();
|
|
addnewCMProfile.CreatedDate = DateTime.Now;
|
|
myContext.SaveChanges();
|
|
return RedirectToAction("AmendmentApplication");
|
|
}
|
|
else
|
|
{
|
|
TempData["success"] = "Project profile page";
|
|
return View("AmendmentApplication");
|
|
}
|
|
}
|
|
return View("AmendmentApplication");
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Failed to save details";
|
|
return View("AmendmentApplication");
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public ActionResult PostCompanyProfileExtensionChange(CompanyProfileExternal model)
|
|
{
|
|
if (ModelState.IsValid)
|
|
{
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
CompanyProfileExternal addnewCMProfile = new CompanyProfileExternal();
|
|
var checkIfExists = myContext.CompanyProfileExternal.SingleOrDefault(t => t.CompanyTIN == model.CompanyTIN || t.AddedBy == Username);
|
|
if (checkIfExists != null)
|
|
{
|
|
var CheckIfApproved = myContext.ApplicationManagers.Where(t => t.CompanyTIN == model.CompanyTIN);
|
|
if (CheckIfApproved != null)
|
|
{
|
|
checkIfExists.CompanyName = Sanitizer.GetSafeHtmlFragment(model.CompanyName);
|
|
checkIfExists.CompanyTIN = Sanitizer.GetSafeHtmlFragment(model.CompanyTIN);
|
|
checkIfExists.Category = model.Category;
|
|
checkIfExists.IncorpCertNo = model.IncorpCertNo;
|
|
checkIfExists.IncorpCertDate = model.IncorpCertDate;
|
|
checkIfExists.Region = model.Region;
|
|
checkIfExists.District = model.District;
|
|
checkIfExists.Ward = model.Ward;
|
|
checkIfExists.CompanyEmail = model.CompanyEmail;
|
|
checkIfExists.CompanyMobile = model.CompanyMobile;
|
|
checkIfExists.Street = model.Street;
|
|
checkIfExists.PostalAddress = model.PostalAddress;
|
|
checkIfExists.AreaType = model.AreaType;
|
|
checkIfExists.Area = model.Area;
|
|
checkIfExists.LandMarkType = model.LandMarkType;
|
|
checkIfExists.LandMarkDescription = model.LandMarkDescription;
|
|
checkIfExists.PlotNumber = model.PlotNumber;
|
|
checkIfExists.Telephone = model.Telephone;
|
|
checkIfExists.BlockPlotNumber = model.BlockPlotNumber;
|
|
checkIfExists.HouseNo = model.HouseNo;
|
|
addnewCMProfile.AddedBy = Session["CompanyEmail"].ToString();
|
|
addnewCMProfile.CreatedDate = DateTime.Now;
|
|
|
|
myContext.SaveChanges();
|
|
return RedirectToAction("Extension");
|
|
}
|
|
else
|
|
{
|
|
TempData["success"] = "Project profile page";
|
|
return View("Extension");
|
|
}
|
|
}
|
|
|
|
return View("Extension");
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Failed to save details";
|
|
return View("LoadgeNewExtension");
|
|
}
|
|
|
|
|
|
|
|
}
|
|
public ActionResult BrowseApplicantDocumentsNew()
|
|
{
|
|
var CompanyTIN = Session["CompanyTIN"];
|
|
var ProjectCode = Session["ProjectCode"];
|
|
return Redirect("/PrintAppProfileNew.aspx?CompanyTIN=" +CompanyTIN+"&ProjectCode="+ProjectCode);
|
|
|
|
}
|
|
public ActionResult ProcessReceipt(long ID)
|
|
{
|
|
|
|
return Redirect("/PrintReceipt.aspx?InvoiceID="+ID );
|
|
|
|
}
|
|
public ActionResult BrowseApplicantDocumentsExpansion()
|
|
{
|
|
var CompanyTIN = Session["CompanyTIN"];
|
|
var ProjectCode = Session["ProjectCode"];
|
|
return Redirect("/ProjectAppProfileExpansion.aspx?CompanyTIN=" + CompanyTIN + "&ProjectCode=" + ProjectCode);
|
|
|
|
}
|
|
|
|
public ActionResult BrowseApplicantDocumentsAmendment()
|
|
{
|
|
var CompanyTIN = Session["CompanyTIN"];
|
|
var ProjectCode = Session["ProjectCode"];
|
|
return Redirect("/PrintAppProfileAmendment.aspx?CompanyTIN=" + CompanyTIN + "&ProjectCode=" + ProjectCode);
|
|
|
|
}
|
|
|
|
public ActionResult BrowseApplicantDocumentsExtension()
|
|
{
|
|
var CompanyTIN = Session["CompanyTIN"];
|
|
var ProjectCode = Session["ProjectCode"];
|
|
return Redirect("/PrintAppProfileExtension.aspx?CompanyTIN=" + CompanyTIN + "&ProjectCode=" + ProjectCode);
|
|
|
|
}
|
|
|
|
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public ActionResult PostFinancingProfile(FinancingProfileExternal model)
|
|
{
|
|
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var CompanyTIN = Session["CompanyTIN"].ToString();
|
|
FinancingProfileExternal addnewFProfile = new FinancingProfileExternal();
|
|
var checkPExists = myContext.ProjectProfilesExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
if (checkPExists != null)
|
|
{
|
|
addnewFProfile.ProjectCode = ProjectCode;
|
|
addnewFProfile.CompanyTIN = CompanyTIN;
|
|
addnewFProfile.AddedBy = Username;
|
|
addnewFProfile.LocalEquity = model.LocalEquity;
|
|
addnewFProfile.LocalLoan = model.LocalLoan;
|
|
addnewFProfile.ForeignEquity = model.ForeignEquity;
|
|
addnewFProfile.SourceCountryEquity = model.SourceCountryEquity;
|
|
addnewFProfile.ForeignLoan = model.ForeignLoan;
|
|
addnewFProfile.SourceCountryLoan = model.SourceCountryLoan;
|
|
addnewFProfile.WorkingCapital = model.WorkingCapital;
|
|
addnewFProfile.FixedAsset = (model.LocalEquity + model.LocalLoan + model.ForeignEquity + model.ForeignLoan);
|
|
addnewFProfile.TotalDDI = (model.LocalEquity + model.LocalLoan);
|
|
addnewFProfile.TotalForeign = model.ForeignEquity + model.ForeignLoan;
|
|
addnewFProfile.TotalLocal = (model.LocalEquity + model.LocalLoan);
|
|
addnewFProfile.TotalCapital = (model.WorkingCapital + model.LocalEquity + model.LocalLoan + model.ForeignEquity + model.ForeignLoan);
|
|
addnewFProfile.MTotalCapital = (addnewFProfile.TotalCapital * 0.000001);
|
|
addnewFProfile.MLocalEquity = (model.LocalEquity * 0.000001);
|
|
addnewFProfile.MLocalLoan = (model.LocalLoan * 0.000001);
|
|
addnewFProfile.MFixedAsset = (addnewFProfile.FixedAsset * 0.000001);
|
|
addnewFProfile.MTotalDDI = (model.LocalEquity + model.LocalLoan) * (0.000001);
|
|
addnewFProfile.MTotalForeign = (model.ForeignEquity + model.ForeignLoan) * (0.000001);
|
|
addnewFProfile.MTotalLocal = (model.LocalEquity + model.LocalLoan) * (0.000001);
|
|
addnewFProfile.MForeignEquity = model.ForeignEquity * 0.000001;
|
|
addnewFProfile.MForeignLoan = model.ForeignLoan * 0.000001;
|
|
addnewFProfile.TotalFDI = (model.ForeignEquity + model.ForeignLoan);
|
|
addnewFProfile.MInvestmentBreakDown = addnewFProfile.MTotalCapital;
|
|
addnewFProfile.MWorkingCapital = model.WorkingCapital * 0.000001;
|
|
addnewFProfile.MTotalFDI = (model.ForeignEquity + model.ForeignLoan) * (0.000001);
|
|
addnewFProfile.ProjectID = 0;
|
|
addnewFProfile.Jobs = 0;
|
|
addnewFProfile.StepName = "3";
|
|
addnewFProfile.CreatedDate = DateTime.Now;
|
|
var checkSteps = myContext.StepsManagements.Where(t => t.ProjectCode == ProjectCode.ToString()).SingleOrDefault();
|
|
checkSteps.StepNo = "3";
|
|
checkSteps.SubmittedStatus = "Not Submitted";
|
|
checkSteps.UpdatedDate = DateTime.Now;
|
|
if ((Session["TypeofOwnership"].ToString() == "Foreign" || Session["TypeofOwnership"].ToString() == "JV") && addnewFProfile.TotalCapital < 500000)
|
|
{
|
|
TempData["error"] = "Total Capital should not be less than $500,000";
|
|
var obj = new FinancingRepository();
|
|
var _birthObject = obj.CreateCountry();
|
|
return View("FinancingDetailsExternal", _birthObject);
|
|
}
|
|
if (Session["TypeofOwnership"].ToString() == "Local" && addnewFProfile.TotalCapital < 100000)
|
|
{
|
|
TempData["error"] = "Total Capital should not be less than $100,000";
|
|
var obj = new FinancingRepository();
|
|
var _birthObject = obj.CreateCountry();
|
|
return View("FinancingDetailsExternal", _birthObject);
|
|
}
|
|
TempData["success"] = "Financial Information Successfully Updated";
|
|
myContext.FinancingProfilesExternals.Add(addnewFProfile);
|
|
myContext.SaveChanges();
|
|
if (Session["ServiceName"].ToString() == "New")
|
|
{
|
|
return RedirectToAction("AttachmentsNew");
|
|
}
|
|
return RedirectToAction("AttachmentsExpansion");
|
|
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Error! failed to add financing";
|
|
var obj = new FinancingRepository();
|
|
var _birthObject = obj.CreateCountry();
|
|
return View("ShowFinancingProfile", _birthObject);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
[ValidateAntiForgeryToken]
|
|
[HttpPost]
|
|
public ActionResult PostFinancingProfileChange(FinancingProfileExternal model)
|
|
{
|
|
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var CompanyTIN = Session["CompanyTIN"].ToString();
|
|
FinancingProfileExternal addnewFProfile = new FinancingProfileExternal();
|
|
var checkPExists = myContext.ProjectProfilesExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
var checkFExists = myContext.FinancingProfilesExternals.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
if (checkPExists != null)
|
|
{
|
|
|
|
checkFExists.ProjectCode = ProjectCode;
|
|
checkFExists.CompanyTIN = CompanyTIN;
|
|
checkFExists.AddedBy = Username;
|
|
checkFExists.LocalEquity = model.LocalEquity;
|
|
checkFExists.LocalLoan = model.LocalLoan;
|
|
checkFExists.ForeignEquity = model.ForeignEquity;
|
|
checkFExists.SourceCountryEquity = model.SourceCountryEquity;
|
|
checkFExists.ForeignLoan = model.ForeignLoan;
|
|
checkFExists.SourceCountryLoan = model.SourceCountryLoan;
|
|
checkFExists.WorkingCapital = model.WorkingCapital;
|
|
checkFExists.FixedAsset = (model.LocalEquity + model.LocalLoan + model.ForeignEquity + model.ForeignLoan);
|
|
checkFExists.TotalDDI = (model.LocalEquity + model.LocalLoan);
|
|
checkFExists.TotalForeign = model.ForeignEquity + model.ForeignLoan;
|
|
checkFExists.TotalLocal = (model.LocalEquity + model.LocalLoan);
|
|
checkFExists.TotalCapital = (model.WorkingCapital + model.LocalEquity + model.LocalLoan + model.ForeignEquity + model.ForeignLoan);
|
|
checkFExists.MTotalCapital = (addnewFProfile.TotalCapital * 0.000001);
|
|
checkFExists.MLocalEquity = (model.LocalEquity * 0.000001);
|
|
checkFExists.MLocalLoan = (model.LocalLoan * 0.000001);
|
|
checkFExists.MFixedAsset = (addnewFProfile.FixedAsset * 0.000001);
|
|
checkFExists.MTotalDDI = (model.LocalEquity + model.LocalLoan) * (0.000001);
|
|
checkFExists.MTotalForeign = (model.ForeignEquity + model.ForeignLoan) * (0.000001);
|
|
checkFExists.MTotalLocal = (model.LocalEquity + model.LocalLoan) * (0.000001);
|
|
checkFExists.MForeignEquity = model.ForeignEquity * 0.000001;
|
|
checkFExists.MForeignLoan = model.ForeignLoan * 0.000001;
|
|
checkFExists.TotalFDI = (model.ForeignEquity + model.ForeignLoan);
|
|
checkFExists.MInvestmentBreakDown = addnewFProfile.MTotalCapital;
|
|
checkFExists.MWorkingCapital = model.WorkingCapital * 0.000001;
|
|
checkFExists.MTotalFDI = (model.ForeignEquity + model.ForeignLoan) * (0.000001);
|
|
checkFExists.ProjectID = 0;
|
|
checkFExists.Jobs = 0;
|
|
checkFExists.StepName = "3";
|
|
checkFExists.CreatedDate = DateTime.Now;
|
|
var checkSteps = myContext.StepsManagements.Where(t => t.ProjectCode == ProjectCode.ToString()).SingleOrDefault();
|
|
checkSteps.StepNo = "3";
|
|
checkSteps.SubmittedStatus = "Not Submitted";
|
|
checkSteps.UpdatedDate = DateTime.Now;
|
|
if((Session["TypeofOwnership"].ToString()== "Foreign" || Session["TypeofOwnership"].ToString() == "JV") && checkFExists.TotalCapital <500000)
|
|
{
|
|
TempData["error"] = "Total Capital should not be less than $500,000";
|
|
var obj = new FinancingRepository();
|
|
var _birthObject = obj.CreateCountry();
|
|
return View("ShowFinancingProfile", _birthObject);
|
|
}
|
|
if (Session["TypeofOwnership"].ToString() == "Local" && checkFExists.TotalCapital < 100000)
|
|
{
|
|
TempData["error"] = "Total Capital should not be less than $100,000";
|
|
var obj = new FinancingRepository();
|
|
var _birthObject = obj.CreateCountry();
|
|
return View("ShowFinancingProfile", _birthObject);
|
|
}
|
|
TempData["success"] = "Financial Information Successfully Updated";
|
|
myContext.SaveChanges();
|
|
if (Session["ServiceName"].ToString() == "New")
|
|
{
|
|
return RedirectToAction("AttachmentsNew");
|
|
}
|
|
return RedirectToAction("AttachmentsExpansion");
|
|
|
|
}
|
|
else
|
|
{
|
|
TempData["error"] = "Error! failed to add financing";
|
|
var obj = new FinancingRepository();
|
|
var _birthObject = obj.CreateCountry();
|
|
return View("ShowFinancingProfile", _birthObject);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
public ActionResult PostFinancingProfileChangeExpansion(FinancingProfileExternal model)
|
|
{
|
|
|
|
var Username = Session["CompanyEmail"].ToString();
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var CompanyTIN = Session["CompanyTIN"].ToString();
|
|
FinancingProfileExternal addnewFProfile = new FinancingProfileExternal();
|
|
var checkPExists = myContext.ProjectProfilesExternal.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
var checkFExists = myContext.FinancingProfilesExternals.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
if (checkPExists != null)
|
|
{
|
|
checkFExists.ProjectCode = ProjectCode;
|
|
checkFExists.CompanyTIN = CompanyTIN;
|
|
checkFExists.AddedBy = Username;
|
|
checkFExists.LocalEquity = model.LocalEquity;
|
|
checkFExists.LocalLoan = model.LocalLoan;
|
|
checkFExists.ForeignEquity = model.ForeignEquity;
|
|
checkFExists.SourceCountryEquity = model.SourceCountryEquity;
|
|
checkFExists.ForeignLoan = model.ForeignLoan;
|
|
checkFExists.SourceCountryLoan = model.SourceCountryLoan;
|
|
checkFExists.WorkingCapital = model.WorkingCapital;
|
|
checkFExists.FixedAsset = (model.LocalEquity + model.LocalLoan + model.ForeignEquity + model.ForeignLoan);
|
|
checkFExists.TotalDDI = (model.LocalEquity + model.LocalLoan);
|
|
checkFExists.TotalForeign = model.ForeignEquity + model.ForeignLoan;
|
|
checkFExists.TotalLocal = (model.LocalEquity + model.LocalLoan);
|
|
checkFExists.TotalCapital = (model.WorkingCapital + model.LocalEquity + model.LocalLoan + model.ForeignEquity + model.ForeignLoan);
|
|
checkFExists.MTotalCapital = (addnewFProfile.TotalCapital * 0.000001);
|
|
checkFExists.MLocalEquity = (model.LocalEquity * 0.000001);
|
|
checkFExists.MLocalLoan = (model.LocalLoan * 0.000001);
|
|
checkFExists.MFixedAsset = (addnewFProfile.FixedAsset * 0.000001);
|
|
checkFExists.MTotalDDI = (model.LocalEquity + model.LocalLoan) * (0.000001);
|
|
checkFExists.MTotalForeign = (model.ForeignEquity + model.ForeignLoan) * (0.000001);
|
|
checkFExists.MTotalLocal = (model.LocalEquity + model.LocalLoan) * (0.000001);
|
|
checkFExists.MForeignEquity = model.ForeignEquity * 0.000001;
|
|
checkFExists.MForeignLoan = model.ForeignLoan * 0.000001;
|
|
checkFExists.TotalFDI = (model.ForeignEquity + model.ForeignLoan);
|
|
checkFExists.MInvestmentBreakDown = addnewFProfile.MTotalCapital;
|
|
checkFExists.MWorkingCapital = model.WorkingCapital * 0.000001;
|
|
checkFExists.MTotalFDI = (model.ForeignEquity + model.ForeignLoan) * (0.000001);
|
|
checkFExists.ProjectID = 0;
|
|
checkFExists.Jobs = 0;
|
|
checkFExists.StepName = "3";
|
|
checkFExists.CreatedDate = DateTime.Now;
|
|
var checkSteps = myContext.StepsManagements.Where(t => t.ProjectCode == ProjectCode.ToString()).SingleOrDefault();
|
|
checkSteps.StepNo = "3";
|
|
checkSteps.SubmittedStatus = "Not Submitted";
|
|
checkSteps.UpdatedDate = DateTime.Now;
|
|
TempData["success"] = "Financial Information Successfully Updated";
|
|
|
|
myContext.SaveChanges();
|
|
if (Session["ServiceName"].ToString() == "New")
|
|
{
|
|
return RedirectToAction("AttachmentsNew");
|
|
}
|
|
return RedirectToAction("AttachmentsExpansion");
|
|
}
|
|
else
|
|
{
|
|
TempData["success"] = "Project profile page";
|
|
var obj = new ProjectRepository();
|
|
var _birthObject = obj.CreateLocation();
|
|
return View("ProjectDetails", _birthObject);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public string GenerateINo()
|
|
{
|
|
Random Ino = new Random();
|
|
long ran_no = Ino.Next(1, 10000);
|
|
DateTime now = DateTime.Now;
|
|
return "TIC"+now.Year+"-"+ ran_no.ToString()+now.Month+now.Day;
|
|
}
|
|
public string GenerateINoCN()
|
|
{
|
|
Random Ino = new Random();
|
|
long ran_no = Ino.Next(1, 100);
|
|
DateTime now = DateTime.Now;
|
|
|
|
return ran_no.ToString();
|
|
}
|
|
public ActionResult GetCountry()
|
|
{
|
|
var repo = new Countries();
|
|
IEnumerable<SelectListItem> regions = repo.GetCountries();
|
|
return Json(regions, JsonRequestBehavior.AllowGet);
|
|
}
|
|
[HttpGet]
|
|
public ActionResult GetRegions(long CountryID)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(CountryID.ToString()))
|
|
{
|
|
var repo = new RegionRepository();
|
|
|
|
IEnumerable<SelectListItem> regions = repo.GetRegions(CountryID);
|
|
return Json(regions, JsonRequestBehavior.AllowGet);
|
|
}
|
|
return null;
|
|
}
|
|
public ActionResult GetSubSector(string SectorName)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(SectorName.ToString()))
|
|
{
|
|
var repo = new SubSectorsRepository();
|
|
|
|
IEnumerable<SelectListItem> sub_Sector = repo.GetSubSectors(SectorName);
|
|
return Json(sub_Sector, JsonRequestBehavior.AllowGet);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
|
|
[HttpGet]
|
|
public ActionResult GetRegionsD(long CountryID)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(CountryID.ToString()))
|
|
{
|
|
var repo = new RegionRepository();
|
|
|
|
IEnumerable<SelectListItem> regions = repo.GetRegionsD(CountryID);
|
|
return Json(regions, JsonRequestBehavior.AllowGet);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
[HttpGet]
|
|
public ActionResult GetDistricts(string RegionName)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(RegionName))
|
|
{
|
|
var repo = new DistrictRepository();
|
|
IEnumerable<SelectListItem> regions = repo.GetDistrictsNameByRegion(RegionName);
|
|
return Json(regions, JsonRequestBehavior.AllowGet);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
[HttpGet]
|
|
public ActionResult GetWard(string DistrictName)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(DistrictName.ToString()))
|
|
{
|
|
var repo = new WardRepository();
|
|
IEnumerable<SelectListItem> regions = repo.GetWardOfBirth(DistrictName);
|
|
return Json(regions, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public ActionResult DisplayInvoice()
|
|
{
|
|
return new ViewAsPdf();
|
|
}
|
|
public ActionResult DisplayInvoiceTransfer()
|
|
{
|
|
return new ViewAsPdf();
|
|
}
|
|
public ActionResult Regenerate(string Id)
|
|
{
|
|
Session["ProjectCode"] = Id;
|
|
return RedirectToAction("DisplayPDF");
|
|
}
|
|
public ActionResult RegenerateTransfer(string Id)
|
|
{
|
|
Session["ProjectCode"] = Id;
|
|
return RedirectToAction("DisplayInvoiceTransfer");
|
|
}
|
|
public async Task<ActionResult> DisplayPDF()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkIfExist = myContext.ApplicationManagers.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
if (checkIfExist.Currency == "USD" && (checkIfExist.ServiceName=="New" || checkIfExist.ServiceName == "Expansion"))
|
|
{
|
|
|
|
Session["AmountinWords"] = "ONE THOUSAND ONE HUNDRED AMERICAN DOLLARS";
|
|
|
|
}
|
|
if (checkIfExist.Currency == "TZS" && (checkIfExist.ServiceName == "New" || checkIfExist.ServiceName == "Expansion"))
|
|
|
|
{
|
|
|
|
Session["AmountinWords"] = "Two million, five hundred thirty thousand Tanzanian Shillings";
|
|
|
|
}
|
|
if (checkIfExist.Currency == "USD" && (checkIfExist.ServiceName == "Amendment" || checkIfExist.ServiceName == "Extension"))
|
|
|
|
{
|
|
|
|
Session["AmountinWords"] = "ONE THOUSAND AMERICAN DOLLARS";
|
|
|
|
}
|
|
if (checkIfExist.Currency == "TZS" && (checkIfExist.ServiceName == "Amendment" || checkIfExist.ServiceName == "Extension"))
|
|
|
|
{
|
|
|
|
Session["AmountinWords"] = "Two million, three hundred thousand Tanzanian Shillings";
|
|
|
|
}
|
|
var InvoiceID = checkIfExist.InvoiceID;
|
|
using (var client = new HttpClient())
|
|
{
|
|
|
|
client.DefaultRequestHeaders.Accept.Clear();
|
|
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
|
HttpResponseMessage responseMessage = await client.GetAsync("http://192.168.2.31:8090/tic/invoice-gen/" + InvoiceID);
|
|
var responseJson = await responseMessage.Content.ReadAsStringAsync();
|
|
var jObject = JObject.Parse(responseJson);
|
|
var checkresult = jObject.GetValue("resultcode").ToString();
|
|
if (checkresult == "0")
|
|
{
|
|
|
|
Session["ControlNo"] = jObject.SelectToken("result.ControlNo").Value<string>();
|
|
Session["QRCode"] = jObject.SelectToken("result.QRCode").Value<string>();
|
|
Session["SubServiceName"] = jObject.SelectToken("result.SubServiceName").Value<string>();
|
|
Session["FullName"] = jObject.SelectToken("result.FullName").Value<string>();
|
|
Session["CompanyName"] = checkIfExist.CompanyName;
|
|
Session["PhoneNo"] = jObject.SelectToken("result.PhoneNo").Value<string>();
|
|
Session["Amount"] = jObject.SelectToken("result.Amount").Value<string>();
|
|
Session["BillDescription"] = jObject.SelectToken("result.SubServiceName").Value<string>();
|
|
Session["Currency"] = jObject.SelectToken("result.Currency").Value<string>();
|
|
Session["ExpireDate"] = jObject.SelectToken("result.ExpireDate").Value<string>();
|
|
Session["PrintedDate"] = DateTime.Now.ToString("dd-MM-yyyy");
|
|
|
|
return RedirectToAction("DisplayInvoice", "NewCOI");
|
|
|
|
}
|
|
if (checkresult == "Failure")
|
|
{
|
|
var Reslt = jObject.GetValue("message").ToString();
|
|
ViewData["Notfound"] = Reslt.ToString();
|
|
return View("NotFoundApp");
|
|
}
|
|
|
|
return View("NotFoundApp");
|
|
}
|
|
|
|
}
|
|
public async Task<ActionResult> DisplayPDFTransfer()
|
|
{
|
|
var ProjectCode = Session["ProjectCode"].ToString();
|
|
var checkIfExist = myContext.ApplicationManagers.SingleOrDefault(t => t.ProjectCode == ProjectCode);
|
|
var InvoiceID = checkIfExist.InvoiceID;
|
|
using (var client = new HttpClient())
|
|
{
|
|
|
|
client.DefaultRequestHeaders.Accept.Clear();
|
|
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
|
HttpResponseMessage responseMessage = await client.GetAsync("http://192.168.2.31:8090/tic/invoice-gen/" + InvoiceID);
|
|
var responseJson = await responseMessage.Content.ReadAsStringAsync();
|
|
var jObject = JObject.Parse(responseJson);
|
|
var checkresult = jObject.GetValue("resultcode").ToString();
|
|
if (checkresult == "0")
|
|
{
|
|
|
|
Session["ControlNo"] = jObject.SelectToken("result.ControlNo").Value<string>();
|
|
Session["QRCode"] = jObject.SelectToken("result.QRCode").Value<string>();
|
|
Session["SubServiceName"] = jObject.SelectToken("result.SubServiceName").Value<string>();
|
|
Session["FullName"] = jObject.SelectToken("result.FullName").Value<string>();
|
|
Session["PhoneNo"] = jObject.SelectToken("result.PhoneNo").Value<string>();
|
|
Session["Amount"] = jObject.SelectToken("result.Amount").Value<string>();
|
|
Session["BillDescription"] = jObject.SelectToken("result.SubServiceName").Value<string>();
|
|
Session["Currency"] = jObject.SelectToken("result.Currency").Value<string>();
|
|
Session["ExpireDate"] = jObject.SelectToken("result.ExpireDate").Value<string>();
|
|
Session["PrintedDate"] = DateTime.Now.ToString("dd-MM-yyyy");
|
|
|
|
return RedirectToAction("DisplayInvoiceTransfer", "NewCOI");
|
|
|
|
}
|
|
if (checkresult == "Failure")
|
|
{
|
|
var Reslt = jObject.GetValue("message").ToString();
|
|
ViewData["Notfound"] = Reslt.ToString();
|
|
return View("NotFoundApp");
|
|
}
|
|
|
|
return View("NotFoundApp");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
} |