public ActionResult Edit(Usp_GetAdminMainDetails_Result _amSelctedObj) { FinaceTool.Models.AMModel _AmDetails = new FinaceTool.Models.AMModel(); bool result = QuaterGenerator.EditRestrictionByRole(Session["RoleId"].ToString()); if (result == false) { TempData["Message"] = "You do not have permissions to Edit in this Time Slab."; return(View("DisplayAmDetails", Display())); } else { List <Usp_GetAdminMainDetails_V2_Result> myresult = financetoolentities.Usp_GetAdminMainDetails_V2() .Where(i => i.OpportunityID == _amSelctedObj.OpportunityID && i.CustomerID == _amSelctedObj.CustomerID && i.AMID == _amSelctedObj.AMID && i.OpportunityLobId == _amSelctedObj.LOBID && i.DUID == _amSelctedObj.DUID && i.ServiceLineID == _amSelctedObj.ServiceLineID && i.IsUpdated == false) .ToList(); _AmDetails.CustomerList = BindDropdownAMDetails(); _AmDetails.duList = BindDropdownDUDetails(); _AmDetails.lobList = BindDropdownLobDetails(); _AmDetails.ProjectList = BindDropdownProjectDetails(); _AmDetails.serviceList = BindServiceLineDetails(); _AmDetails.ProductGroupList = BindDdlProductGroupDetails(); _AmDetails.DealStageList = BindDealStageDetails(); _AmDetails.OpportunityCategoryList = BindOpportunityCategoryDetails(); _AmDetails.SowStatusList = BindSowStatusDetails(); _AmDetails.AmUserList = BindAmUserDetails(); //drop down binding ended _AmDetails.OpportunityName = myresult[0].OpportunityName; _AmDetails.S_No = myresult[0].S_No; //_AmDetails.acv = myresult[0].acv; _AmDetails.AMId = myresult[0].AMID.ToString(); _AmDetails.AMName = myresult[0].AMName; _AmDetails.BillingStratDate = myresult[0].BillingStratDate; _AmDetails.CustomerId = myresult[0].CustomerID.ToString(); _AmDetails.Customername = myresult[0].Customername; _AmDetails.DBBLDU = myresult[0].DBBLDU; _AmDetails.DBBLDuId = myresult[0].DBBLDUID.ToString(); _AmDetails.DuId = myresult[0].DUID.ToString(); _AmDetails.DUName = myresult[0].DUName; _AmDetails.LOBName = myresult[0].OpportunityLobName; _AmDetails.LobId = myresult[0].OpportunityLobId.ToString(); _AmDetails.OpportunityID = myresult[0].OpportunityID.ToString(); _AmDetails.OpportunityKeyID = Convert.ToInt16(myresult[0].OpportunityKeyID); if (string.IsNullOrEmpty(myresult[0].ProjectID.ToString())) { _AmDetails.ProjectId = "0"; } else { _AmDetails.ProjectIdForEdit = myresult[0].ProjectID.ToString(); } _AmDetails.ServiceLine = myresult[0].ServiceLine; _AmDetails.ProgramName = myresult[0].ProgramName; _AmDetails.ServiceLineId = myresult[0].ServiceLineID.ToString(); _AmDetails.ProductGroup = myresult[0].ProductGroup; _AmDetails.ProductGroupId = myresult[0].ProductGroupID.ToString(); _AmDetails.sowvalue = myresult[0].sowvalue; _AmDetails.DealStageId = myresult[0].DealStage.ToString(); _AmDetails.acv = Convert.ToDecimal(MyCustomFormat(Convert.ToDouble(myresult[0].acv))); _AmDetails.TCV = Convert.ToDecimal(MyCustomFormat(Convert.ToDouble(myresult[0].TCV))); _AmDetails.BillingStratDate = myresult[0].BillingStratDate; _AmDetails.Note_Comment = myresult[0].note; _AmDetails.IsUpdated = Convert.ToBoolean(myresult[0].IsUpdated); _AmDetails.OpportunityCategory = myresult[0].opportunitycategory; List <Quater> QuaterList = new List <Quater>(); var dbQuaterlist = financetoolentities.Quaters.Where(i => i.IsActive == true).ToList(); foreach (var quater in dbQuaterlist) { var value = myresult[0].GetType().GetProperty(quater.QuaterName); var Quartervalue = value.GetValue(myresult[0], null).ToString(); var qvalue = MyCustomFormat(Convert.ToDouble(Quartervalue)); quater.QuaterName = quater.QuaterName + "_FC($K):" + qvalue; QuaterList.Add(quater); } _AmDetails.Quaterlist = QuaterList; _AmDetails.SowStatusValue = Convert.ToDecimal(MyCustomFormat(Convert.ToDouble(myresult[0].SowStatusValue))); return(View(_AmDetails)); } }
public ActionResult EditDUHData(FinaceTool.Usp_GetDUHMainDetails_Result _duhSelctedObj) { bool result = QuaterGenerator.EditRestrictionByRole(Session["RoleId"].ToString()); if (result == false) { TempData["Message"] = "You do not have permissions to Edit in this Time Slab."; return(View("Index", Display())); } else { Usp_GetDUHMainDetailsByUserID_V2_Result[] myresult = financetoolentities.Usp_GetDUHMainDetailsByUserID_V2(Session["UserId"].ToString()) .Where(i => i.OpportunityID == _duhSelctedObj.OpportunityID && i.IsUpdated == false && i.CustomerID == _duhSelctedObj.CustomerID && i.AMID == _duhSelctedObj.AMID && i.OpportunityLobId == _duhSelctedObj.LOBID && i.DUID == _duhSelctedObj.DUID && i.ServiceLineID == _duhSelctedObj.ServiceLineID) .ToArray(); FinaceTool.Models.DUHModel _DuhDetails = new FinaceTool.Models.DUHModel(); _DuhDetails.dealstageId = myresult[0].DealStageID.ToString(); _DuhDetails.Customername = _duhSelctedObj.Customername; _DuhDetails.CustomerList = BindDropdowncustomerDetails(); _DuhDetails.duList = BindDropdownDUDetails(); _DuhDetails.lobList = BindDropdownLobDetails(); _DuhDetails.ProjectList = BindDropdownProjectDetails(); _DuhDetails.serviceList = BindServiceLineDetails(); _DuhDetails.ProductGroupList = BindDdlProductGroupDetails(); _DuhDetails.DealStageList = BindDealStageDetails(); _DuhDetails.SowStatusList = BindSowStatusDetails(); _DuhDetails.AmUserList = BindAmUserDetails(); _DuhDetails.poAvailablelist = BindPoAvailableDetails(); _DuhDetails.OpportunityList = BindDropdownOpportunityDetails(); //drop down binding ended _DuhDetails.OpportunityName = myresult[0].OpportunityName; _DuhDetails.S_No = myresult[0].S_No; _DuhDetails.selectedcustomerText = myresult[0].Customername; _DuhDetails.AMName = myresult[0].AMName; _DuhDetails.AMID = myresult[0].AMID; _DuhDetails.selectedcustomerId = myresult[0].CustomerID; _DuhDetails.OpportunityID = myresult[0].OpportunityID; _DuhDetails.DBBLDU = myresult[0].DBBLDU; _DuhDetails.DBBLDUID = myresult[0].DBBLDUID; _DuhDetails.DUID = myresult[0].DUID; _DuhDetails.DUName = myresult[0].DUName; _DuhDetails.LOBName = myresult[0].LOBName; _DuhDetails.LOBID = Convert.ToInt16(myresult[0].OpportunityLobId); _DuhDetails.OpportunityKeyID = myresult[0].OpportunityKeyID; _DuhDetails.poavilable = myresult[0].poavilable; _DuhDetails.pobalance = myresult[0].pobalance; if (string.IsNullOrEmpty(myresult[0].ProjectID.ToString())) { _DuhDetails.ProjectID = 0; _DuhDetails.ProjectName = "Please Select Project"; } else { _DuhDetails.ProjectID = myresult[0].ProjectID; _DuhDetails.ProjectName = myresult[0].ProjectName; } _DuhDetails.ServiceLine = myresult[0].ServiceLine; _DuhDetails.ServiceLineID = myresult[0].ServiceLineID;; _DuhDetails.ProgramName = myresult[0].ProgramName; _DuhDetails.ProductGroup = myresult[0].ProductGroup; _DuhDetails.ProductGroupID = myresult[0].ProductGroupID; if (string.IsNullOrEmpty(myresult[0].SowStatus.ToString())) { _DuhDetails.SowStatus = 0; } else { _DuhDetails.SowStatus = myresult[0].SowStatus; } _DuhDetails.Note = myresult[0].Note; //List<Quater> QuaterList = new List<Quater>(); var dbQuaterlist = financetoolentities.Quaters.Where(i => i.IsActive == true).ToList(); var dbQuater_Actuallist = financetoolentities.quater_Actual.Where(i => i.IsActive == true).ToList(); List <string> Operations = new List <string>(); Operations.Add("_FC"); List <string> QuaterList = new List <string>(); foreach (var quater in dbQuaterlist) { foreach (var Obj in Operations) { var value = myresult[0].GetType().GetProperty(quater.QuaterName.Substring(0, 5) + Obj); var Quartervalue = value.GetValue(myresult[0], null).ToString(); var qvalue = MyCustomFormat(Convert.ToDouble(Quartervalue)); string QuaterName = quater.QuaterName.Substring(0, 5) + Obj + "($K)" + ":" + qvalue; QuaterList.Add(QuaterName); } } Operations.Clear(); Operations.Add("_ACT"); foreach (var quater in dbQuater_Actuallist) { foreach (var Obj in Operations) { var value = myresult[0].GetType().GetProperty(quater.QuaterName.Substring(0, 5) + Obj); var Quartervalue = value.GetValue(myresult[0], null).ToString(); var qvalue = MyCustomFormat(Convert.ToDouble(Quartervalue)); string QuaterName = quater.QuaterName.Substring(0, 5) + Obj + "($K)" + ":" + qvalue; QuaterList.Add(QuaterName); } } _DuhDetails.QuaterListData = QuaterList; return(View(_DuhDetails)); } }