Пример #1
0
        private void CreateHeadersForTM(Required r, List <string> lstAttributes)
        {
            try
            {
                //Mapping table
                r.dtMappingTable.Columns.Add("Transaction ID");
                r.dtMappingTable.Columns.Add("Attributes");
                //TM Table
                r.dtTM.Columns.Add("Transaction ID");
                r.dtTM.Columns.Add("Test Condition ID");

                //Both Mapping & TM Table
                int i = 1;
                foreach (var att in lstAttributes)
                {
                    r.dtMappingTable.Columns.Add(att);
                    r.dtTM.Columns.Add(att);
                    r.dtTM.Columns.Add("isNegative" + i);
                    r.dtMappingTable.Columns.Add("isNegative" + i);
                    i++;
                }
                r.dtTM.Columns.Add("Test Condition Result");
                r.dtTM.Columns.Add("Business Rule ID");
                r.dtTM.Columns.Add("Interface ID");
                r.dtTM.Columns.Add("Channel Alert ID");
                r.dtTM.Columns.Add("Report ID");
                r.dtTM.Columns.Add("Validation 1");
                r.dtTM.Columns.Add("Validation 2");
                r.dtTM.Columns.Add("Validation 3");
                r.dtTM.Columns.Add("Validation 4");
                r.dtTM.Columns.Add("Validation 5");
                r.dtTM.Columns.Add("Logical Day");
                r.dtTM.Columns.Add("Batch Frequency");
                r.dtTM.Columns.Add("Gap Reference");
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #2
0
        private List <string> GetListofAttributesMapped(IList <sp_GetMappingViewModelData_Result> lstMappingViewModel, string txnID,
                                                        MappingViewModel mappingViewModel, Required r)
        {
            try
            {
                //dicAttributeValue = new Dictionary<string, IList<DA.DomainModel.tbl_AttributeValues>>();
                //dicCriticalAttributes = new Dictionary<string, int>();
                List <string> lstAttributes = new List <string>();

                var lstMapViewModel = from s in lstMappingViewModel
                                      where s.HIGHLEVELTXNID == txnID
                                      orderby s.ATTRIBUTEID ascending
                                      select s;

                foreach (var item in lstMapViewModel)
                {
                    lstAttributes.Add(item.ATTRIBUTEDESC);

                    if (!r.dicAttributeValue.Keys.Contains(item.ATTRIBUTEDESC))
                    {
                        switch (item.ATTRIBUTETYPEDESC)
                        {
                        case "Common":
                            r.dicCriticalAttributes.Add(item.ATTRIBUTEDESC, mappingViewModel.dicAttributesanditsValues[item.ATTRIBUTEDESC].Count());
                            break;

                        case "Common&Critical":
                            r.dicCriticalAttributes.Add(item.ATTRIBUTEDESC, mappingViewModel.dicAttributesanditsValues[item.ATTRIBUTEDESC].Count());
                            break;

                        default:
                            break;
                        }

                        r.dicAttributeValue.Add(item.ATTRIBUTEDESC, mappingViewModel.dicAttributesanditsValues[item.ATTRIBUTEDESC]);
                    }
                }



                return(lstAttributes);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #3
0
        private void GenerateMappingTable(IList <sp_GetMappingViewModelData_Result> lstMappingViewModel, Required r, List <string> lstAttributes,
                                          string txnID)
        {
            try
            {
                #region RowsForMappingTable
                for (int i = 0; i < 12; i++)
                {
                    DataRow dr = r.dtMappingTable.NewRow();

                    dr["Transaction ID"] = txnID;
                    dr["Attributes"]     = "Value" + (i + 1).ToString();//lstMappingViewModel[i].ATTRIBUTEDESC;

                    for (int k = 0; k < lstAttributes.Count; k++)
                    {
                        try
                        {
                            //Adding Row for Mapping table
                            dr[lstAttributes[k]]       = r.dicAttributeValue[lstAttributes[k]][i].AttributeValue;
                            dr["isNegative" + (k + 1)] = r.dicAttributeValue[lstAttributes[k]][i].isNegative;
                            //here also u need to update isNegative in dtMapping table, it is there in dicAttributeValue
                        }
                        catch (Exception ex)
                        {
                        }
                    }



                    r.dtMappingTable.Rows.Add(dr);
                }
                #endregion
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #4
0
        private int Callback(List <string> lstAttributes, int tmCount, string txnID, Required r)
        {
            try
            {
                #region RowsForTM

                int iCriticalAttributeCount = 1;
                int rowCount = 1;

                for (int k = 0; k < lstAttributes.Count; k++)
                {
                    if (r.dicCriticalAttributes.ContainsKey(lstAttributes[k]))
                    {
                        #region CriticalAttribute

                        IList <DA.DomainModel.tbl_AttributeValues> lstAttValues = new List <DA.DomainModel.tbl_AttributeValues>();
                        r.dicAttributeValue.TryGetValue(lstAttributes[k], out lstAttValues);

                        if (iCriticalAttributeCount > 1)
                        {
                            int valueRepeatCount, totalRepeat;
                            GetRepeatCount(tmCount, iCriticalAttributeCount, lstAttValues, out valueRepeatCount, out totalRepeat, r.dicCriticalAttributes);
                            int row = 0;

                            for (int m = 0; m < totalRepeat; m++)
                            {
                                foreach (var item in lstAttValues)
                                {
                                    for (int i = 0; i < valueRepeatCount; i++)
                                    {
                                        try
                                        {
                                            r.dtTM.Rows[row][lstAttributes[k]]       = item.AttributeValue;
                                            r.dtTM.Rows[row]["isNegative" + (k + 1)] = item.isNegative;
                                        }
                                        catch (Exception ex)
                                        {
                                        }

                                        row++;
                                    }
                                }
                            }
                        }
                        else
                        {
                            int repeatCount = tmCount / lstAttValues.Count;

                            foreach (var item in lstAttValues)
                            {
                                for (int i = 0; i < repeatCount; i++)
                                {
                                    DataRow dr = r.dtTM.NewRow();
                                    dr["Transaction ID"]        = txnID;
                                    dr["Test Condition ID"]     = txnID + "_TC_" + rowCount.ToString("D3");
                                    dr["Test Condition Result"] = "Positive";
                                    try
                                    {
                                        dr[lstAttributes[k]]       = item.AttributeValue;
                                        dr["isNegative" + (k + 1)] = item.isNegative;
                                    }
                                    catch (Exception ex)
                                    {
                                        dr[lstAttributes[k]] = "";
                                    }

                                    rowCount++;
                                    r.dtTM.Rows.Add(dr);
                                }
                            }
                        }

                        iCriticalAttributeCount++;
                        #endregion
                    }
                    else
                    {
                        #region CommonAttribute
                        IList <DA.DomainModel.tbl_AttributeValues> lstAttValues = new List <DA.DomainModel.tbl_AttributeValues>();
                        r.dicAttributeValue.TryGetValue(lstAttributes[k], out lstAttValues);

                        //to store positive value
                        Dictionary <string, string> dicpositiveVal = new Dictionary <string, string>();

                        int pCount = 0, nCount = 0;
                        for (int p = 0; p < lstAttValues.Count; p++)
                        {
                            if (lstAttValues[p].isNegative == "0")
                            {
                                pCount++;
                            }
                            else
                            {
                                nCount++;
                            }
                        }
                        for (int p = 0; p < lstAttValues.Count; p++)
                        {
                            if (pCount != 0 && nCount != 0)
                            {
                                if (lstAttValues[p].isNegative == "0" && pCount == 1)
                                {
                                    dicpositiveVal.Add(lstAttributes[k], lstAttValues[p].AttributeValue);
                                }
                            }
                        }



                        for (int i = 0; i < tmCount; i++)
                        {
                            try
                            {
                                //To repeat positive value in case of single positive and negative value
                                if (dicpositiveVal.Count != 0 && dicpositiveVal.ContainsKey(lstAttributes[k]))
                                {
                                    r.dtTM.Rows[i][lstAttributes[k]] = dicpositiveVal[lstAttributes[k]];
                                }
                                else
                                {
                                    if (lstAttValues[i].isNegative == "0")
                                    {
                                        r.dtTM.Rows[i][lstAttributes[k]] = lstAttValues[i].AttributeValue;
                                    }
                                    else
                                    {
                                        r.dtTM.Rows[i][lstAttributes[k]] = "Any";
                                    }
                                    //Here also you check if red color is required
                                }
                            }
                            catch (Exception ex)
                            {
                                r.dtTM.Rows[i][lstAttributes[k]] = "Any";
                            }
                        }
                        #endregion
                    }
                }

                #endregion

                return(rowCount);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #5
0
        private int GenerateNegativeCases(Required r, List <string> lstAttributes, int rowCount, string txnID)
        {
            try
            {
                bool bCheck = false;
                int  i      = 1;
                #region NegativeValues
                foreach (var item in lstNegativeAttributeValues)
                {
                    DataRow dr = r.dtTM.NewRow();
                    dr["Transaction ID"]        = txnID;
                    dr["Test Condition ID"]     = txnID + "_TC_" + rowCount.ToString("D3");
                    dr["Test Condition Result"] = "Negative";
                    i = 1;
                    foreach (var att in lstAttributes)
                    {
                        if (att == item.tbl_Attribute.AttributeDesc)
                        {
                            try
                            {
                                dr[item.tbl_Attribute.AttributeDesc] = item.AttributeValue;
                                dr["isNegative" + i] = item.isNegative;
                                bCheck = true;
                            }
                            catch (Exception ex)
                            {
                            }
                        }
                        else
                        {
                            //IList<tbl_AttributeValues> lstNegValues = new List<tbl_AttributeValues>();

                            //if (dicAttributeValue.TryGetValue(item.tbl_Attribute.AttributeDesc, out lstNegValues))
                            //{
                            //    if (lstNegValues.Count == 2)
                            //    {
                            //        dr[att] = "Positive Values";
                            //    }
                            //    else
                            //    {
                            dr[att] = "Any";
                            //dr["isNegative" + i] = item.isNegative;
                            // dr["isNegative"] = "1"; Please check if red color is required for any also
                            //    }
                            //}
                        }
                        i++;
                    }

                    if (bCheck)
                    {
                        bCheck = false;
                        rowCount++;
                        r.dtTM.Rows.Add(dr);
                    }
                }
                #endregion
                return(rowCount);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #6
0
        private Required GenerateTransactionMatrix(IList <sp_GetMappingViewModelData_Result> lstMappingViewModel, Required r, string txnID, MappingViewModel mappingViewModel)
        {
            try
            {
                List <string> lstAttributes = GetListofAttributesMapped(lstMappingViewModel, txnID, mappingViewModel, r);

                int tmCount = 1;
                foreach (var item in r.dicCriticalAttributes)
                {
                    tmCount *= item.Value;
                }

                CreateHeadersForTM(r, lstAttributes);

                GenerateMappingTable(lstMappingViewModel, r, lstAttributes, txnID);

                int rowCount = RuleofN(lstAttributes, tmCount, txnID, r, Callback);

                rowCount = GenerateNegativeCases(r, lstAttributes, rowCount, txnID);

                return(r);
            }
            catch (Exception)
            {
                throw;
            }
        }