public JsonResult RetrieveDCRNoDetails(string itemID) { DCRDetails dcrdetails = new DCRDetails(); if (itemID != null) { Dictionary <string, string> objDict = new Dictionary <string, string>(); objDict.Add("FormName", FormNameConstants.DCRFORM); objDict.Add("ItemId", itemID.ToString()); objDict.Add("UserEmail", this.CurrentUser.UserId); dcrdetails = this.RetrieveDCRNoDetails(objDict); List <VendorDCN> list = new List <VendorDCN>(); if (dcrdetails != null && !string.IsNullOrEmpty(dcrdetails.DCRNo)) { dcrdetails.DCNNo = dcrdetails.DCRNo.Replace("DCR", "DCR-DCN"); if (dcrdetails.VendorDCRList != null) { foreach (VendorDCN item in dcrdetails.VendorDCRList) { item.ItemAction = ItemActionStatus.NEW; item.ID = 0; list.Add(item); } this.SetTempData <List <VendorDCN> >(TempKeys.DCRVendor + "_0", list.OrderBy(x => x.Index).ToList()); } } } return(Json(dcrdetails, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Gets the DCN details. /// </summary> /// <param name="objDict">The object dictionary.</param> /// <returns>byte array</returns> public List <DCRDetails> RetrieveAllDCRNos(IDictionary <string, string> objDict) { List <DCRDetails> dcrs = new List <DCRDetails>(); List spList = this.web.Lists.GetByTitle(DCRDCNListNames.DCRLIST); CamlQuery query = new CamlQuery(); if (objDict != null && objDict.ContainsKey("UserEmail")) { User loggedinuser = BELDataAccessLayer.EnsureUser(context, web, objDict["UserEmail"].ToString()); query.ViewXml = @"<View> <Query> <Where> <And> <Eq> <FieldRef Name='FinalDesignEngineer' /><Value Type='User'>" + loggedinuser.Title + @"</Value> </Eq> <And> <Eq> <FieldRef Name='Status' /> <Value Type='Text'>" + FormStatus.COMPLETED + @"</Value> </Eq> <Eq> <FieldRef Name='IsDCNGenerated' /> <Value Type='Boolean'>0</Value> </Eq> </And> </And> </Where> </Query> </View>"; } else { query.ViewXml = @"<View> <Query> <Where> <And> <Eq> <FieldRef Name='Status' /> <Value Type='Text'>" + FormStatus.COMPLETED + @"</Value> </Eq> <Eq> <FieldRef Name='IsDCNGenerated' /> <Value Type='Boolean'>0</Value> </Eq> </And> </Where> </Query> </View>"; } // query.ViewXml = @"<View><ViewFields><FieldRef Name='ID' /><FieldRef Name='DCRNo' /><FieldRef Name='ProductName' /><FieldRef Name='RequestDate' /><FieldRef Name='ProposedBy' /></ViewFields></View>"; ListItemCollection items = spList.GetItems(query); this.context.Load(items); this.context.ExecuteQuery(); if (items != null && items.Count != 0) { foreach (ListItem item in items) { DCRDetails dcr = new DCRDetails(); dcr.DCRNo = Convert.ToString(item["DCRNo"]); dcr.ID = item.Id; FieldUserValue user = item["ProposedBy"] as FieldUserValue; dcr.ProposedBy = BELDataAccessLayer.GetNameFromPersonField(context, web, user); dcr.ProductName = Convert.ToString(item["ProductName"]); dcr.RequestDate = Convert.ToDateTime(item["RequestDate"]); dcrs.Add(dcr); } } return(dcrs); }
public DCRDetails RetrieveDCRNoDetails(IDictionary <string, string> objDict) { DCRForDCNContract contract = new DCRForDCNContract(); DCRDetails dcrdetails = new DCRDetails(); if (objDict != null) { string formName = objDict["FormName"]; int itemId = Convert.ToInt32(objDict["ItemId"]); string userEmail = objDict["UserEmail"]; //contract.UserDetails = BELDataAccessLayer.Instance.GetUserInformation(userEmail); IForm dcrForm = new DCRForDCNForm(true); dcrForm = BELDataAccessLayer.Instance.GetFormData(this.context, this.web, ApplicationNameConstants.DCRAPP, formName, itemId, userEmail, dcrForm); if (dcrForm != null && dcrForm.SectionsList != null && dcrForm.SectionsList.Count > 0) { contract.Forms.Add(dcrForm); } if (contract.Forms != null && contract.Forms.Count > 0) { var form = contract.Forms.FirstOrDefault(); if (form != null) { var dcrdetail = form.SectionsList.FirstOrDefault(f => f.SectionName.Equals(DCRSectionName.DCRDETAILSECTION)); var dcrSection = dcrdetail as DCRDetailsSection; var dcrapproval = form.SectionsList.FirstOrDefault(f => f.SectionName.Equals(SectionNameConstant.APPLICATIONSTATUS)) as ApplicationStatusSection; var app = dcrapproval.ApplicationStatusList; dcrdetails.DCRNo = dcrSection.DCRNo; dcrdetails.DCRID = itemId; dcrdetails.RequestDepartment = dcrSection.Department; dcrdetails.ProductName = dcrSection.ProductName; dcrdetails.ProposedBy = dcrSection.ProposedBy; dcrdetails.ProposedByName = dcrSection.ProposedByName; dcrdetails.DesignEngineer = dcrSection.FinalDesignEngineer; dcrdetails.DesignEngineerName = dcrSection.FinalDesignEngineerName; app.ForEach(p => { if (p.Role == DCRRoles.QAINCHARGE) { dcrdetails.QAIncharge = p.Approver; dcrdetails.QAInchargeName = p.ApproverName; } if (p.Role == DCRRoles.SCMINCHARGE) { dcrdetails.SCMIncharge = dcrdetails.SCMIncharge + "," + p.Approver; dcrdetails.SCMInchargeName = dcrdetails.SCMInchargeName + "," + p.ApproverName; } if (p.Role == DCRRoles.SCM) { dcrdetails.SCMIncharge = dcrdetails.SCMIncharge + "," + p.Approver; dcrdetails.SCMInchargeName = dcrdetails.SCMInchargeName + "," + p.ApproverName; } if (p.Role == DCRRoles.DCRPROCESSINCHARGE) { dcrdetails.DCRProcessIncharge = p.Approver; dcrdetails.DCRProcessInchargeName = p.ApproverName; } if (p.Role == DCRRoles.CCINCHARGE) { dcrdetails.CCIncharge = p.Approver; dcrdetails.CCInchargeName = p.ApproverName; } //if (p.Role == DCRRoles.DESIGNENGINEERINCHARGE) //{ // dcrdetails.DesignEngineer = p.Approver; // dcrdetails.DesignEngineerName = Convert.ToString(p.ApproverName); //} if (p.Role == DCRRoles.DESIGNDEVELOPENGINEER) { //dcrdetails.DesignEngineer = dcrdetails.DesignEngineer + "," + p.Approver; //dcrdetails.DesignEngineerName = dcrdetails.DesignEngineerName + "," + p.ApproverName; } if (p.Role == DCRRoles.DESIGNENGINEERINCHARGE) { dcrdetails.DesignEngineerIncharge = p.Approver; dcrdetails.DesignEngineerInchargeName = p.ApproverName; } if (p.Role == DCRRoles.KAPMARKETINGINCHARGE) { dcrdetails.KAPMarketingIncharge = Convert.ToString(p.Approver); dcrdetails.KAPMarketingInchargeName = Convert.ToString(p.ApproverName); } if (p.Role == DCRRoles.DAPMARKETINGINCHARGE) { dcrdetails.DAPMarketingIncharge = Convert.ToString(p.Approver); dcrdetails.DAPMarketingInchargeName = Convert.ToString(p.ApproverName); } if (p.Role == DCRRoles.FANSMARKETINGINCHARGE) { dcrdetails.FANSMarketingIncharge = Convert.ToString(p.Approver); dcrdetails.FANSMarketingInchargeName = Convert.ToString(p.ApproverName); } if (p.Role == DCRRoles.LIGHTINGMARKETINGINCHARGE) { dcrdetails.LightingMarketingIncharge = Convert.ToString(p.Approver); dcrdetails.LightingMarketingInchargeName = Convert.ToString(p.ApproverName); } if (p.Role == DCRRoles.MORPHYRICHARDSMARKETINGINCHARGE) { dcrdetails.MRMarketingIncharge = Convert.ToString(p.Approver); dcrdetails.MRMarketingInchargeName = Convert.ToString(p.ApproverName); } if (p.Role == DCRRoles.LUMMARKETINGINCHARGE) { dcrdetails.LUMMarketingIncharge = Convert.ToString(p.Approver); dcrdetails.LUMMarketingInchargeName = Convert.ToString(p.ApproverName); } }); string[] scmIncharge = !string.IsNullOrWhiteSpace(dcrdetails.SCMIncharge) ? dcrdetails.SCMIncharge.Trim(',').Split(',') : null; dcrdetails.SCMIncharge = (scmIncharge != null && scmIncharge.Length > 0) ? string.Join(",", scmIncharge.Distinct().ToArray()) : string.Empty; string[] scmInchargename = !string.IsNullOrWhiteSpace(dcrdetails.SCMInchargeName) ? dcrdetails.SCMInchargeName.Trim(',').Split(',') : null; dcrdetails.SCMInchargeName = (scmInchargename != null && scmInchargename.Length > 0) ? string.Join(",", scmInchargename.Distinct().ToArray()) : string.Empty; string designengineer = !string.IsNullOrWhiteSpace(dcrdetails.DesignEngineer) ? dcrdetails.DesignEngineer.Trim() : string.Empty; dcrdetails.DesignEngineer = designengineer; // string.Join(",", designengineer.Distinct().ToArray()); string designengineername = !string.IsNullOrWhiteSpace(dcrdetails.DesignEngineerName) ? dcrdetails.DesignEngineerName.Trim() : string.Empty; dcrdetails.DesignEngineerName = designengineername; //string.Join(",", designengineername.Distinct().ToArray()); var scrdetail = form.SectionsList.FirstOrDefault(f => f.SectionName.Equals(DCRSectionName.SCMINCHARGESECTION)); var scrdetails = scrdetail as VendorDCRSection; if (scrdetails != null) { dcrdetails.VendorDCRList = new List <ITrans>(); foreach (Vendor vendor in scrdetails.VendorDCRList) { VendorDCN vendorDCN = new VendorDCN(); vendorDCN.DateOfImplementation = vendor.DateOfImplementation; vendorDCN.ID = vendor.ID; vendorDCN.RequestBy = vendor.RequestBy; vendorDCN.RequestDate = vendor.RequestDate; vendorDCN.VendorName = vendor.VendorName; vendorDCN.Quantity = vendor.Quantity; vendorDCN.FGStock = vendor.FGStock; vendorDCN.ExistingComponentStock = vendor.ExistingComponentStock; dcrdetails.VendorDCRList.Add(vendorDCN); } } } } } return(dcrdetails); }
public DCRDetails RetrieveDCRNoDetails(IDictionary <string, string> objDict) { DCRDetails dcrdetail = DCNBusinessLayer.Instance.RetrieveDCRNoDetails(objDict); return(dcrdetail); }