Beispiel #1
0
        public async Task <IActionResult> Create([Bind("Id,Name")] JewelrySet jewelrySet)
        {
            if (Account.isAdmin(User))
            {
                if (ModelState.IsValid)
                {
                    _context.Add(jewelrySet);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
                return(View(jewelrySet));
            }
            else
            {
                return(new RedirectToActionResult("NotAuthorized", "Home", null));
            }
        }
Beispiel #2
0
        // Add Answer to associated ItemAttribute
        private void AddAttributeAnswer(int iRowIndex, int iAttributeCode, string sValueOfControl)
        {
            if (iRowIndex >= Jewelry.Count)
            {
                JewelrySet newJewelrySet = new JewelrySet();
                newJewelrySet.CaccLevel           = Jewelry[0].CaccLevel;
                newJewelrySet.Category            = Jewelry[0].Category;
                newJewelrySet.CategoryDescription = Jewelry[0].CategoryDescription;
                newJewelrySet.ItemAttributeList   = new List <ItemAttribute>();

                for (int i = 0; i < Jewelry[0].ItemAttributeList.Count; i++)
                {
                    ItemAttribute newItemAttribute = new ItemAttribute();
                    newItemAttribute.AnswerList              = Jewelry[0].ItemAttributeList[i].AnswerList;
                    newItemAttribute.AttributeCode           = Jewelry[0].ItemAttributeList[i].AttributeCode;
                    newItemAttribute.Description             = Jewelry[0].ItemAttributeList[i].Description;
                    newItemAttribute.DescriptionOrder        = Jewelry[0].ItemAttributeList[i].DescriptionOrder;
                    newItemAttribute.InputControl            = Jewelry[0].ItemAttributeList[i].InputControl;
                    newItemAttribute.InputType               = Jewelry[0].ItemAttributeList[i].InputType;
                    newItemAttribute.IsIncludedInDescription = Jewelry[0].ItemAttributeList[i].IsIncludedInDescription;
                    newItemAttribute.IsPreAnswered           = Jewelry[0].ItemAttributeList[i].IsPreAnswered;
                    newItemAttribute.IsRequired              = Jewelry[0].ItemAttributeList[i].IsRequired;
                    newItemAttribute.IsRestricted            = Jewelry[0].ItemAttributeList[i].IsRestricted;
                    newItemAttribute.LoanOrder               = Jewelry[0].ItemAttributeList[i].LoanOrder;
                    newItemAttribute.MaskDefault             = Jewelry[0].ItemAttributeList[i].MaskDefault;
                    newItemAttribute.MaskLevel               = Jewelry[0].ItemAttributeList[i].MaskLevel;
                    newItemAttribute.MaskOrder               = Jewelry[0].ItemAttributeList[i].MaskOrder;
                    newItemAttribute.PFIOrder           = Jewelry[0].ItemAttributeList[i].PFIOrder;
                    newItemAttribute.Prefix             = Jewelry[0].ItemAttributeList[i].Prefix;
                    newItemAttribute.Suffix             = Jewelry[0].ItemAttributeList[i].Suffix;
                    newItemAttribute.ValidationDataType = Jewelry[0].ItemAttributeList[i].ValidationDataType;
                    newJewelrySet.ItemAttributeList.Add(newItemAttribute);
                }
                Jewelry.Add(newJewelrySet);
            }

            ItemAttribute attributeFind = Jewelry[iRowIndex].ItemAttributeList.Find(delegate(ItemAttribute att)
            {
                return(att.AttributeCode == iAttributeCode);
            });

            int iAttributeIndex = Jewelry[iRowIndex].ItemAttributeList.FindIndex(delegate(ItemAttribute att)
            {
                return(att.AttributeCode == iAttributeCode);
            });
            Answer newAnswer = Jewelry[iRowIndex].ItemAttributeList[iAttributeIndex].Answer;
            Answer attributeAnswer;

            if (Jewelry[iRowIndex].ItemAttributeList[iAttributeIndex].AnswerList != null && Jewelry[iRowIndex].ItemAttributeList[iAttributeIndex].AnswerList.Count > 0)
            {
                attributeAnswer = Jewelry[iRowIndex].ItemAttributeList[iAttributeIndex].AnswerList.Find(
                    a => a.AnswerText == sValueOfControl);

                //SMurphy AnswerCode should remain 0 - but only for stone
                if (Jewelry[iRowIndex].ItemAttributeList[iAttributeIndex].Description.Contains("Color"))
                {
                    newAnswer.AnswerCode = attributeAnswer.AnswerCode;
                }
                else
                {
                    newAnswer.AnswerCode = attributeAnswer.AnswerCode == 0 ? 999 : attributeAnswer.AnswerCode;
                }
            }
            else
            {
                newAnswer.AnswerCode = 999;
            }

            newAnswer.AnswerText = sValueOfControl;
            newAnswer.InputKey   = null;
            newAnswer.OutputKey  = null;

            attributeFind.Answer = newAnswer;
            if (iRowIndex < Jewelry.Count)
            {
                Jewelry[iRowIndex].ItemAttributeList.RemoveAt(iAttributeIndex);
                Jewelry[iRowIndex].ItemAttributeList.Insert(iAttributeIndex, attributeFind);
            }
        }
Beispiel #3
0
        public static void PawnItemMerge(ref Item pawnItemStored, Item pawnItemDefaults, bool bIsReadOnly)
        {
            if (pawnItemStored.Attributes != null)
            {
                foreach (ItemAttribute itemAttribute in pawnItemStored.Attributes)
                {
                    Answer answerSaved = itemAttribute.Answer;

                    int iDx = pawnItemDefaults.Attributes.FindIndex(delegate(ItemAttribute i)
                    {
                        return(i.MaskOrder == itemAttribute.MaskOrder);
                    });

                    if (iDx >= 0)
                    {
                        ItemAttribute foundItemAttribute = pawnItemDefaults.Attributes[iDx];
                        foundItemAttribute.Answer = answerSaved;
                        if (bIsReadOnly)
                        {
                            foundItemAttribute.IsPreAnswered = true;
                        }
                        else
                        {
                            foundItemAttribute.IsPreAnswered = (foundItemAttribute.AttributeCode == 1 ||
                                                                foundItemAttribute.AttributeCode == 3 ||
                                                                Utilities.GetStringValue(foundItemAttribute.Description).ToLower().EndsWith("manufacturer") ||
                                                                Utilities.GetStringValue(foundItemAttribute.Description).ToLower().EndsWith("mfg.") ||
                                                                Utilities.GetStringValue(foundItemAttribute.Description).ToLower().EndsWith("mfgr") ||
                                                                Utilities.GetStringValue(foundItemAttribute.Description).ToLower().EndsWith("model")
                                                                );
                        }
                        pawnItemDefaults.Attributes.RemoveAt(iDx);
                        pawnItemDefaults.Attributes.Insert(iDx, foundItemAttribute);
                    }
                }
            }

            pawnItemDefaults.CaccLevel           = pawnItemStored.CaccLevel;
            pawnItemDefaults.CategoryCode        = pawnItemStored.CategoryCode;
            pawnItemDefaults.CategoryDescription = pawnItemStored.CategoryDescription;
//            pawnItemDefaults.CategoryMask = pawnItemStored.CategoryMask;
            pawnItemDefaults.PfiDate    = pawnItemStored.PfiDate;
            pawnItemDefaults.Comment    = pawnItemStored.Comment;
            pawnItemDefaults.HasGunLock = pawnItemStored.HasGunLock;
            pawnItemDefaults.HoldDesc   = pawnItemStored.HoldDesc;
            pawnItemDefaults.HoldType   = pawnItemStored.HoldType;
            pawnItemDefaults.Icn        = pawnItemStored.Icn;
            pawnItemDefaults.IsGun      = pawnItemStored.IsGun;
            pawnItemDefaults.GunNumber  = pawnItemStored.GunNumber;
            pawnItemDefaults.IsJewelry  = pawnItemStored.IsJewelry;
            pawnItemDefaults.Tag        = pawnItemStored.Tag;
            pawnItemDefaults.PfiAmount  = pawnItemStored.PfiAmount;//10.7 NAM:Added this line of code to cater for BZ 1290

            if (pawnItemStored.Jewelry != null)
            {
                if (pawnItemDefaults.Jewelry == null)
                {
                    pawnItemDefaults.Jewelry = new List <JewelrySet>();
                }

                for (int i = 0; i < pawnItemStored.Jewelry.Count; i++)
                {
                    if (i > 0)
                    {
                        pawnItemDefaults.Jewelry.Add(pawnItemDefaults.Jewelry[0]);
                    }

                    JewelrySet           jewelrySet        = new JewelrySet();//pawnItemDefaults.Jewelry[i];
                    List <ItemAttribute> itemAttributeList = new List <ItemAttribute>();
                    if (i > 0)
                    {
                        for (int k = 0; k < pawnItemDefaults.Jewelry[0].ItemAttributeList.Count; ++k)
                        {
                            ItemAttribute itemAttribute = new ItemAttribute();
                            itemAttribute.IsIncludedInDescription = pawnItemDefaults.Jewelry[0].ItemAttributeList.ElementAt(k).IsIncludedInDescription;
                            itemAttribute.Description             = pawnItemDefaults.Jewelry[0].ItemAttributeList.ElementAt(k).Description;
                            itemAttribute.AttributeCode           = pawnItemDefaults.Jewelry[0].ItemAttributeList.ElementAt(k).AttributeCode;
                            itemAttribute.MaskOrder = pawnItemDefaults.Jewelry[0].ItemAttributeList.ElementAt(k).MaskOrder;
                            itemAttributeList.Add(itemAttribute);
                        }
                        jewelrySet.ItemAttributeList = itemAttributeList;//pawnItemDefaults.Jewelry[0].ItemAttributeList;
                    }
                    else
                    {
                        jewelrySet.ItemAttributeList = pawnItemDefaults.Jewelry[0].ItemAttributeList;
                    }

                    jewelrySet.CaccLevel           = pawnItemStored.Jewelry[i].CaccLevel;
                    jewelrySet.Category            = pawnItemStored.Jewelry[i].Category;
                    jewelrySet.CategoryDescription = pawnItemStored.Jewelry[i].CategoryDescription;
                    jewelrySet.Icn               = pawnItemStored.Jewelry[i].Icn;
                    jewelrySet.SubItemNumber     = pawnItemStored.Jewelry[i].SubItemNumber;
                    jewelrySet.TicketDescription = pawnItemStored.Jewelry[i].TicketDescription;
                    jewelrySet.TotalStoneValue   = pawnItemStored.Jewelry[i].TotalStoneValue;

                    pawnItemDefaults.Jewelry.RemoveAt(i);
                    pawnItemDefaults.Jewelry.Insert(i, jewelrySet);

                    foreach (ItemAttribute itemAttribute in pawnItemStored.Jewelry[i].ItemAttributeList)
                    {
                        Answer answerSaved = itemAttribute.Answer;

                        int iDx = pawnItemDefaults.Jewelry[0].ItemAttributeList.FindIndex(delegate(ItemAttribute ia)
                        {
                            return(ia.MaskOrder == itemAttribute.MaskOrder);
                        });

                        if (iDx >= 0)
                        {
                            ItemAttribute foundItemAttribute = pawnItemDefaults.Jewelry[i].ItemAttributeList[iDx];
                            foundItemAttribute.Answer = answerSaved;
                            pawnItemDefaults.Jewelry[i].ItemAttributeList.RemoveAt(iDx);
                            pawnItemDefaults.Jewelry[i].ItemAttributeList.Insert(iDx, foundItemAttribute);
                        }
                    }
                }
            }

            pawnItemDefaults.ItemReason          = pawnItemStored.ItemReason;
            pawnItemDefaults.ItemAmount          = pawnItemStored.ItemAmount;
            pawnItemDefaults.ItemAmount_Original = pawnItemStored.ItemAmount_Original;
            pawnItemDefaults.Location            = pawnItemStored.Location;
            pawnItemDefaults.Location_Aisle      = pawnItemStored.Location_Aisle;
            pawnItemDefaults.Location_Assigned   = pawnItemStored.Location_Assigned;
            pawnItemDefaults.Location_Shelf      = pawnItemStored.Location_Shelf;
            pawnItemDefaults.mDocNumber          = pawnItemStored.mDocNumber;
            pawnItemDefaults.mDocType            = pawnItemStored.mDocType;
            //          pawnItemDefaults.MerchandiseType = pawnItemStored.MerchandiseType;
            pawnItemDefaults.mItemOrder           = pawnItemStored.mItemOrder;
            pawnItemDefaults.mStore               = pawnItemStored.mStore;
            pawnItemDefaults.mYear                = pawnItemStored.mYear;
            pawnItemDefaults.QuickInformation     = pawnItemStored.QuickInformation;
            pawnItemDefaults.SelectedProKnowMatch = pawnItemStored.SelectedProKnowMatch;
            pawnItemDefaults.ItemStatus           = pawnItemStored.ItemStatus;
            pawnItemDefaults.PfiAssignmentType    = pawnItemStored.PfiAssignmentType;
            pawnItemDefaults.PfiTags              = pawnItemStored.PfiTags;
            pawnItemDefaults.PfiVerified          = pawnItemStored.PfiVerified;
            pawnItemDefaults.QuickInformation     = pawnItemStored.QuickInformation;
            pawnItemDefaults.RefurbNumber         = pawnItemStored.RefurbNumber;
            pawnItemDefaults.RetailPrice          = pawnItemStored.RetailPrice;
            pawnItemDefaults.SelectedProKnowMatch = pawnItemStored.SelectedProKnowMatch;
            pawnItemDefaults.StatusDate           = pawnItemStored.StatusDate;
            pawnItemDefaults.StorageFee           = pawnItemStored.StorageFee;
            pawnItemDefaults.TempStatus           = pawnItemStored.TempStatus;
            pawnItemDefaults.TicketDescription    = pawnItemStored.TicketDescription;
            pawnItemDefaults.TotalLoanGoldValue   = pawnItemStored.TotalLoanGoldValue;
            pawnItemDefaults.TotalLoanStoneValue  = pawnItemStored.TotalLoanStoneValue;

            pawnItemStored = pawnItemDefaults;
        }
        /// <summary>
        /// Retrieves the data from the database
        /// </summary>
        /// <param name="iMaskPointer"></param>
        /// <param name="iCategoryCode"></param>
        /// <returns></returns>
        public DescribedMerchandise(int iMaskPointer)
        {
            Exists       = false;
            Error        = false;
            ErrorMessage = "";
            MaskLevel    = iMaskPointer;

            if (iMaskPointer == 0)
            {
                Error        = true;
                ErrorMessage = "Valid MaskPointer was not passed by calling Method.";
            }

            try
            {
                DataSet generalCategoryDataSet = new DataSet(MerchandiseProcedures.GENERAL);

                DataTable dtCategory = new DataTable(MerchandiseProcedures.CAT_GENERAL);
                DataTable dtMasks    = new DataTable(MerchandiseProcedures.CAT_MASK_GENERAL);
                DataTable dtAttribs  = new DataTable(MerchandiseProcedures.CAT_MASK_ATTR_GENERAL);
                DataTable dtAva      = new DataTable(MerchandiseProcedures.CAT_MASK_ATTR_AVA_GENERAL);
                DataTable dtAnswers  = new DataTable(MerchandiseProcedures.CAT_MASK_ATTR_AVA_ANSWER_GENERAL);

                DataTable dtCategory_Jewelry = new DataTable(MerchandiseProcedures.CAT_JEWELRY);
                DataTable dtMasks_Jewelry    = new DataTable(MerchandiseProcedures.CAT_MASK_JEWELRY);
                DataTable dtAttribs_Jewelry  = new DataTable(MerchandiseProcedures.CAT_MASK_ATTR_JEWELRY);
                DataTable dtAva_Jewelry      = new DataTable(MerchandiseProcedures.CAT_MASK_ATTR_AVA_JEWELRY);
                DataTable dtAnswers_Jewelry  = new DataTable(MerchandiseProcedures.CAT_MASK_ATTR_AVA_ANSWER_JEWELRY);

                //[FTN:  3.c]       Create ItemAttribute and Populate
                SelectedPawnItem = new Item();
                bool   bHasJewelry   = false;
                string sErrorCode    = "";
                string sErrorMessage = "";

                // Call to class for CAT5 Stored Procedure
                if (MerchandiseProcedures.ExecuteGetCat5Info(MaskLevel, out generalCategoryDataSet, out bHasJewelry, out sErrorCode, out sErrorMessage))
                {
                    if (sErrorCode != "")
                    {
                        dtCategory = generalCategoryDataSet.Tables[MerchandiseProcedures.CAT_GENERAL];
                        dtMasks    = generalCategoryDataSet.Tables[MerchandiseProcedures.CAT_MASK_GENERAL];
                        dtAttribs  = generalCategoryDataSet.Tables[MerchandiseProcedures.CAT_MASK_ATTR_GENERAL];
                        dtAva      = generalCategoryDataSet.Tables[MerchandiseProcedures.CAT_MASK_ATTR_AVA_GENERAL];
                        dtAnswers  = generalCategoryDataSet.Tables[MerchandiseProcedures.CAT_MASK_ATTR_AVA_ANSWER_GENERAL];

                        if (bHasJewelry)
                        {
                            dtCategory_Jewelry = generalCategoryDataSet.Tables[MerchandiseProcedures.CAT_JEWELRY];
                            dtMasks_Jewelry    = generalCategoryDataSet.Tables[MerchandiseProcedures.CAT_MASK_JEWELRY];
                            dtAttribs_Jewelry  = generalCategoryDataSet.Tables[MerchandiseProcedures.CAT_MASK_ATTR_JEWELRY];
                            dtAva_Jewelry      = generalCategoryDataSet.Tables[MerchandiseProcedures.CAT_MASK_ATTR_AVA_JEWELRY];
                            dtAnswers_Jewelry  = generalCategoryDataSet.Tables[MerchandiseProcedures.CAT_MASK_ATTR_AVA_ANSWER_JEWELRY];
                        }

                        if (dtCategory != null)
                        {
                            SelectedPawnItem.CategoryMask        = Utilities.GetIntegerValue(dtCategory.Rows[0]["MASK_POINTER"], 0);
                            SelectedPawnItem.CategoryDescription = Utilities.GetStringValue(dtCategory.Rows[0]["CAT_DESC2"]);
                            SelectedPawnItem.CaccLevel           = Utilities.GetIntegerValue(dtCategory.Rows[0]["CACC_LEV"], -1);
                            SelectedPawnItem.IsJewelry           = bHasJewelry;
                            SelectedPawnItem.MerchandiseType     = Utilities.GetStringValue(dtCategory.Rows[0]["MD_TYPE"]);
                        }

                        //[FTN:  3.c.v]     Create new ItemAttribute List
                        SelectedPawnItem.Attributes = new List <ItemAttribute>();

                        #region FTN 3.e
                        if (dtMasks != null)
                        {
                            foreach (DataRow drMaskRow in dtMasks.Rows)
                            {
                                //[FTN:  3.e.i]             Create ItemAttribute and Populate
                                ItemAttribute maskItemAttribute = new ItemAttribute();
                                maskItemAttribute.AttributeCode           = Utilities.GetIntegerValue(drMaskRow["ATTRIBUTE"], 0);
                                maskItemAttribute.DescriptionOrder        = Utilities.GetIntegerValue(drMaskRow["DESC_SEQ"], 0);
                                maskItemAttribute.LoanOrder               = Utilities.GetIntegerValue(drMaskRow["LOAN_SEQ"], 0);
                                maskItemAttribute.MaskLevel               = Utilities.GetIntegerValue(drMaskRow["MASK_LEVEL"], 0);
                                maskItemAttribute.MaskOrder               = Utilities.GetIntegerValue(drMaskRow["MASK_SEQ"], 0);
                                maskItemAttribute.MaskDefault             = Utilities.GetStringValue(drMaskRow["MASK_DEFAULT"]);
                                maskItemAttribute.IsPreAnswered           = false;
                                maskItemAttribute.ValidationDataType      = Utilities.GetStringValue(drMaskRow["ANSWER_TYPE"]);
                                maskItemAttribute.IsIncludedInDescription = Utilities.GetStringValue(drMaskRow["INCL_DESC"]) == "Y" ? true : false;
                                maskItemAttribute.IsRequired              = Utilities.GetStringValue(drMaskRow["ANS_REQUIRED"]) == "Y" ? true : false;
                                maskItemAttribute.IsRestricted            = Utilities.GetStringValue(drMaskRow["ANS_RESTRICT"]) == "Y" ? true : false;

                                if (dtAttribs != null)
                                {
                                    //[FTN:  3.e.i.13]              Retrieve Attribute Description
                                    DataRow[] drsGeneralAttribs = dtAttribs.Select("ATTR_ID=" + maskItemAttribute.AttributeCode.ToString());

                                    if (drsGeneralAttribs.Length > 0)
                                    {
                                        maskItemAttribute.Description = Utilities.GetStringValue(drsGeneralAttribs[0]["ATTR_DESC"]);
                                        maskItemAttribute.Prefix      = Utilities.GetStringValue(drsGeneralAttribs[0]["PREFIX"]);
                                        maskItemAttribute.Suffix      = Utilities.GetStringValue(drsGeneralAttribs[0]["SUFFIX"]);
                                        maskItemAttribute.InputType   = Utilities.GetStringValue(drsGeneralAttribs[0]["INPUT_TYPE"]);
                                        maskItemAttribute.MdseField   = Utilities.GetCharValue(drsGeneralAttribs[0]["MDSE_FIELD"], ' ');

                                        //[FTN:  3.e.i.14]                      Create List<Answer> to populate from AVA Table
                                        maskItemAttribute.AnswerList = new List <Answer>();

                                        if (dtAva != null)
                                        {
                                            //[FTN:  3.e.i.15]                      Filter to only matching Answers.
                                            DataRow[] drsAvaTable = dtAva.Select("CATG=" + SelectedPawnItem.CategoryMask.ToString() + " AND ATTR_ID=" + maskItemAttribute.AttributeCode.ToString());

                                            foreach (DataRow drAvaTable in drsAvaTable)
                                            {
                                                //[FTN:  3.e.i.15.a]                        Create Answer object and populate
                                                Answer attributeAnswer = new Answer();
                                                attributeAnswer.AnswerCode   = Utilities.GetIntegerValue(drAvaTable["ANS_ID"], 0);
                                                attributeAnswer.DisplayOrder = Utilities.GetIntegerValue(drAvaTable["DISP_SORT"], 0);

                                                if (dtAnswers != null)
                                                {
                                                    //[FTN:  3.e.i.15.b]                            Filter to only matching Answer Code record from ANSWERS
                                                    DataRow[] drsAnswerTable = dtAnswers.Select("ANS_ID=" + attributeAnswer.AnswerCode.ToString());

                                                    if (drsAnswerTable.Length > 0)
                                                    {
                                                        attributeAnswer.AnswerText = Utilities.GetStringValue(drsAnswerTable[0]["ANS_DESC"]);
                                                        attributeAnswer.InputKey   = Utilities.GetStringValue(drsAnswerTable[0]["INPUT_KEY"]);
                                                        attributeAnswer.OutputKey  = Utilities.GetStringValue(drsAnswerTable[0]["OUTPUT_KEY"]);
                                                    }
                                                }
                                                //[FTN:  3.e.i.15.c]                        Add attributeAnswer to ItemAttribute
                                                maskItemAttribute.AnswerList.Add(attributeAnswer);
                                            }
                                        }
                                    }
                                }

                                //[FTN:  3.e.i.12]          Assign Control Type
                                if (maskItemAttribute.AnswerList.Count == 0 && !maskItemAttribute.IsRestricted)
                                {
                                    maskItemAttribute.InputControl = ControlType.TEXTFIELD;
                                }
                                else if (maskItemAttribute.AnswerList.Count > 0 && !maskItemAttribute.IsRestricted)
                                {
                                    maskItemAttribute.InputControl = ControlType.COMBOBOX_TEXT_ENABLED;
                                }
                                else if (maskItemAttribute.AnswerList.Count > 0 && maskItemAttribute.IsRestricted)
                                {
                                    maskItemAttribute.InputControl = ControlType.COMBOBOX_ONLY;
                                }

                                //[FTN:  3.e.ii]            Add maskItemAttribute to PawnItem
                                SelectedPawnItem.Attributes.Add(maskItemAttribute);
                            }
                        }
                        #endregion

                        #region FTN 3.f
                        if (SelectedPawnItem.IsJewelry)
                        {
                            SelectedPawnItem.Jewelry = new List <JewelrySet>();
                            JewelrySet itemJewelrySet = new JewelrySet();

                            if (dtCategory_Jewelry != null)
                            {
                                itemJewelrySet.Category            = Utilities.GetIntegerValue(dtCategory_Jewelry.Rows[0]["MASK_POINTER"], 0);
                                itemJewelrySet.CategoryDescription = Utilities.GetStringValue(dtCategory_Jewelry.Rows[0]["CAT_DESC2"]);
                                itemJewelrySet.CaccLevel           = Utilities.GetIntegerValue(dtCategory_Jewelry.Rows[0]["CACC_LEV"], -1);
                            }

                            itemJewelrySet.ItemAttributeList = new List <ItemAttribute>();

                            foreach (DataRow drMask_JewelryRow in dtMasks_Jewelry.Rows)
                            {
                                //[FTN:  3.f.ii.1]                      Create ItemAttribute and Populate
                                ItemAttribute maskItemAttribute = new ItemAttribute();
                                maskItemAttribute.AttributeCode           = Utilities.GetIntegerValue(drMask_JewelryRow["ATTRIBUTE"], 0);
                                maskItemAttribute.DescriptionOrder        = Utilities.GetIntegerValue(drMask_JewelryRow["DESC_SEQ"], 0);
                                maskItemAttribute.LoanOrder               = Utilities.GetIntegerValue(drMask_JewelryRow["LOAN_SEQ"], 0);
                                maskItemAttribute.MaskLevel               = Utilities.GetIntegerValue(drMask_JewelryRow["MASK_LEVEL"], 0);
                                maskItemAttribute.MaskOrder               = Utilities.GetIntegerValue(drMask_JewelryRow["MASK_SEQ"], 0);
                                maskItemAttribute.MaskDefault             = Utilities.GetStringValue(drMask_JewelryRow["MASK_DEFAULT"]);
                                maskItemAttribute.ValidationDataType      = Utilities.GetStringValue(drMask_JewelryRow["ANSWER_TYPE"]);
                                maskItemAttribute.IsIncludedInDescription = Utilities.GetStringValue(drMask_JewelryRow["INCL_DESC"]) == "Y" ? true : false;
                                maskItemAttribute.IsRequired              = Utilities.GetStringValue(drMask_JewelryRow["ANS_REQUIRED"]) == "Y" ? true : false;
                                maskItemAttribute.IsRestricted            = Utilities.GetStringValue(drMask_JewelryRow["ANS_RESTRICT"]) == "Y" ? true : false;

                                if (dtAttribs_Jewelry != null)
                                {
                                    //[FTN:  3.f.ii.2]                  Retrieve Attribute Description
                                    DataRow[] drsGeneralAttribs = dtAttribs_Jewelry.Select("ATTR_ID=" + maskItemAttribute.AttributeCode.ToString());

                                    if (drsGeneralAttribs.Length > 0)
                                    {
                                        maskItemAttribute.Description = Utilities.GetStringValue(drsGeneralAttribs[0]["ATTR_DESC"]);
                                        maskItemAttribute.Prefix      = Utilities.GetStringValue(drsGeneralAttribs[0]["PREFIX"]);
                                        maskItemAttribute.Suffix      = Utilities.GetStringValue(drsGeneralAttribs[0]["SUFFIX"]);
                                        maskItemAttribute.InputType   = Utilities.GetStringValue(drsGeneralAttribs[0]["INPUT_TYPE"]);
                                        maskItemAttribute.MdseField   = Utilities.GetCharValue(drsGeneralAttribs[0]["MDSE_FIELD"], ' ');

                                        //[FTN:  3.f.ii.3]                      Create List<Answer> to populate from AVA Table
                                        maskItemAttribute.AnswerList = new List <Answer>();

                                        if (dtAva_Jewelry != null)
                                        {
                                            //[FTN:  3.f.ii.4]                      Filter to only matching Answers.
                                            DataRow[] drsAvaTable = dtAva_Jewelry.Select("CATG=" + itemJewelrySet.Category.ToString() + " AND ATTR_ID=" + maskItemAttribute.AttributeCode.ToString());

                                            foreach (DataRow drAvaTable in drsAvaTable)
                                            {
                                                //[FTN:  3.f.ii.4.a]                        Create Answer object and populate
                                                Answer attributeAnswer = new Answer();
                                                attributeAnswer.AnswerCode   = Utilities.GetIntegerValue(drAvaTable["ANS_ID"], 0);
                                                attributeAnswer.DisplayOrder = Utilities.GetIntegerValue(drAvaTable["DISP_SORT"], 0);

                                                if (dtAnswers_Jewelry != null)
                                                {
                                                    //[FTN:  3.f.ii.4.b]                            Filter to only matching Answer Code record from ANSWERS
                                                    DataRow[] drsAnswerTable = dtAnswers_Jewelry.Select("ANS_ID=" + attributeAnswer.AnswerCode.ToString());

                                                    if (drsAnswerTable.Length > 0)
                                                    {
                                                        attributeAnswer.AnswerText = Utilities.GetStringValue(drsAnswerTable[0]["ANS_DESC"]);
                                                        attributeAnswer.InputKey   = Utilities.GetStringValue(drsAnswerTable[0]["INPUT_KEY"]);
                                                        attributeAnswer.OutputKey  = Utilities.GetStringValue(drsAnswerTable[0]["OUTPUT_KEY"]);
                                                    }
                                                }
                                                //[FTN:  3.f.ii.4.c]                        Add attributeAnswer to ItemAttribute
                                                maskItemAttribute.AnswerList.Add(attributeAnswer);
                                            }
                                        }
                                    }
                                }

                                //[FTN:  3.f.ii.1.l...n]    Assign Control Type
                                if (maskItemAttribute.AnswerList.Count == 0 && !maskItemAttribute.IsRestricted)
                                {
                                    maskItemAttribute.InputControl = ControlType.TEXTFIELD;
                                }
                                else if (maskItemAttribute.AnswerList.Count > 0 && !maskItemAttribute.IsRestricted)
                                {
                                    maskItemAttribute.InputControl = ControlType.COMBOBOX_TEXT_ENABLED;
                                }
                                else if (maskItemAttribute.AnswerList.Count > 0 && maskItemAttribute.IsRestricted)
                                {
                                    maskItemAttribute.InputControl = ControlType.COMBOBOX_ONLY;
                                }

                                //[FTN:  3.f.iii]           Add maskItemAttribute to JewelrySet object
                                itemJewelrySet.ItemAttributeList.Add(maskItemAttribute);
                            }

                            //[FTN:  3.f.iv]        Add JewelrySet to PawnItem
                            SelectedPawnItem.Jewelry.Add(itemJewelrySet);
                        }
                        #endregion

                        SelectedPawnItem.PfiAssignmentType = SelectedPawnItem.IsJewelry ? PfiAssignment.Scrap : PfiAssignment.Normal;
                        SelectedPawnItem.IsGun             = Utilities.IsGun(SelectedPawnItem.GunNumber, SelectedPawnItem.CategoryMask, SelectedPawnItem.IsJewelry, SelectedPawnItem.MerchandiseType);

                        Exists = true;
                    }
                    else
                    {
                        Error        = true;
                        ErrorMessage = sErrorMessage + " [" + sErrorCode + "]";
                    }
                }
                else
                {
                    Error        = true;
                    ErrorMessage = sErrorMessage + " [" + sErrorCode + "]";
                }
            }
            catch (Exception exp)
            {
                Error        = true;
                ErrorMessage = exp.Message;
            }
        }