public void When_About_is_called_GetBand_on_IBandProcess_is_called_with_the_correct_parameter_and_the_result_is_mapped_with_BandMapper() { var entity = BandCreator.CreateSingle(); BandProcess .Expect(process => process.GetBand()) .Return(entity) .Repeat.Once(); BandProcess.Replay(); var detailModel = CreateAboutModel(); BandMapper .Expect(mapper => mapper.MapToAboutModel(entity)) .Return(detailModel) .Repeat.Once(); BandMapper.Replay(); var result = Controller.About().Result as ViewResult; Assert.IsNotNull(result); BandProcess.VerifyAllExpectations(); BandMapper.VerifyAllExpectations(); }
public void When_UpdateModel_is_mapped_to_an_Entity_and_the_Info_is_null_then_all_fields_are_mapped_correctly_and_Info_in_the_result_is_null() { var entity = BandCreator.CreateSingle(); BandProcess .Expect(process => process.GetBand()) .Return(entity) .Repeat.Once(); BandProcess.Replay(); var updateModel = new AboutUpdateModel { DateFounded = DateTime.Now.AddMonths(-4).Date, Info = null, }; var result = Mapper.Map(updateModel); Assert.AreEqual(entity.Id, result.Id, "Id not correct"); Assert.AreEqual(updateModel.DateFounded.ToUniversalTime(), result.Founded, "Date founded not correct"); Assert.AreEqual(null, result.Description, "Description not correct"); BandProcess.VerifyAllExpectations(); }
protected override void AdditionalSetup() { base.AdditionalSetup(); MockHelper.RegisterInstance <ICryptographyProcess>(new CryptographyProcess(CatalogsContainer)); Process = new BandProcess(CatalogsContainer); }
protected override void AdditionalSetup() { base.AdditionalSetup(); MockHelper.RegisterInstance<ICryptographyProcess>(new CryptographyProcess(CatalogsContainer)); Process = new BandProcess(CatalogsContainer); }
public void When_Band_is_mapped_to_a_DetailsModel_then_no_data_is_retrieved_from_process_classes() { BandProcess .Expect(process => process.GetBand()) .Repeat.Never(); BandProcess.Replay(); var entity = BandCreator.CreateSingle(); var result = Mapper.MapToAboutModel(entity); Assert.AreEqual(entity.Founded.ToLocalTime(), result.DateFounded); Assert.AreEqual(entity.Description, result.Info); }
public void When_Band_is_mapped_to_a_DetailsModel_and_the_Description_is_null_then_the_Info_is_stringEmpty() { BandProcess .Expect(process => process.GetBand()) .Repeat.Never(); BandProcess.Replay(); var entity = BandCreator.CreateSingle(); entity.Description = null; var result = Mapper.MapToAboutModel(entity); Assert.AreEqual(entity.Founded.ToLocalTime(), result.DateFounded); Assert.AreEqual(string.Empty, result.Info); }
private void uploadDatabase() { lg.cri(string.Format("Start Time: {0:HH:mm:ss tt}", DateTime.Now)); DataTable tbl; List <string> colname = new List <string>() { "VER", "PICS_Ver" }; //dbobj.tablename = "versinfo"; //dbobj.insertdata(colval,colname); //idv = dbobj.getid("ID", String.Format("VER = '{0}' and PICS_Ver = '{1}'", textBoxVer.Text, textBoxPICS.Text)); //Debug.Print("ID Version table: ", idv); // this is for config error //var errcsv1 = new StringBuilder(); // this is for data error //var errcsv2 = new StringBuilder(); //string row7 = ""; // this index is from the excel. band =3, icebandsupport 10 and tcsupport 6. //List<int> indlisttctable = new List<int>() { 0, 1, 2, 8, 11 }; // 0:TC Number,1:Description,2:Type of Test,3:Band Applicability,4:Cat,5:Standards,6:Environmental Condition,7:Band Criteria,8:Band,9:ICE Recommendation for Band,10:TC Status,11:Certified TP [V],12:Certified TP [E],13:Certified TP [D] //int[] excelcolidx = {0,1,2,3,4, }; List <int> indlisttctable = new List <int>() { 5, 0, 1, 6, 7 }; //List<int> indlistbandtable = new List<int>() { 3 }; //List<int> indlistbanddtable = new List<int>() { 6, 10 }; //List<int> indlistdatatable = new List<int>() { 4, 5 }; List <int> indlistbandtable = new List <int>() { 8 }; List <int> indlistbanddtable = new List <int>() { 10, 9 }; List <int> indlistdatatable = new List <int>() { 11, 12, 13 }; // this string is made of the database col names the size should be alligned with above intlist. // col name should be matched with database. string testcasecolstr = @"`spec`,`testcase`,`description`,`id#envcond`,`id#band_app_cri`,`sheetname`"; //string bandcolstr = @"`band`,`tcstatus`,`icebandsupport`"; string bandcolstr = @"`band`,`band2`"; //string banddcolstr = @"`tcstatus`,`icebandsupport`"; string datacolstr = @"`certified_tp_v`,`certified_tp_e`,`certified_tp_d`"; string mappingcolstr = @"`id#tc`,`id#testbandconfig`,`id#tcdata`,`id#ver`,`tcstatus`,`wi_rft`"; //string mappingcolstr = @"`id#tc`,`id#testbandconfig`,`id#tcdata`,`id#ver`,`id#bandd`"; string mappingallstr = ""; List <_List <string> > listoflisttc = new List <_List <string> >(); List <_List <string> > listoflistdata = new List <_List <string> >(); List <_List <string> > listoflistband = new List <_List <string> >(); _List <string> curlisttc; _List <string> curlistband; _List <string> curlistdata; Dictionary <string, DataTable> alltbl = new Dictionary <string, DataTable>(); foreach (string sh in sheetlist) { tbl = MySqlDb.GetExcelData(filepath, sh, ""); string shnameclean = sh.Replace("$", "").Replace("#", "."); alltbl.Add(shnameclean, tbl); Debug.Print(String.Format("Sheet info:{0}:", sh)); apendlog(String.Format("Sheet:{0}", sh)); SetTextBoxsh(shnameclean + " table: tcconfigtable"); SetLabelLn("writing to csv for upload"); foreach (DataRow row in tbl.Rows) { // This portion of commented code will make sure no duplicates in the csv to upload curlisttc = getlist(row, indlisttctable, new List <string>() { shnameclean }); curlistband = getlist(row, indlistbandtable); string oldb = curlistband[0]; if (oldb.StartsWith("BI:")) { oldb = oldb.Replace("BI:", ""); } else if (oldb.StartsWith("BI-M:")) { oldb = oldb.Replace("BI-M:", ""); } else if (oldb.StartsWith("BA:")) { oldb = oldb.Replace("BA:", ""); } else if (oldb.Contains(">")) { oldb = oldb.Split('>')[1]; } string newb = BandProcess.convertband(oldb); // this is to swap band based on rat. Regex r = new Regex(@"^(([EUGC])\d+)-(([EUGC])\d+)-?(([EUGC])\d+)?$", RegexOptions.Compiled); Match m = r.Match(newb); if (m.Success) { r = new Regex(@"(([EUGC])\d+)", RegexOptions.Compiled); List <string> alleb = new List <string>(); List <string> allub = new List <string>(); List <string> allgb = new List <string>(); List <string> allcb = new List <string>(); foreach (Match match in r.Matches(newb)) { if (match.ToString().StartsWith("E")) { alleb.Add(match.ToString()); } else if (match.ToString().StartsWith("U")) { allub.Add(match.ToString()); } else if (match.ToString().StartsWith("G")) { allgb.Add(match.ToString()); } else if (match.ToString().StartsWith("C")) { allcb.Add(match.ToString()); } } alleb.AddRange(allub); alleb.AddRange(allgb); alleb.AddRange(allcb); newb = (string.Join("-", alleb)); } curlistband.Add(newb); curlistdata = getlist(row, indlistdatatable); if (!curlisttc.chkmatch(listoflisttc, new List <int>() { 0, 1, 5 })) { //remove space from tc; curlisttc[1] = curlisttc[1].Replace(" ", ""); listoflisttc.Add(curlisttc); lg.inf(curlisttc.ToString()); } if (!curlistband.chkmatch(listoflistband, new List <int>() { 0 })) { listoflistband.Add(curlistband); lg.inf(curlistband.ToString()); } if (!curlistdata.chkmatch(listoflistdata, new List <int>() { 0, 1, 2 })) { listoflistdata.Add(curlistdata); lg.inf(curlistdata.ToString()); } } SetTextBoxsh(sh + " table: tcdatatable"); SetLabelLn(""); } SetLabelLn("uploading to database"); writetocsv(@"c:/temp/_tc.txt", listoflisttc); writetocsv(@"c:/temp/_band.txt", listoflistband); writetocsv(@"c:/temp/_data.txt", listoflistdata); if (!dbobj.getconnectionstat()) { dbobj.connectToDatabase(); } apendlog("Uploading processed data to database"); dbobj.tablename = "testcasetable"; dbobj.insertfile(@"c:/temp/_tc.txt", testcasecolstr); dbobj.tablename = "testbandconfig"; dbobj.insertfile(@"c:/temp/_band.txt", bandcolstr); //dbobj.tablename = "testbanddata"; //dbobj.insertfile(@"c:/temp/_bandd.txt", banddcolstr); dbobj.tablename = "tcdata"; dbobj.insertfile(@"c:/temp/_data.txt", datacolstr); SetLabelLn(""); Dictionary <string, string> getidcond = new Dictionary <string, string>(); string idtc, idband, iddata;// idbandd; // get tables from the database. and store to table. later need to grab ID and create the mapping table. dbobj.tablename = "testbandconfig"; DataTable dbtblband = dbobj.getdatatble(); //dbobj.tablename = "testbanddata"; //DataTable dbtblbandd = dbobj.getdatatble(); dbobj.tablename = "tcdata"; DataTable dbtbldata = dbobj.getdatatble(); string csvmapping = @"c:/temp/_mapping.txt"; //this table is from excel. so indexing should follow from excel. foreach (KeyValuePair <string, DataTable> kvp in alltbl) { dbobj.tablename = "testcasetable"; string shname = kvp.Key; DataTable dbtbltc = dbobj.getdatatble(String.Format("`sheetname` = '{0}'", shname)); //foreach(DataRow dr in dbtbltc.Rows) //{ // string li; // li = "tc # "; // for (int dri = 0; dri < 6; dri++) // { // li += "\"" + dr[dri] + "\"" + "\t\t"; // } // li += "\"" + shname + "\"" + "\t\t"; // lg.inf("tbl from db: " + li); //} //foreach (DataRow dr in kvp.Value.Rows) //{ // string li; // li = "tc # "; // for (int dri = 0; dri < 11; dri++) // { // li += "\"" + dr[dri] + "\"" + "\t\t"; // } // li += "\"" + shname + "\"" + "\t\t"; // lg.inf("tbl from excel: " + li); //} // 0:TC Number,1:Description,2:Type of Test,3:Band Applicability,4:Cat,5:Standards,6:Environmental Condition,7:Band Criteria,8:Band,9:ICE Recommendation for Band,10:TC Status,11:Certified TP [V],12:Certified TP [E],13:Certified TP [D] foreach (DataRow dr in kvp.Value.Rows) { idtc = "-1"; idband = "-1"; iddata = "-1"; getidcond.Add("spec", dr[5].ToString()); getidcond.Add("testcase", dr[0].ToString().Replace(" ", "")); getidcond.Add("sheetname", shname); lg.war("spec" + dr[5].ToString() + " tc " + dr[0].ToString() + " sheetname " + shname); idtc = dbobj.getid_str(dbtbltc, getidcond); getidcond.Clear(); getidcond.Add("certified_tp_v", dr[11].ToString()); getidcond.Add("certified_tp_e", dr[12].ToString()); getidcond.Add("certified_tp_d", dr[13].ToString()); //string xxx = dr[11]+"->"+dr[12]+"->"+dr[13]+"->>"; //foreach(DataRow ddd in dbtbldata.Rows) //{ // lg.inf(xxx+ ddd[0].ToString()+"\t" + ddd[1].ToString() + "\t" + ddd[2].ToString() + "\t"); //} iddata = dbobj.getid_str(dbtbldata, getidcond); getidcond.Clear(); // getidcond.Add("band", dr[8].ToString()); idband = dbobj.getid_str(dbtblband, getidcond); getidcond.Clear(); //getidcond.Add("tcstatus", dr[10].ToString()); //getidcond.Add("icebandsupport", dr[9].ToString()); //idbandd = dbobj.getid_str(dbtblbandd, getidcond); getidcond.Clear(); //lg.inf(String.Format("idtc: {0} idband: {1} iddata : {2}",idtc,idband,iddata)); string li = ""; if (idtc == "-1") { li += "tc # "; foreach (int dri in indlisttctable) { li += "\"" + dr[dri] + "\"" + "\t\t"; } li += "\"" + shname + "\"" + "\t\t"; } else if (idband == "-1") { li += "bandinfo # "; foreach (int dri in indlistbandtable) { li += "\"" + dr[dri] + "\"" + "\t\t"; } } else if (iddata == "-1") { li += "data # "; foreach (int dri in indlistdatatable) { li += "\"" + dr[dri] + "\"" + "\t\t"; } } if (li != "") { li = "ID not match: " + li; lg.cri(li); } /* * else * { * li = "tc # "; * foreach (int dri in indlisttctable) * { * li += "\"" + dr[dri] + "\"" + "\t\t"; * } * li += "\"" + shname + "\"" + "\t\t"; * lg.war("id match: " + idtc+ " : "+li); * } */ //mappingallstr += (String.Format("{0}\t{1}\t{2}\t{3}\t\n", idtc, idband, iddata,idv)); //mappingallstr += (String.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\n", idtc, idband, iddata, idv, idbandd,shname)); mappingallstr += (String.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\n", idtc, idband, iddata, idv, dr[10].ToString(), dr[15].ToString())); } } // save file and upload to db File.WriteAllText(csvmapping, mappingallstr); dbobj.tablename = "mapping_tc_band_table"; dbobj.insertfile(csvmapping, mappingcolstr); /* * * foreach (string sh in sheetlist) * { * //var csv1 = new StringBuilder(); * //var csv2 = new StringBuilder(); * //var csv3 = new StringBuilder(); * tbl = MySqlDb.GetExcelData(filepath, sh, ""); * //Debug.Print(String.Format("Sheet info:{0}:", sh)); * // SetTextBoxsh(sh.Replace("$", "") + " table: tcconfigtable"); * // SetLabelLn("writing to csv for upload"); * * foreach (DataRow row in tbl.Rows) * { * * * * * } * * } * * */ lg.cri(string.Format("End Time: {0:HH:mm:ss tt}", DateTime.Now)); }
public void When_CreatUser_is_called_then_the_User_is_created_and_registered_under_the_Band_that_is_provided_by_the_BandProcess() { var band = BandCreator.CreateSingle(); var user = UserCreator.CreateSingle(); var login = user.Login; const string encryptedPassword = "******"; BandProcess .Expect(process => process.EnsureBandExists()) .Return(band) .Repeat.Once(); BandProcess.Replay(); CryptographyProcess .Expect(process => process.Encrypt(login.Password)) .Return(encryptedPassword) .Repeat.Once(); CryptographyProcess.Replay(); UserProcess .Expect(process => process.GetUserByLoginName(Arg <string> .Is.Anything)) .Return(null) .Repeat.Once(); UserProcess .Expect(process => process.GetUserByEmailAddress(Arg <string> .Is.Anything)) .Return(null) .Repeat.Once(); UserProcess .Expect(process => process.AddUser(Arg <User> .Matches(u => u.BandId == band.Id && u.Login.Password == encryptedPassword && u.Login.IsOnline && u.Login.LastLoginDate > DateTime.UtcNow.AddSeconds(-2) && u.Login.LastActivityDate > DateTime.UtcNow.AddSeconds(-2) && u.Login.LastPasswordChangedDate > DateTime.UtcNow.AddSeconds(-2)))) .Return(user) .Repeat.Once(); UserProcess.Replay(); var membershipUser = CreateMembershipUser(user); UserMapper .Expect(mapper => mapper.Map(user)) .Return(membershipUser) .Repeat.Once(); UserMapper.Replay(); MembershipCreateStatus createStatus; var result = CustomMembershipProvider.CreateUser( login.LoginName, login.Password, login.EmailAddress, string.Empty, string.Empty, login.IsApproved, login.Id, out createStatus); Assert.IsNotNull(result); Assert.IsNotNull(result.ProviderUserKey); Assert.AreEqual(user.Login.LoginName, result.UserName); Assert.AreEqual(MembershipCreateStatus.Success, createStatus); BandProcess.VerifyAllExpectations(); CryptographyProcess.VerifyAllExpectations(); UserProcess.VerifyAllExpectations(); UserMapper.VerifyAllExpectations(); }
//public static Logging lg; //public static void mainprocess(string filePICSFullPath, _List<string> specTVAFiles, _List<string> specCVLFiles, Logging lg, MySqlDb dbobj, FormUpload frm) public static void mainprocess(string filePICSFullPath, _List <string> specTRLFiles, Logging lg, MySqlDb dbobj, FormUpload frm) { frm.SetProgress(0); frm.apendlog("Started PICS process", 4); lg.deb(" ++++ PICS Process started ++++ "); lg.deb("PICS User File : " + filePICSFullPath); lg.deb("List of CSV files on server spec data: \n\t\t" + specTRLFiles.ToString()); progressint = Convert.ToInt32(progress); //lg.inf("progress: " + progress.ToString() + " t : " + DateTime.Now.ToString("h:mm:ss tt")); // START string curDir = System.Environment.CurrentDirectory; string outputfilename = Path.Combine(curDir, "combinedOutput.csv"); string file_picsmapping = Path.Combine(curDir, "_picsmapping.csv"); string file_picsstatus = Path.Combine(curDir, "_picsstatus.csv"); string icebandall = ""; string icebandulca = ""; string ice4x4MIMO = ""; GenericParser gp = new GenericParser(@filePICSFullPath); List <string> excelsheetlist = MySqlDb.GetExcelsheetslist(@filePICSFullPath); Debug.Print("all sheet name: " + string.Join(" , ", excelsheetlist)); gp.lg = lg; List <int> x = new List <int> { 1, 6 }; //itemno vs [support, pnemonic] Dictionary <string, object> PICSoutput = gp.readwholepics(); // //lg.inf("PICS file Data: itemno vs [support,pnemonic]"); //lg.inf(PICSoutput.ToString()); TwoKeyDictionary <string, string, string> pics_reco_dic = new TwoKeyDictionary <string, string, string>(); _Dictionary <string, string> pics_reco_table; _Dictionary <string, string> PICSFormattedSupportOutput = gp.PICSFormatChangeSupport(PICSoutput); //lg.deb("PICS file Data. calculated to True/False with #"); //lg.deb(PICSFormattedSupportOutput.ToString()); _Dictionary <string, string> PICSmnemonicDic = gp.PICSFormatMnemonicsChangeSupport(PICSoutput); StringProcess.PICSmnemonicDic = PICSmnemonicDic; lg.inf("PICSmnemonicDic only for spec 12 = 102 230 :\n" + PICSmnemonicDic.ToString()); picsSupBandList = gp.PICSSupportedBands(PICSFormattedSupportOutput, PICSoutput); lg.inf("picsSupBandList :\n" + picsSupBandList.ToString()); progress = 2; //lg.inf("progress: " + progress.ToString() + "t : " + DateTime.Now.ToString("h:mm:ss tt")); progressint = Convert.ToInt32(progress); frm.SetProgress(progressint); Dictionary <string, object> RFBandListD = gp.RFBandTableD(PICSFormattedSupportOutput); Dictionary <string, object> RFBandListE = gp.RFBandTableE(PICSFormattedSupportOutput, PICSoutput); TwoKeyDictionary <string, string, string> user_bs_rb_pics = new TwoKeyDictionary <string, string, string>(); dbobj.tablename = "user_bs_rb_pics"; DataTable dt = dbobj.getdatatble(); Debug.Print("Reading Data Table"); foreach (DataRow dr in dt.Rows) { user_bs_rb_pics[dr["bandsupport"].ToString(), dr["requiredband"].ToString()] = dr["id"].ToString(); } //lg.inf("user_bs_rb_pics" + user_bs_rb_pics.ToString()); // user_picsver | picsver -> picssupportedbandlist -> id#gcfver // write user_picsver and get id. this will return picsversionid too. string idpicsver = frm.insertpicsver(picsSupBandList.toCommaList()); DataTable icebanddt = dbobj.getDtFromSqlSt(String.Format("Select icebands, icebands_ulca, 4x4_mimo from user_picsver where id = {0}", idpicsver)); foreach (DataRow row in icebanddt.Rows) { //returnval[row[0].ToString(),row[1].ToString()] = row[2].ToString(); //Debug.Print(row[0].ToString()); icebandall = row[0].ToString(); icebandulca = row[1].ToString(); ice4x4MIMO = row[2].ToString(); break; } lg.inf("customer band from db: (all) " + icebandall); lg.inf("customer band from db:(ulca) " + icebandulca); frm.getbandicesupport(icebandall); //string servDir = @"\\sd-ct-opiot.sn.intel.com\Dropbox\tools\TPG\sampleinput\Specs"; //New Code End progress = 3; progressint = Convert.ToInt32(progress); frm.SetProgress(progressint); int specfilescount = specTRLFiles.Count(); double progressinc = 97 / specfilescount; for (int i = 0; i < specfilescount; i++) { //lg.inf("progress: " + progress.ToString() + " t : " + DateTime.Now.ToString("h:mm:ss tt")); string status = "Processing : " + specTRLFiles[i]; frm.SetLabelstat(status); //string fileNameTVA = specTVAFiles[i]; //string fileNameCVL = specCVLFiles[i]; string filenameTRL = specTRLFiles[i]; string fileTRLPath = Path.Combine(servDir, filenameTRL); gp.clearVar(); // Getting a portion of string: string patt = @"(.+?)_\w+"; var mc = Regex.Match(filenameTRL, patt); string spec = mc.Groups[1].ToString(); //string fileCVLPath = Path.Combine(servDir, fileNameCVL); //string fileTVAPath = Path.Combine(servDir, fileNameTVA); lg.deb("{MainProcess} Processing -> spec: " + spec + "\tfiles: " + filenameTRL.ToString()); frm.apendlog("Processing spec = " + spec, 4); //_Dictionary<string, string> condVsLogicDic = gp.getdictionaryRowCol(1, 0, fileCVLPath); // this function will change condDict make adding hash. (not sure) // itemProcess is not needed for new algo //itemProcess(condVsLogicDic, spec); //lg.inf("{MainProcess} Condition vs. logical exp from server csv for Spec: " + spec); //lg.inf(condVsLogicDic.ToString()); //this will convert item to true false as per PICS // Here, we are changing the conDict according to spec. It is different only for Spec:102.230. //combinedCond(condVsLogicDic, PICSFormattedSupportOutput); //lg.deb(@"{MainProcess} Condition vs T/F after using PICS for Spec: " + spec); //lg.deb(condVsLogicDic.ToString()); // filter spec string to address spec confusion for 51.010 //string spec = spec; //if (spec.StartsWith("51.010")) //{ // spec = "51.010"; //} //lg.inf("tempdebug: spec: " + spec +" new spec: "+ spec); frm.SetLabelstat(status + " db query to get test configuration"); // Database query to get all the info for the spec. from tcconfig table frm.gettable_tcno_spec_id_band(spec); //TwoKeyDictionary<string, string, string> tc_band_sheet = frm.tc_band_sheet; _Dictionary <string, string> tc_des = frm.tc_des; TwoKeyDictionary <string, string, string> tc_band_id = frm.tc_band_id; TwoKeyDictionary <string, string, string> tc_band_status = frm.tc_band_status; _Dictionary <string, string> tc_bandapplicability = frm.tc_bandapplicability; //lg.deb("sheetname from db"+tc_band_sheet.ToString()); //lg.deb("testconfig from DB"); //lg.deb(tc_band_id.ToString()); //lg.deb("tc_bandapplicability from DB"); //lg.deb(tc_bandapplicability.ToString()); //lg.deb("tc_band_status from DB"); //lg.deb(tc_band_status.ToString()); _Dictionary <string, string> TCvsApp = new _Dictionary <string, string>(); _Dictionary <string, string> TCvsAppFiltered = new _Dictionary <string, string>(); _Dictionary <string, string> csvTCvsRel = new _Dictionary <string, string>(); _Dictionary <string, object> TCvsBand = new _Dictionary <string, object>(); TwoKeyDictionary <string, string, string> bsrbidxdic = new TwoKeyDictionary <string, string, string>(); if (File.Exists(fileTRLPath)) { _Dictionary <string, string> dict_logic = new _Dictionary <string, string>(); _Dictionary <string, string> dict_logic_TF = new _Dictionary <string, string>(); _Dictionary <string, string> dict_rel = new _Dictionary <string, string>(); _Dictionary <string, string> dict_de = new _Dictionary <string, string>(); _Dictionary <string, string> dict_pnemonic = new _Dictionary <string, string>(); StringProcess.specDash1 = spec; StringProcess.readconfigpics(); //StringProcess. gp.dict_de = dict_de; gp.dict_logic = dict_logic; gp.dict_logic_TF = dict_logic_TF; gp.dict_pnemonic = dict_pnemonic; gp.dict_rel = dict_rel; GenericParser.picssupport = PICSFormattedSupportOutput; //this will generate logic to TF gp.processlogic(fileTRLPath); if (GenericParser.missingpicsitem.Count > 0) { lg.inf("{MainProcess} Missing Item in pics file:"); lg.war(GenericParser.missingpicsitem.ToString()); } lg.inf("{MainProcess} TC vs True False TRL + pics file:"); lg.inf(dict_logic_TF.ToString()); lg.inf("{MainProcess} TC vs Logic from TRL:"); lg.inf(dict_logic.ToString()); //_Dictionary<string, string> csvTCvsCond; //_Dictionary<string, string> dict_de; //frm.SetLabelstat(status + " process tc vs cond"); //csvTCvsCond = new _Dictionary<string, string>(gp.getdictionaryRowCol(1, 0, fileTVAPath,true)); //frm.SetLabelstat(status + " process tc vs rel"); //csvTCvsRel = new _Dictionary<string, string>(gp.getdictionaryRowCol(2, 0, fileTVAPath,true)); //frm.SetLabelstat(status + " process tc vs Band cond"); //dict_de = new _Dictionary<string, string>(gp.getdictionaryRowCol(3, 0, fileTVAPath,true)); //lg.inf("{MainProcess} TC vs Condion from server csv file:"); //lg.inf(csvTCvsCond.ToString()); // This loop iterates over the configurations obtained from the database progress += progressinc * 0.1; progressint = Convert.ToInt32(progress); double progressinc2 = progressinc * 0.8; int tccount = tc_band_id.getCount(); double progressinc3 = progressinc2 / tccount; //lg.inf(String.Format("progress: {0} ,progressinc: {1}, progressinc2: {2},progressinc3: {3} tccount: {4}", progress, progressinc, progressinc2, progressinc3, tccount)); StringProcess.mismatchedbandbandsupporthelper.Clear(); //read new csv file here //string picslogic = ""; foreach (KeyValuePair <string, Dictionary <string, string> > temp in tc_band_id) {// reading database test case - band vs id start string ms1 = DateTime.Now.Millisecond.ToString(); string s1 = DateTime.Now.Second.ToString(); string tc = temp.Key.Replace(" ", "").ToLower(); string oldTC = tc; string picstmpstr = ""; string picsBand = ""; string picsRel = "Rel: NF"; string picsTCReco = ""; _Dictionary <string, string> band_id = new _Dictionary <string, string>(temp.Value); _List <string> bandsPerTC = new _List <string>(band_id.Keys.ToList()); lg.inf("{MainProcess} List of bands from db for TestCase: " + tc); lg.inf(bandsPerTC.ToString()); // Start: For Remving V1 or V2 from TC string TCvsAppFilteredTempSingle = ""; string pattTC = @"(.*)\s\(v\d+\)"; Match mcTC = Regex.Match(tc, pattTC); if (mcTC.Success) { tc = mcTC.Groups[1].ToString().Trim(); lg.war("TC Converted from old " + oldTC + " to " + tc); frm.apendlog("TC Converted from old " + oldTC + " to " + tc); } // End: For Remving V1 or V2 from TC // for spec 37.901 to match test case after the dash everything should be removed if (spec == "37.901") { tc = tc.Split('-')[0]; } //var tctemplist = dict_logic_TF.Keys.Where(t => t.Trim().Replace(" ", "").ToLower() == tc.Trim().Replace(" ", "").ToLower()); string tcapplicability = ""; foreach (string tctemp in dict_logic_TF.Keys) { if (tctemp.Trim().Replace(" ", "").ToLower() == tc.Trim().Replace(" ", "").ToLower()) { tcapplicability = dict_logic_TF[tctemp]; if (dict_rel.ContainsKey(tctemp)) { picsRel = dict_rel[tctemp]; } //if (dict_logic.ContainsKey(tctemp)) // picslogic = dict_logic[tctemp]; break; } } // checking if csvTCvsCond has the tc(after removing v1/v2) if (tcapplicability != "") { //string tcapplicability = dict_logic_TF[tc].Trim(); if (tcapplicability == "R") { TCvsApp.Add(tc, "R"); picsTCReco = "TC: R"; } else if (tcapplicability == "m") { TCvsApp.Add(tc, "R"); picsTCReco = "TC: R"; } else if (tcapplicability != "") { string dbgexception = " TC = " + tc; //string condCurTC = ""; string resCurTC = tcapplicability; try { // Pass it through a function: addressing special case 51.010-4... //condCurTC = csvTCvsCond[tc]; //dbgexception += "\tcondCurTC = " + condCurTC; // Pass it through a function: //resCurTC = tcapplicability;//dict_logic_TF[tc]; //resCurTC = StringProcess.TCVsTF(condCurTC, condVsLogicDic); dbgexception += "\tresCurTC = " + resCurTC; //lg.deb("Result from condition map: " + resCurTC + "for TestCase: " + tc); if (!TCvsApp.ContainsKey(tc)) { TCvsApp.Add(tc, resCurTC); } TCvsAppFilteredTempSingle = gp.TCvsAppRefined(resCurTC); if (!TCvsAppFiltered.ContainsKey(tc)) { TCvsAppFiltered.Add(tc, TCvsAppFilteredTempSingle); } dbgexception += "\tresCurTCFiltered = " + TCvsAppFilteredTempSingle; picsTCReco = "TC: " + TCvsAppFilteredTempSingle; } catch (Exception ex) { lg.err("{MainProcess} Exception: " + ex.Message + "\n\t\t\t" + dbgexception); picsTCReco = "TC: X"; frm.apendlog(ex.Message, 2); } } } else { // tc is not in the dictionary. csvTCvsCond.ContainsKey(tc) if (spec == "tty") { picsTCReco = "TC: R"; } else { picsTCReco = "TC: -"; lg.war("{MainProcess} CSVOutputTCApp KeyNotFound = " + tc); frm.apendlog("TC missing : " + tc, 3); } } _List <string> bandListDE = new _List <string>(); //_List<string> keyInTCvsRel = new _List<string>(csvTCvsRel.Keys.ToList()); //if (csvTCvsRel.ContainsKey(tc)) // picsRel = csvTCvsRel[tc]; if (spec == "36.521-1") { if (dict_de.ContainsKey(tc)) { patt = @"([DE])\d+"; var mc1 = Regex.Match(dict_de[tc], patt); string res = mc1.Groups[1].ToString(); if (res == "D") { List <string> bandListD = new List <string>(); if (RFBandListD.ContainsKey(dict_de[tc])) { bandListD = (List <string>)RFBandListD[dict_de[tc]]; } TCvsBand.Add(tc, bandListD); foreach (string bandVal in bandListD) { bandListDE.Add(bandVal); } } else if (res == "E") { List <string> bandListE = new List <string>(); if (RFBandListE.ContainsKey(dict_de[tc])) { bandListE = (List <string>)RFBandListE[dict_de[tc]]; } TCvsBand.Add(tc, bandListE); foreach (string bandVal in bandListE) { bandListDE.Add(bandVal); } } } else { lg.war("{MainProcess} CSVOutputTCBand KeyNotFound = " + tc); frm.apendlog("TC missing :: " + tc, 3); } lg.inf("DE Check: " + tc + " band list: " + bandListDE.ToString()); //frm.apendlog("bandlist error " + tc, 1); } _Dictionary <string, string> band_status = new _Dictionary <string, string>(frm.tc_band_status[oldTC]); lg.inf(" " + band_status.ToString()); bandHO = frm.rb_order_ho_str.Split(','); bandOther = frm.rb_order_other_str.Split(','); _Dictionary <string, string> band_rb = processRequiredBand(band_status, tc_bandapplicability[oldTC]); foreach (KeyValuePair <string, string> kvp in band_id) { string band_id_key = kvp.Key; string band_id_val = kvp.Value; string band_rb_val = "E"; _List <string> modifiedband = StringProcess.getValIntiligent(band_id_key, band_rb); band_rb_val = modifiedband[2]; if (modifiedband[0] != "1") { lg.inf("bandchange" + modifiedband.ToString()); } string pics_reco_str = picstmpstr; picsBand = ""; bool isSuppBand = StringProcess.bandSupportHelper(band_id_key, picsSupBandList); if ((frm.testcat == "rf") || (frm.testcat == "att") || (frm.testcat == "vzw") || (frm.testcat == "cmcc")) { band_rb_val = ""; } if (spec == "36.521-1") { //string PICSRecoBand = ""; bool PICSRecoBand = StringProcess.bandSupportHelper(band_id_key, bandListDE); //lg.cri("After call: " + tc + " band list: " + bandListDE.ToString()); if (PICSRecoBand) { //picsBand = "Band: R"; picsBand = ""; } else { picsBand = "Band: NR"; } if (tc.StartsWith("8") | tc.StartsWith("9")) { picsBand = ""; } //if ((tc_band_sheet[tc, band_id_key] == "LTE_UL_CA") || ((tc_band_sheet[tc, band_id_key] == "64QAM"))) string desc = tc_des[tc].ToLower(); if (desc.Contains("64qam") || desc.Contains("dl ca and ul ca")) { string pattULCA = @"CA_(\d+[A-E])"; Match mcULCA = Regex.Match(band_id_key, pattULCA); if (mcULCA.Success) { string band_id_key_mod = "UL" + band_id_key; if (picsSupBandList.Contains(band_id_key_mod)) { isSuppBand = true; } } } } picsRel = picsRel.Replace(",", " "); if (picsTCReco != "") { if (pics_reco_str == "") { pics_reco_str += picsTCReco; } else { pics_reco_str += ", " + picsTCReco; } } if (picsRel != "") { if (pics_reco_str == "") { pics_reco_str += picsRel; } else { pics_reco_str += ", " + picsRel; } } if (picsBand != "") { if (pics_reco_str == "") { pics_reco_str += picsBand; } else { pics_reco_str += ", " + picsBand; } } //if (picsRel.ToLower().Contains("only")) // pics_reco_str += ",Rel:NR"; //r(?:el)?(?:ease)?[-\s]?\d+\s*(?:to|and)\s*r(?:el)?(?:ease)?[-\s]?(\d+)\s*only //\s*r(?:el)?(?:ease)?[-\s]?(\d+)\s*only // rel 2 to rel 6 // string relpatt = @"(?:r(?:el)?(?:ease)?[-\s]?\d+\s*(?:to|and)\s*)?r(?:el)?(?:ease)?[-\s]?(\d+)\s*only"; // Match relm = Regex.Match(picsRel, relpatt,RegexOptions.IgnoreCase); // if (relm.Success) // { // int rel = int.Parse(relm.Groups[1].ToString()); // if ((rel < 90) && (rel < int.Parse(uerelease))) // { // pics_reco_str += ", Rel:NR"; // } // // } string PICSSuppBand = "NS"; if (isSuppBand) { PICSSuppBand = "S"; } string idstr = "-1"; if (user_bs_rb_pics.ContainsKey(PICSSuppBand, band_rb_val)) { idstr = user_bs_rb_pics[PICSSuppBand, band_rb_val]; } else { lg.cri("no key found: picssupband" + PICSSuppBand + " requiredband " + band_rb_val + "\n" + user_bs_rb_pics.ToString()); frm.apendlog("pics support band and requiredband process failed for band:" + band_id_key, 1); } if (!bsrbidxdic.ContainsKey(oldTC, band_id_key)) { bsrbidxdic[oldTC, band_id_key] = idstr; } // user_picsstatus | picsstatus // //string idstr = FormUpload.getid_Reco(pics_reco_table, PICSOutputStr); if (!pics_reco_dic.ContainsKey(oldTC, band_id_val)) { pics_reco_dic[oldTC, band_id_val] = pics_reco_str; } GenericParser.writetocsv(file_picsstatus, pics_reco_str + "\t"); pics_reco_str = String.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", band_id_key, oldTC, band_id_val, pics_reco_str, PICSSuppBand, idstr); GenericParser.writetocsv(outputfilename, pics_reco_str); lg.deb("FinalOutput: " + tc + " Result: " + pics_reco_str); } progress += progressinc3; if (progressint < Convert.ToInt32(progress)) { progressint = Convert.ToInt32(progress); frm.SetProgress(progressint); } progressint = Convert.ToInt32(progress); }// reading database test case - band vs id end lg.war("Missing Bands from 'picsSupBandList':\n\t\t " + string.Join(" ", StringProcess.mismatchedbandbandsupporthelper)); // GET user_picsstatus table here. as a dictionary. dbobj.tablename = "user_picsstatus"; file_picsstatus = file_picsstatus.Replace(@"\", @"/"); dbobj.insertfile(file_picsstatus, "picsstatus"); pics_reco_table = frm.getfulltable("user_picsstatus", "picsstatus"); //lg.deb("PICS Reco String table from DB"); //lg.deb(pics_reco_table.ToString()); //lg.deb("rb_sb"); //lg.deb(bsrbidxdic.ToString()); //lg.deb("tcr: " + pics_reco_table["TC: R, REL-8"]); foreach (KeyValuePair <string, Dictionary <string, string> > temp in tc_band_id) { string tc = temp.Key.Replace(" ", ""); _Dictionary <string, string> band_id = new _Dictionary <string, string>(temp.Value); foreach (KeyValuePair <string, string> kvp in band_id) { string picsrecoid = "-1"; string bsrbidx = "-1"; string band_id_key = kvp.Key; string band_id_val = kvp.Value; string pics_reco_str = pics_reco_dic[tc, band_id_val]; string picslogic = ""; if (dict_logic.ContainsKey(tc)) { picslogic = dict_logic[tc]; } else { picslogic = ""; lg.war("logicstring error" + tc); } //------converting REL to Rel - start--------- foreach (KeyValuePair <string, string> kvp1 in pics_reco_table) { string picsstringdb = kvp1.Key; if (picsstringdb.ToLower().Trim() == pics_reco_str.ToLower().Trim()) { picsrecoid = kvp1.Value; } } //if (pics_reco_table.ContainsKey(pics_reco_str)) //{ // picsrecoid = pics_reco_table[pics_reco_str]; //} //else if (picsrecoid == "-1") { lg.cri("No Key for " + pics_reco_str); lg.deb(pics_reco_table.ToString()); } if (bsrbidxdic.ContainsKey(tc, band_id_key)) { bsrbidx = bsrbidxdic[tc, band_id_key]; } else { lg.cri(String.Format("Missing ID for BS: {0} and RB : {1}", tc, band_id_key)); lg.deb(bsrbidxdic.ToString()); } string picsbs = frm.band_vs_icesupport[band_id_key]; if (spec == "36.521-1") { //if ((tc_band_sheet[tc, band_id_key] == "LTE_ UL_CA") || ((tc_band_sheet[tc, band_id_key] == "64QAM"))) string desc = tc_des[tc].ToLower(); if (desc.Contains("64qam") || desc.Contains("dl ca and ul ca")) { string band_id_key_mod = band_id_key.ToUpper().Replace("CA_", ""); if (BandProcess.containstheword(icebandulca, band_id_key_mod)) { picsbs = "S"; } else { picsbs = "NS"; } } if (desc.Contains("x4") || desc.Contains("4 rx")) { string band_id_key_mod = band_id_key.ToUpper().Replace("CA_", ""); if (BandProcess.containstheword(ice4x4MIMO, band_id_key_mod)) { picsbs = "S"; } else { picsbs = "NS"; } } } string map_str = String.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t", idpicsver, bsrbidx, picsrecoid, band_id_val, picsbs, picslogic); GenericParser.writetocsv(file_picsmapping, map_str); } } progress += progressinc * 0.1; progressint = Convert.ToInt32(progress); //lg.inf("progress: " + progress.ToString() + "t : " + DateTime.Now.ToString("h:mm:ss tt")); frm.SetProgress(progressint); dbobj.tablename = "user_picsmappingtable"; file_picsmapping = file_picsmapping.Replace(@"\", @"/"); frm.SetLabelstat(status + " uploading pics information to db"); dbobj.insertfile(file_picsmapping, String.Format("`{0}`,`{1}`,`{2}`,`{3}`,`{4}`,`{5}`", "id#pics", "id#bsrb", "id#picsstat", "id#v_comb_serv_info", "icebs", "PICSLogic")); frm.SetLabelstat(status + " Uploading pics Complete"); } else { lg.cri("{MainProcess} File Does not exist ! =>" + filenameTRL); Debug.Print("File " + filenameTRL + " NOT found!"); frm.apendlog("File " + filenameTRL + " NOT found!", 1); } //////lg.inf("{MainProcess} TC (from db) vs App: RAW"); //////lg.inf("======================"); //////lg.inf(TCvsApp.ToString()); //////lg.deb("{MainProcess} TC (from db) vs App: FILTERED"); //////lg.deb("======================"); //////lg.deb(TCvsAppFiltered.ToString()); //////lg.cri("Band Support: Verification:"); //////lg.cri(TCBandSupport.ToString()); // End of the Loop: } progress = 100; progressint = Convert.ToInt32(progress); frm.SetProgress(progressint); frm.SetLabelstat("Idle"); // END }
//delete this function private bool bandSupportHelper(string inputBand, string PICSBandSupportList) { inputBand = inputBand.Replace("U01", "UI").Replace("U02", "UII").Replace("U03", "UIII").Replace("U04", "UIV").Replace("U05", "UV").Replace("U06", "UVI").Replace("U07", "UVII").Replace("U08", "UVIII"); //string PICSBandSupportList=icebandall; //string PICSBandSupportList= "1 2 3 4 5 7 8 12 13 17 18 19 20 25 26 28 29 30 34 38 39 40 41 66 7C 38C 40C 41C 2C 3C 7B 7C 12B 38C 39C 40C 41C 41D 66B 66C 2A-2A 3A-3A 4A-4A 7A-7A 25A-25A 41A-41A 41A-41C 41C-41A 66A-66A 1A-3A 1A-3C 1A-5A 1A-7A 1A-8A 1A-18A 1A-19A 1A-20A 1A-26A 1A-28A 2A-2A-5A 2A-2A-12A 2A-2A-13A 2A-2A-29A 2A-2A-30A 2A-4A 2A-5A 2A-12A 2C-12A 2A-12B 2A-13A 2A-17A 2A-29A 2A-30A 2C-30A 2A-66A 2A-66B 2A-66C 3A-3A-7A 3A-3A-7A-7A 3A-3A-8A 3A-5A 3C-5A 3A-7A 3A-7A-7A 3A-7B 3A-7C 3C-7A 3A-8A 3A-19A 3A-20A 3A-26A 3A-28A 4A-4A-5A 4A-4A-7A 4A-4A-12A 4A-4A-13A 4A-4A-29A 4A-4A-30A 4A-5A 4A-7A 4A-12A 4A-12B 4A-13A 4A-17A 4A-29A 4A-30A 5A-7A 5A-25A 5A-30A 5A-40A 5A-40C 7A-8A 7A-12A 7A-20A 7A-28A 7B-28A 7C-28A 12A-30A 12A-66A 12A-66A-66A 12A-66B 13A-66A 20A-38A 25A-26A 29A-30A 39A-41A 39C-41A 39A-41C 1A-3A-5A 1A-3A-7A 1A-3A-8A 1A-3A-19A 1A-3A-20A 1A-3A-26A 1A-3A-28A 1A-5A-7A 1A-7A-8A 1A-7A-20A 1A-7A-28A 2A-2A-5A-30A 2A-2A-12A-30A 2A-2A-29A-30A 2C-29A-30A 2A-4A-5A 2A-4A-12A 2A-4A-13A 2A-4A-29A 2A-4A-30A 2A-5A-30A 2C-5A-30A 2A-12A-30A 2C-12A-30A 2A-12A-66A 2A-29A-30A 3A-7A-8A 3A-7A-20A 3A-7A-28A 3A-7C-28A 4A-4A-5A-30A 4A-4A-12A-30A 4A-4A-29A-30A 4A-5A-30A 4A-7A-12A 4A-12A-30A 4A-29A-30A 1A-3A-7A-8A 1A-3A-7A-28A 2A-4A-5A-30A 2A-4A-12A-30A 2A-4A-29A-30A I II IV V VI VIII A E F 850 900 1800 1900"; string outputBand = inputBand.Trim(); string outputBandHOA1 = ""; string outputBandHOA2 = ""; string outputBandHOB1 = ""; string outputBandHOB2 = ""; string outputBandHOB3 = ""; string outputBandHOB4 = ""; string outputBandHO1 = ""; string outputBandHO2 = ""; string outputBandHO1_3 = ""; string outputBandHO2_3 = ""; string outputBandHO3_3 = ""; bool finaloutputBand = false; string pattSC = @"^\d+$"; Match mcSC = Regex.Match(inputBand, pattSC); if (mcSC.Success) { if (BandProcess.containstheword(PICSBandSupportList, outputBand)) { finaloutputBand = true; } } else { // Basic CA band matching: string pattBasicCA = @"CA_(.+)"; var mcBasicCA = Regex.Match(inputBand, pattBasicCA); string pattULCA = @"CA_(.+)\+(.+)"; var mcULCA = Regex.Match(inputBand, pattULCA); string pattHOA = @"[SD]B_(.+)\-(.+)"; var mcHOA = Regex.Match(inputBand, pattHOA); string pattHOB = @"(.+)\-(.+)\-(.+)\-(.+)"; var mcHOB = Regex.Match(inputBand, pattHOB); string pattHOC = @"FDD(.+)(\D+)"; var mcHOC = Regex.Match(inputBand, pattHOC); string pattHO = @"([EUCG])?(\w+)?\-([EUCG])?(\w+)?"; var mcHO = Regex.Match(inputBand, pattHO); string pattHO_3 = @"([EUCG])?(\w+)?\-([EUCG])?(\w+)?\-([EUCG])?(\w+)?"; var mcHO_3 = Regex.Match(inputBand, pattHO_3); // if (mcBasicCA.Success) { outputBand = mcBasicCA.Groups[1].ToString(); } else if (mcHO_3.Success) { string outputBandHO1_3Temp = mcHO_3.Groups[2].ToString(); outputBandHO1_3 = outputBandHO1_3Temp.TrimStart('0'); string outputBandHO2_3Temp = mcHO_3.Groups[4].ToString(); outputBandHO2_3 = outputBandHO2_3Temp.TrimStart('0'); string outputBandHO3_3Temp = mcHO_3.Groups[6].ToString(); outputBandHO3_3 = outputBandHO3_3Temp.TrimStart('0'); } else if (mcHO.Success) { string outputBandHO1Temp = mcHO.Groups[2].ToString(); outputBandHO1 = outputBandHO1Temp.TrimStart('0'); string outputBandHO2Temp = mcHO.Groups[4].ToString(); outputBandHO2 = outputBandHO2Temp.TrimStart('0'); } // else if (mcULCA.Success) { outputBand = "ULCA_" + mcULCA.Groups[1].ToString(); } else if (mcHOA.Success) { outputBandHOA1 = mcHOA.Groups[1].ToString(); outputBandHOA2 = mcHOA.Groups[2].ToString(); } else if (mcHOB.Success) { outputBandHOB1 = mcHOB.Groups[1].ToString(); outputBandHOB2 = mcHOB.Groups[2].ToString(); outputBandHOB3 = mcHOB.Groups[3].ToString(); outputBandHOB4 = mcHOB.Groups[4].ToString(); } else if (mcHOC.Success) { outputBand = mcHOC.Groups[1].ToString(); } // Band Checking and Producing Boolean Decision: //lgstr.cri("List of Bands from Function:"); //lgstr.cri(PICSBandSupportList.ToString()); // BandProcess.containstheword(PICSBandSupportList, outputBand) //if (PICSBandSupportList.Contains(outputBand)) if (BandProcess.containstheword(PICSBandSupportList, outputBand)) { finaloutputBand = true; } //else if (PICSBandSupportList.Contains(outputBandHOA1) && PICSBandSupportList.Contains(outputBandHOA2)) else if (BandProcess.containstheword(PICSBandSupportList, outputBandHOA1) && BandProcess.containstheword(PICSBandSupportList, outputBandHOA2)) { finaloutputBand = true; } //else if (PICSBandSupportList.Contains(outputBandHOB1) && PICSBandSupportList.Contains(outputBandHOB2) && PICSBandSupportList.Contains(outputBandHOB3) && PICSBandSupportList.Contains(outputBandHOB4)) else if (BandProcess.containstheword(PICSBandSupportList, outputBandHOB1) && BandProcess.containstheword(PICSBandSupportList, outputBandHOB2) && BandProcess.containstheword(PICSBandSupportList, outputBandHOB3) && BandProcess.containstheword(PICSBandSupportList, outputBandHOB4)) { finaloutputBand = true; } //else if (PICSBandSupportList.Contains(outputBandHO1) && PICSBandSupportList.Contains(outputBandHO2)) else if (BandProcess.containstheword(PICSBandSupportList, outputBandHO1) && BandProcess.containstheword(PICSBandSupportList, outputBandHO2)) { finaloutputBand = true; } //else if (PICSBandSupportList.Contains(outputBandHO1_3) && PICSBandSupportList.Contains(outputBandHO2_3) && PICSBandSupportList.Contains(outputBandHO3_3)) else if (BandProcess.containstheword(PICSBandSupportList, outputBandHO1_3) && BandProcess.containstheword(PICSBandSupportList, outputBandHO2_3) && BandProcess.containstheword(PICSBandSupportList, outputBandHO3_3)) { finaloutputBand = true; } else { lgstr.err("{bandSupportHelper-formupload} Band Not Match: " + inputBand); } } //lgstr.cri("Input band: " + inputBand + ", Output band: " + outputBand + ", Result: " + finaloutputBand); return(finaloutputBand); }
public static bool bandSupportHelper(string inputBand, _List <string> PICSBandSupportList) { if ((inputBand.ToUpper() == "BI") || (inputBand.ToUpper() == "NI") || (inputBand.ToUpper() == "BA")) { return(true); } //start code here string outputBandHOA1 = ""; string outputBandHOA2 = ""; string outputBandHOB1 = ""; string outputBandHOB2 = ""; string outputBandHOB3 = ""; string outputBandHOB4 = ""; string outputBandHO1 = ""; string outputBandHO2 = ""; string outputBandHO1_3 = ""; string outputBandHO2_3 = ""; string outputBandHO3_3 = ""; bool finaloutputBand = false; string pattEG = @"^[EG]\d+$"; string pattU = @"^[U]\d+$"; Match mcEG = Regex.Match(inputBand, pattEG); Match mcU = Regex.Match(inputBand, pattU); if (mcEG.Success) { inputBand = inputBand.TrimStart('E').TrimStart('G').TrimStart('0'); } else if (mcU.Success) { inputBand = inputBand.TrimStart('U').TrimStart('0'); inputBand = BandProcess.getwbandinroman(inputBand); } string pattSC = @"^(\d|[IVX])+$"; Match mcSC = Regex.Match(inputBand, pattSC); //string pattSCU = @"^[IVX]+$"; //Match mcSCU = Regex.Match(inputBand, pattSCU); string outputBand = inputBand.Trim(); if (mcSC.Success) { if (PICSBandSupportList.Contains(outputBand)) { finaloutputBand = true; } } else { // Basic CA band matching: string pattBasicCA = @"CA_(.+)"; var mcBasicCA = Regex.Match(inputBand, pattBasicCA); string pattULCA = @"CA_(.+)\+(.+)"; var mcULCA = Regex.Match(inputBand, pattULCA); string pattHOA = @"[SD]B_(.+)\-(.+)"; var mcHOA = Regex.Match(inputBand, pattHOA); string pattHOB = @"(.+)\-(.+)\-(.+)\-(.+)"; var mcHOB = Regex.Match(inputBand, pattHOB); string pattHOC = @"FDD(.+)(\D+)"; var mcHOC = Regex.Match(inputBand, pattHOC); string pattHO = @"([EUCG])?(\w+)?\-([EUCG])?(\w+)?"; var mcHO = Regex.Match(inputBand, pattHO); string pattHO_3 = @"([EUCG])?(\w+)?\-([EUCG])?(\w+)?\-([EUCG])?(\w+)?"; var mcHO_3 = Regex.Match(inputBand, pattHO_3); // if (mcBasicCA.Success) { outputBand = mcBasicCA.Groups[1].ToString(); } else if (mcHO_3.Success) { string outputBandHO1_3Temp = mcHO_3.Groups[2].ToString(); outputBandHO1_3 = outputBandHO1_3Temp.TrimStart('0'); string outputBandHO2_3Temp = mcHO_3.Groups[4].ToString(); outputBandHO2_3 = outputBandHO2_3Temp.TrimStart('0'); string outputBandHO3_3Temp = mcHO_3.Groups[6].ToString(); outputBandHO3_3 = outputBandHO3_3Temp.TrimStart('0'); } else if (mcHO.Success) { string outputBandHO1Temp = mcHO.Groups[2].ToString(); outputBandHO1 = outputBandHO1Temp.TrimStart('0'); string outputBandHO2Temp = mcHO.Groups[4].ToString(); outputBandHO2 = outputBandHO2Temp.TrimStart('0'); } // else if (mcULCA.Success) { outputBand = "ULCA_" + mcULCA.Groups[1].ToString(); } else if (mcHOA.Success) { outputBandHOA1 = mcHOA.Groups[1].ToString(); outputBandHOA2 = mcHOA.Groups[2].ToString(); } else if (mcHOB.Success) { outputBandHOB1 = mcHOB.Groups[1].ToString(); outputBandHOB2 = mcHOB.Groups[2].ToString(); outputBandHOB3 = mcHOB.Groups[3].ToString(); outputBandHOB4 = mcHOB.Groups[4].ToString(); } else if (mcHOC.Success) { outputBand = mcHOC.Groups[1].ToString(); } // Band Checking and Producing Boolean Decision: //lgstr.cri("List of Bands from Function:"); //lgstr.cri(PICSBandSupportList.ToString()); if (PICSBandSupportList.Contains(outputBand)) { finaloutputBand = true; } else if (PICSBandSupportList.Contains(outputBandHOA1) && PICSBandSupportList.Contains(outputBandHOA2)) { finaloutputBand = true; } else if (PICSBandSupportList.Contains(outputBandHOB1) && PICSBandSupportList.Contains(outputBandHOB2) && PICSBandSupportList.Contains(outputBandHOB3) && PICSBandSupportList.Contains(outputBandHOB4)) { finaloutputBand = true; } else if (PICSBandSupportList.Contains(outputBandHO1) && PICSBandSupportList.Contains(outputBandHO2)) { finaloutputBand = true; } else if (PICSBandSupportList.Contains(outputBandHO1_3) && PICSBandSupportList.Contains(outputBandHO2_3) && PICSBandSupportList.Contains(outputBandHO3_3)) { finaloutputBand = true; } else { // //lgstr.err("{bandSupportHelper-stringprocess} Band Not Match: " + inputBand); if (!mismatchedbandbandsupporthelper.Contains(inputBand)) { mismatchedbandbandsupporthelper.Add(inputBand); } } } //lgstr.cri("Input band: " + inputBand + ", Output band: " + outputBand + ", Result: " + finaloutputBand); return(finaloutputBand); }