public ActionResult DUHOpeartions() { QuaterGenerator.UpdateActiveQuaters(); var DUHGriddetails = financetoolentities.Usp_GetDUHMainDetails_V2().Where(i => i.IsUpdated == false).ToList(); int Iteration = 0; List <DUHMainDetailsResult> DUHMainDetailsResultList = new List <DUHMainDetailsResult>(); foreach (var DUHdbvalues in DUHGriddetails) { DUHMainDetailsResult duhmaindetail = new DUHMainDetailsResult(); duhmaindetail.AMID = DUHdbvalues.AMID; duhmaindetail.AMName = DUHdbvalues.AMName; duhmaindetail.CustomerID = DUHdbvalues.CustomerID; duhmaindetail.Customername = DUHdbvalues.Customername; duhmaindetail.DBBLDU = DUHdbvalues.DBBLDU; duhmaindetail.DBBLDUID = DUHdbvalues.DBBLDUID; duhmaindetail.DealStageID = DUHdbvalues.DealStageID; duhmaindetail.DUID = DUHdbvalues.DUID; duhmaindetail.DUName = DUHdbvalues.DUName; duhmaindetail.LOBID = DUHdbvalues.LOBID; duhmaindetail.LOBName = DUHdbvalues.LOBName; duhmaindetail.Note = DUHdbvalues.Note; duhmaindetail.OpportunityID = DUHdbvalues.OpportunityID; duhmaindetail.OpportunityKeyID = DUHdbvalues.OpportunityKeyID; duhmaindetail.OpportunityLobId = DUHdbvalues.OpportunityLobId; duhmaindetail.OpportunityLobName = DUHdbvalues.OpportunityLobName; duhmaindetail.OpportunityName = DUHdbvalues.OpportunityName; //duhmaindetail.poavilable = DUHdbvalues.poavilable; duhmaindetail.pobalance = DUHdbvalues.pobalance; duhmaindetail.ProductGroup = DUHdbvalues.ProductGroup; duhmaindetail.ProductGroupID = DUHdbvalues.ProductGroupID; duhmaindetail.ProgramName = DUHdbvalues.ProgramName; duhmaindetail.ProjectID = DUHdbvalues.ProjectID; duhmaindetail.ProjectName = DUHdbvalues.ProjectName; duhmaindetail.SDUID = DUHdbvalues.SDUID; duhmaindetail.ServiceLine = DUHdbvalues.ServiceLine; duhmaindetail.ServiceLineID = DUHdbvalues.ServiceLineID; duhmaindetail.SowStatus = DUHdbvalues.SOWStatus1; duhmaindetail.S_No = DUHdbvalues.S_No; if (DUHdbvalues.poavilable == "1") { duhmaindetail.poavilable = "Yes"; } else if (DUHdbvalues.poavilable == "0") { duhmaindetail.poavilable = "No"; } List <string> Objquater = new List <string>(); List <string> QuaterName = new List <string>(); List <string> Operations = new List <string>(); Operations.Add("_FC"); var dbQuaterlist = financetoolentities.Quaters.Where(i => i.IsActive == true).ToList(); var dbQuater_Actuallist = financetoolentities.quater_Actual.Where(i => i.IsActive == true).ToList(); foreach (var quater in dbQuaterlist) { foreach (var Obj in Operations) { var value = DUHdbvalues.GetType().GetProperty(quater.QuaterName + Obj); var Quartervalue = value.GetValue(DUHdbvalues, null).ToString(); var qvalue = MyCustomFormat(Convert.ToDouble(Quartervalue)); Objquater.Add(qvalue); } QuaterName.Add(quater.QuaterName + "_FC($K)"); // QuaterName.Add(quater.QuaterName + "_ACT($K)"); } Operations.Clear(); Operations.Add("_ACT"); foreach (var quater in dbQuater_Actuallist) { foreach (var Obj in Operations) { var value = DUHdbvalues.GetType().GetProperty(quater.QuaterName + Obj); var Quartervalue = value.GetValue(DUHdbvalues, null).ToString(); var qvalue = MyCustomFormat(Convert.ToDouble(Quartervalue)); Objquater.Add(qvalue); } //QuaterName.Add(quater.QuaterName + "_FC($K)"); QuaterName.Add(quater.QuaterName + "_ACT($K)"); } if (Iteration == 0) { duhmaindetail.QuaterName = QuaterName; } duhmaindetail.Quaterlist = Objquater; DUHMainDetailsResultList.Add(duhmaindetail); Iteration++; } return(View(DUHMainDetailsResultList)); }