コード例 #1
0
        public DCNAdminContract GetDCNAdminDetails(IDictionary <string, string> objDict)
        {
            DCNAdminContract   contract = new DCNAdminContract();
            BELDataAccessLayer helper   = new 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];
                IForm  dcnAdminForm = new DCNAdminForm(true);
                dcnAdminForm = helper.GetFormData(this.context, this.web, ApplicationNameConstants.DCRAPP, formName, itemId, userID, dcnAdminForm);
                if (dcnAdminForm != null && dcnAdminForm.SectionsList != null && dcnAdminForm.SectionsList.Count > 0)
                {
                    var sectionDetails = dcnAdminForm.SectionsList.FirstOrDefault(f => f.SectionName.Equals(DCNSectionName.DCNDETAILADMINSECTION)) as DCNDetailAdminSection;
                    if (sectionDetails != null)
                    {
                        if (itemId != 0)
                        {
                            if ((sectionDetails.Status == FormStatus.COMPLETED || sectionDetails.Status == FormStatus.REJECTED) && !sectionDetails.ApproversList.Any(p => (p.Role == DCNRoles.DCRPROCESSINCHARGE || p.Role == DCNRoles.SCM) && !String.IsNullOrEmpty(p.Approver) && p.Approver.Split(',').Contains(userID.Trim())))
                            {
                                if (dcnAdminForm.Buttons.FirstOrDefault(p => p.Name == "Print") != null)
                                {
                                    dcnAdminForm.Buttons.FirstOrDefault(p => p.Name == "Print").IsVisible = false;
                                }
                            }
                        }
                    }
                    contract.Forms.Add(dcnAdminForm);
                }
            }
            return(contract);
        }
コード例 #2
0
        public ActionResult DCNAdminIndex(int id = 0)
        {
            if (id > 0 && DCRBusinessLayer.Instance.IsAdminUser(this.CurrentUser.UserId))
            {
                Dictionary <string, string> objDict = new Dictionary <string, string>();
                objDict.Add(Parameter.FROMNAME, FormNames.DCNADMINFORM);
                objDict.Add(Parameter.ITEMID, id.ToString());
                objDict.Add(Parameter.USEREID, this.CurrentUser.UserId);
                ViewBag.UserID   = this.CurrentUser.UserId;
                ViewBag.UserName = this.CurrentUser.FullName;
                DCNAdminContract dcnContract = this.GetDCNAdminDetails(objDict);
                dcnContract.UserDetails = this.CurrentUser;

                if (dcnContract != null)
                {
                    var form = dcnContract.Forms.FirstOrDefault();
                    if (form != null)
                    {
                        var dcnDetailAdminSection = form.SectionsList.FirstOrDefault(f => f.SectionName.Equals(DCNSectionName.DCNDETAILADMINSECTION)) as DCNDetailAdminSection;
                        ApplicationStatusSection dcnApprovalSection = dcnContract.Forms[0].SectionsList.FirstOrDefault(f => f.SectionName == SectionNameConstant.APPLICATIONSTATUS) as ApplicationStatusSection;
                        if (dcnDetailAdminSection != null)
                        {
                            this.SetTranListintoTempData <Specification>(dcnDetailAdminSection.Specification, TempKeys.Specification.ToString() + "_" + id);
                            this.SetTranListintoTempData <RevisedApplicableDocuments>(dcnDetailAdminSection.RevisedApplicable, TempKeys.RevisedApplicableDoc.ToString() + "_" + id);
                            this.SetTranListintoTempData <VendorDCN>(dcnDetailAdminSection.VendorDCRList, TempKeys.DCRVendor.ToString() + "_" + id);
                            this.SetTranListintoTempData <VendorDCN>(dcnDetailAdminSection.VendorDCNList, TempKeys.DCNVendor.ToString() + "_" + id);
                            if (dcnApprovalSection != null)
                            {
                                dcnDetailAdminSection.ApproversList      = dcnApprovalSection.ApplicationStatusList;
                                dcnDetailAdminSection.DCRProcessIComment = dcnDetailAdminSection.ApproversList.FirstOrDefault(p => p.Role == DCNRoles.DCRPROCESSINCHARGE).Comments;
                                dcnDetailAdminSection.SCMComment         = dcnDetailAdminSection.ApproversList.FirstOrDefault(p => p.Role == DCNRoles.SCM) != null?dcnDetailAdminSection.ApproversList.FirstOrDefault(p => p.Role == DCNRoles.SCM).Comments : string.Empty;

                                //dcnDetailAdminSection.DesignEngComment = dcnDetailAdminSection.ApproversList.FirstOrDefault(p => p.Role == DCNRoles.DESIGNENGINEER).Comments;
                            }
                        }
                    }
                    return(this.View(dcnContract));
                }
                else
                {
                    return(this.RedirectToAction("NotAuthorize", "Master"));
                }
            }
            else
            {
                return(this.RedirectToAction("NotAuthorize", "Master"));
            }
        }