public ActionResult DCRAdminIndex(int id = 0) { DCRAdminContract contract = null; if (id > 0 && DCRBusinessLayer.Instance.IsAdminUser(this.CurrentUser.UserId)) { Dictionary <string, string> objDict = new Dictionary <string, string>(); objDict.Add("FormName", FormNames.DCRADMINFORM); objDict.Add("ItemId", id.ToString()); objDict.Add(Parameter.USEREID, this.CurrentUser.UserId); ViewBag.UserID = this.CurrentUser.UserId; ViewBag.UserName = this.CurrentUser.FullName; contract = this.GetAdminDCRDetails(objDict); if (contract.Forms != null && contract.Forms.Count > 0) { DCRAdminDetailSection dcrAdminDetailSection = contract.Forms[0].SectionsList.FirstOrDefault(f => f.SectionName == DCRSectionName.DCRDETAILADMINSECTION) as DCRAdminDetailSection; ApplicationStatusSection dcrApprovalSection = contract.Forms[0].SectionsList.FirstOrDefault(f => f.SectionName == SectionNameConstant.APPLICATIONSTATUS) as ApplicationStatusSection; if (dcrAdminDetailSection != null) { this.SetTranListintoTempData <VendorDCR>(dcrAdminDetailSection.VendorDCRList, TempKeys.DCRVendor.ToString() + "_" + id); dcrAdminDetailSection.Division = dcrAdminDetailSection.Division.LastIndexOf(",") != -1 ? dcrAdminDetailSection.Division.TrimEnd(',') : dcrAdminDetailSection.Division; if (dcrApprovalSection != null) { dcrAdminDetailSection.ApproversList = dcrApprovalSection.ApplicationStatusList; dcrAdminDetailSection.QAIComment = dcrAdminDetailSection.ApproversList.FirstOrDefault(p => p.Role == DCRRoles.QAINCHARGE).Comments; dcrAdminDetailSection.DCRProcessIComment = dcrAdminDetailSection.ApproversList.FirstOrDefault(p => p.Role == DCRRoles.DCRPROCESSINCHARGE).Comments; dcrAdminDetailSection.DCRInchargeNavigatorComment = dcrAdminDetailSection.ApproversList.FirstOrDefault(p => p.Role == DCRRoles.DCRINCHARGENAVIGATOR).Comments; // dcrAdminDetailSection.DesignEngineerComment = dcrAdminDetailSection.ApproversList.FirstOrDefault(p => p.Role == DCRRoles.DESIGNDEVELOPENGINEER).Comments; dcrAdminDetailSection.DesignEngineerIComment = dcrAdminDetailSection.ApproversList.FirstOrDefault(p => p.Role == DCRRoles.DESIGNENGINEERINCHARGE) != null?dcrAdminDetailSection.ApproversList.FirstOrDefault(p => p.Role == DCRRoles.DESIGNENGINEERINCHARGE).Comments : string.Empty; dcrAdminDetailSection.SCMIComment = dcrAdminDetailSection.ApproversList.FirstOrDefault(p => p.Role == DCRRoles.SCMINCHARGE).Comments; dcrAdminDetailSection.LUMIComment = dcrAdminDetailSection.ApproversList.FirstOrDefault(p => p.Role == DCRRoles.LUMMARKETINGINCHARGE).Comments; dcrAdminDetailSection.KAPIComment = dcrAdminDetailSection.ApproversList.FirstOrDefault(p => p.Role == DCRRoles.KAPMARKETINGINCHARGE).Comments; dcrAdminDetailSection.DAPIComment = dcrAdminDetailSection.ApproversList.FirstOrDefault(p => p.Role == DCRRoles.DAPMARKETINGINCHARGE).Comments; dcrAdminDetailSection.FANIComment = dcrAdminDetailSection.ApproversList.FirstOrDefault(p => p.Role == DCRRoles.FANSMARKETINGINCHARGE).Comments; dcrAdminDetailSection.LightingIComment = dcrAdminDetailSection.ApproversList.FirstOrDefault(p => p.Role == DCRRoles.LIGHTINGMARKETINGINCHARGE).Comments; dcrAdminDetailSection.MRMarketingIComment = dcrAdminDetailSection.ApproversList.FirstOrDefault(p => p.Role == DCRRoles.MORPHYRICHARDSMARKETINGINCHARGE).Comments; } } return(this.View(contract)); } else { return(this.RedirectToAction("NotAuthorize", "Master")); } } else { return(this.RedirectToAction("NotAuthorize", "Master")); } }
public DCRAdminContract GetAdminDCRDetails(IDictionary <string, string> objDict) { DCRAdminContract contract = new DCRAdminContract(); // BELDataAccessLayer helper = new BELDataAccessLayer(); // KKSoni Change Helper class name to BELDataAccessLayer if (objDict != null && objDict.ContainsKey(Parameter.FROMNAME) && objDict.ContainsKey(Parameter.ITEMID) && objDict.ContainsKey(Parameter.USEREID)) { string formName = objDict[Parameter.FROMNAME]; int itemId = Convert.ToInt32(objDict[Parameter.ITEMID]); string userID = objDict[Parameter.USEREID]; //contract.UserDetails = BELDataAccessLayer.Instance.GetUserInformation(userEmail); IForm dcrAdminForm = new DCRAdminForm(true); dcrAdminForm = BELDataAccessLayer.Instance.GetFormData(this.context, this.web, ApplicationNameConstants.DCRAPP, formName, itemId, userID, dcrAdminForm); if (dcrAdminForm != null && dcrAdminForm.SectionsList != null && dcrAdminForm.SectionsList.Count > 0) { var sectionDetails = dcrAdminForm.SectionsList.FirstOrDefault(f => f.SectionName.Equals(DCRSectionName.DCRDETAILADMINSECTION)) as DCRAdminDetailSection; if (sectionDetails != null) { ////Get Logged in user Department. if (itemId == 0) { List <IMasterItem> approvers = sectionDetails.MasterData.FirstOrDefault(p => p.NameOfMaster == DCRDCNListNames.APPROVERMASTER).Items; List <ApproverMasterListItem> approverList = approvers.ConvertAll(p => (ApproverMasterListItem)p); ////Get Department User sectionDetails.ApproversList.ForEach(p => { if (p.Role == DCRRoles.DCRINCHARGENAVIGATOR) { p.Approver = approverList.FirstOrDefault(q => q.Role == DCRRoles.DCRINCHARGENAVIGATOR).UserID; p.ApproverName = approverList.FirstOrDefault(q => q.Role == DCRRoles.DCRINCHARGENAVIGATOR).UserName; } else if (p.Role == DCRRoles.DCRPROCESSINCHARGE || p.Role == DCRRoles.FINALDCRPROCESSINCHARGE) { p.Approver = approverList.FirstOrDefault(q => q.Role == DCRRoles.DCRPROCESSINCHARGE).UserID; p.ApproverName = approverList.FirstOrDefault(q => q.Role == DCRRoles.DCRPROCESSINCHARGE).UserName; } else if (p.Role == DCRRoles.QAINCHARGE) { p.Approver = approverList.FirstOrDefault(q => q.Role == DCRRoles.QAINCHARGE).UserID; p.ApproverName = approverList.FirstOrDefault(q => q.Role == DCRRoles.QAINCHARGE).UserName; } else if (p.Role == DCRRoles.SCMINCHARGE) { p.Approver = approverList.FirstOrDefault(q => q.Role == DCRRoles.SCMINCHARGE).UserID; p.ApproverName = approverList.FirstOrDefault(q => q.Role == DCRRoles.SCMINCHARGE).UserName; } else if (p.Role == DCRRoles.CCINCHARGE) { p.Approver = approverList.FirstOrDefault(q => q.Role == DCRRoles.CCINCHARGE).UserID; p.ApproverName = approverList.FirstOrDefault(q => q.Role == DCRRoles.CCINCHARGE).UserName; } else if (p.Role == DCRRoles.DCRINCHARGENAVIGATOR) { p.Approver = approverList.FirstOrDefault(q => q.Role == DCRRoles.DCRINCHARGENAVIGATOR).UserID; p.ApproverName = approverList.FirstOrDefault(q => q.Role == DCRRoles.DCRINCHARGENAVIGATOR).UserName; } }); } sectionDetails.FNLDesignChangeAttachment = sectionDetails.Files != null && sectionDetails.Files.Count > 0 ? JsonConvert.SerializeObject(sectionDetails.Files.Where(x => !string.IsNullOrEmpty(sectionDetails.FNLDesignChangeAttachment) && sectionDetails.FNLDesignChangeAttachment.Split(',').Contains(x.FileName)).ToList()) : string.Empty; sectionDetails.FNLExpectedResultsAttachment = sectionDetails.Files != null && sectionDetails.Files.Count > 0 ? JsonConvert.SerializeObject(sectionDetails.Files.Where(x => !string.IsNullOrEmpty(sectionDetails.FNLExpectedResultsAttachment) && sectionDetails.FNLExpectedResultsAttachment.Split(',').Contains(x.FileName)).ToList()) : string.Empty; if (itemId != 0) { if (sectionDetails.Status == FormStatus.COMPLETED && sectionDetails.ApproversList.Any(p => p.Role == DCNRoles.DCRPROCESSINCHARGE && p.Approver == userID)) { if (dcrAdminForm.Buttons.FirstOrDefault(p => p.Name == "Print") != null) { dcrAdminForm.Buttons.FirstOrDefault(p => p.Name == "Print").IsVisible = false; } } } sectionDetails.FNLDCRAttachment = sectionDetails.Files != null && sectionDetails.Files.Count > 0 ? JsonConvert.SerializeObject(sectionDetails.Files.Where(x => !string.IsNullOrEmpty(sectionDetails.FNLDCRAttachment) && sectionDetails.FNLDCRAttachment.Split(',').Contains(x.FileName)).ToList()) : string.Empty; sectionDetails.FNLDEAttachment = sectionDetails.Files != null && sectionDetails.Files.Count > 0 ? JsonConvert.SerializeObject(sectionDetails.Files.Where(x => !string.IsNullOrEmpty(sectionDetails.FNLDEAttachment) && sectionDetails.FNLDEAttachment.Split(',').Contains(x.FileName)).ToList()) : string.Empty; sectionDetails.FNLQATestReport = sectionDetails.Files != null && sectionDetails.Files.Count > 0 ? JsonConvert.SerializeObject(sectionDetails.Files.Where(x => !string.IsNullOrEmpty(sectionDetails.FNLQATestReport) && sectionDetails.FNLQATestReport.Split(',').Contains(x.FileName)).ToList()) : string.Empty; } contract.Forms.Add(dcrAdminForm); } } return(contract); }