public void DeleteModule(tbl_Module tblModule) { try { IGenericDataRepository <tbl_Module> repository = new GenericDataRepository <tbl_Module>(); repository.Remove(tblModule); } catch (Exception) { throw; } }
internal int SaveModul(tbl_Module modulOb) { try { _context.tbl_Module.AddObject(modulOb); _context.SaveChanges(); return(1); } catch (Exception) { throw; } }
public tbl_Module FindModuleNameForRunPlan(int?moduleId) { try { IGenericDataRepository <tbl_Module> repository = new GenericDataRepository <tbl_Module>(); tbl_Module module = repository.GetSingle(m => m.ModuleID == moduleId); return(module); } catch (Exception) { throw; } }
public tbl_Module FindModuleName(string modName, int applicationId) { try { IGenericDataRepository <tbl_Module> repository = new GenericDataRepository <tbl_Module>(); tbl_Module module = repository.GetSingle(m => m.ModuleName.ToUpper() == modName.ToUpper() && m.ApplicationId == applicationId); return(module); } catch (Exception) { throw; } }
public void GetModuleName(int modId, out int applicationId, out string modName) { try { tbl_Module tblModule = new tbl_Module(); ModuleManager modManager = new ModuleManager(); tblModule = modManager.FindModule(modId); applicationId = (int)tblModule.ApplicationId; modName = tblModule.ModuleName; } catch (Exception) { throw; } }
internal int UpdateModul(tbl_Module modulOb, string ModulId) { int modulId = Convert.ToInt32(ModulId); tbl_Module moduleObject = _context.tbl_Module.First(x => x.ModuleID == modulId); moduleObject.ModuleName = modulOb.ModuleName; moduleObject.ModuleURL = modulOb.ModuleURL; moduleObject.ModuleIcon = modulOb.ModuleIcon; moduleObject.ModuleOrder = modulOb.ModuleOrder; moduleObject.EDIT_USER = modulOb.EDIT_USER; moduleObject.EDIT_DATE = modulOb.EDIT_DATE; moduleObject.Status = modulOb.Status; moduleObject.OCODE = modulOb.OCODE; _context.SaveChanges(); return(1); }
public void AddMod(ModuleViewModel modVM) { try { tbl_Module tblModule = new tbl_Module(); tblModule.ApplicationId = modVM.ApplicationID; tblModule.ModuleName = modVM.ModuleName; tblModule.EntityState = DA.DomainModel.EntityState.Added; ModuleManager modManager = new ModuleManager(); modManager.AddModule(tblModule); } catch (Exception) { throw; } }
public bool DeleteMod(ModuleViewModel modVM) { try { tbl_Module tblModule = new tbl_Module(); tblModule.ModuleID = modVM.ModuleId; tblModule.EntityState = DA.DomainModel.EntityState.Deleted; ModuleManager modManager = new ModuleManager(); modManager.DeleteModule(tblModule); return(true); } catch (Exception) { throw; } }
public string CreateRunPlanFile(int daId, HttpPostedFileBase rpFilePath) { try { DataTable getTestDesignTable = new DataTable(); using (package = new ExcelPackage()) { using (var objExcelPackage = new ExcelPackage(rpFilePath.InputStream)) { ExcelWorksheet ws = excelCommonFunctions.OpenSheet(objExcelPackage, "Design Document"); //testDesignData getTestDesignTable = GetDataTableFromExcel(rpFilePath, true); } tbl_DesignAccelerator da = new tbl_DesignAccelerator(); DAManager daManager = new DAManager(); da = daManager.FindDA(daId); var modId = da.ModuleId; tbl_Module daModule = new tbl_Module(); ModuleManager modManager = new ModuleManager(); daModule = modManager.FindModuleNameForRunPlan(modId); var moduleName = daModule.ModuleName; AddRunPlanData(getTestDesignTable, daId, moduleName); string filePath = excelCommonFunctions.SaveFile(package, da.daName, "", "RunPlanFile"); return(filePath); } } catch (Exception) { throw; } }
// GET: TestDesign public async Task <string> GenerateTestDesign(int daId, HttpPostedFileBase txmPath, HttpPostedFileBase ScbPath) { try { Dictionary <string, List <TestScenarioMembers> > testScenarios = new Dictionary <string, List <TestScenarioMembers> >(); IList <tbl_Attribute> lstAttributes = new List <tbl_Attribute>(); TransactionMatrix transactionMatrix = new TransactionMatrix(); testDesignVM.lstHighLevelTransactions = testDesignVM.GetTransactionsList(daId).lstTransactions; ModuleViewModel moduleViewModel = new ModuleViewModel(); int colIndex = 1, rowIndex = 0; //Create new workbook for Test Design using (var package = new ExcelPackage()) { ExcelWorksheet ws2 = package.Workbook.Worksheets.Add("Design Document"); CreateHeadersForTD(ws2, out dtTD); //Read data from Test Scenario using (var objExcelPackage = new ExcelPackage(ScbPath.InputStream)) { //string scenarioId = ""; //string testConditionId = ""; ExcelWorksheet ws = excelCommonFunctions.OpenSheet(objExcelPackage, "Test Scenarios"); testScenarios = GetDataTableFromExcel(ScbPath); } //Read data from RuleOfNData DataSet transactionMatrixSheets = new DataSet(); //list of the rule reference datatables will come into this list List <DataTable> dtRuleOfNforTestDesignRuleReference = new List <DataTable>(); //Dictionary to add the fetched last tables from tm into dtRuleOFNForTestDesignRuleReference and pass as a parameter to addTestDesign method. Dictionary <string, List <DataTable> > ruleReferences = new Dictionary <string, List <DataTable> >(); using (var objExcelPackage = new ExcelPackage(txmPath.InputStream)) { foreach (var trans in testDesignVM.lstHighLevelTransactions) { int colIdex = 1, rowIdex = 0; ExcelWorksheet ws = excelCommonFunctions.OpenSheet(objExcelPackage, trans.HighLevelTxnDesc); //For Test design last tables dtRuleOfNforTestDesignRuleReference = transactionMatrix.GetRuleOfNDataForTestDesignRuleReferene(ws, ref colIdex, ref rowIdex); //Adding all the fetched tables into the dictionary from list foreach (var item in dtRuleOfNforTestDesignRuleReference) { if (ruleReferences.ContainsKey(ws.ToString())) { ruleReferences[ws.ToString()].Add(item); } else { ruleReferences.Add(ws.ToString(), new List <DataTable> { item }); } } DataTable dtRuleOfN = transactionMatrix.GetRuleOfNData(ws, ref colIdex, ref rowIdex); dtRuleOfN.TableName = trans.HighLevelTxnDesc; transactionMatrixSheets.Tables.Add(dtRuleOfN); } } tbl_DesignAccelerator da = new tbl_DesignAccelerator(); DAManager daManager = new DAManager(); da = daManager.FindDA(daId); var modId = da.ModuleId; tbl_Module daModule = new tbl_Module(); ModuleManager modManager = new ModuleManager(); daModule = modManager.FindModuleNameForRunPlan(modId); var moduleName = daModule.ModuleName; string tblName4 = moduleName + " - Test Design Document"; ws2.Cells[2, 1].Value = tblName4; //// Format Excel Sheet ws2.Cells[2, 1, 2, 5].Merge = true; //Merge columns start and end range ws2.Cells[2, 1, 2, 5].Style.Font.Bold = true; //Font should be bold ws2.Cells[2, 1, 2, 5].Style.Font.Size = 14; ws2.Cells[2, 1, 2, 5].Style.HorizontalAlignment = ExcelHorizontalAlignment.Left; // Alignment is Left ws2.Cells[2, 1, 2, 5].Style.Fill.PatternType = ExcelFillStyle.Solid; // Border ws2.Cells[2, 1, 2, 5].Style.Fill.BackgroundColor.SetColor(Color.LightGray); // Background Color excelCommonFunctions.CreateTableHeader(dtTD, ws2, ref colIndex, ref rowIndex, "tbl4"); ws2.Cells["A4:N4"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; AddTestDesign(testScenarios, transactionMatrixSheets, ws2, colIndex, rowIndex, dtTD, testDesignVM.lstHighLevelTransactions, ruleReferences); //Format Excel Sheet ws2.View.ShowGridLines = false; ws2.View.ZoomScale = 80; ws2.Cells.AutoFitColumns(); ws2.Column(4).Width = 50; ws2.Column(12).Width = 75; ws2.Column(13).Width = 75; ws2.Column(14).Width = 75; string filePath = excelCommonFunctions.SaveFile(package, da.daName, "", "TD"); return(filePath); } } catch (Exception) { throw; } }
internal int UpdateModul(tbl_Module modulOb, string ModulId) { return(moduldal.UpdateModul(modulOb, ModulId)); }
internal int SaveModul(tbl_Module modulOb) { return(moduldal.SaveModul(modulOb)); }
protected void BtnSave_Click(object sender, EventArgs e) { try { tbl_Module modulOb = new tbl_Module(); modulOb.ModuleName = txtModuleName.Text; modulOb.ModuleURL = txtUrl.Text; modulOb.ModuleOrder = Convert.ToInt16(txtbxModuleOrder.Text); modulOb.OCODE = Convert.ToString(((SessionUser)Session["SessionUser"]).OCode); modulOb.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId; modulOb.EDIT_DATE = DateTime.Now; if (drpdownStatus.SelectedItem.ToString() == "True") { modulOb.Status = true; } else { modulOb.Status = false; } if (BtnSave.Text == "Save Module") { int imageNumber = 0; string PPImg = ""; string path = HttpContext.Current.Server.MapPath(WebConfigurationManager.AppSettings["AttachmentPath"] + "/ModuleIcon/"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string[] filePaths = Directory.GetFiles(Server.MapPath("~" + "/ModuleIcon/")); List <ListItem> files = new List <ListItem>(); foreach (string filePath in filePaths) { string fileName = Path.GetFileName(filePath); files.Add(new ListItem(fileName, "~" + "/ModuleIcon/" + fileName)); } imageNumber = files.Count; FileUpload FilePP = new FileUpload(); FilePP = FileUpload1; if (FilePP.HasFile) { imageNumber++; PPImg = imageNumber + FilePP.FileName; path = path + @"\" + PPImg; FilePP.PostedFile.SaveAs(path); } modulOb.ModuleIcon = PPImg; int result = modulBll.SaveModul(modulOb); if (result == 1) { //lblStatus.Text = "Module Save Successfully"; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Module Save Successfully')", true); ClearAllControll(); } } else { //string ImageLication = "~" + "/ModuleIcon/" + hidModulImageIcon.Value; //File.Delete(Server.MapPath(ImageLication)); string PPImg = ""; FileUpload FilePP1 = new FileUpload(); FilePP1 = FileUpload1; if (FilePP1.FileName == "") { modulOb.ModuleIcon = hidModulImageIcon.Value; } else { int imageNumber = 0; string path = HttpContext.Current.Server.MapPath(WebConfigurationManager.AppSettings["AttachmentPath"] + "/ModuleIcon/"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string[] filePaths = Directory.GetFiles(Server.MapPath("~" + "/ModuleIcon/")); List <ListItem> files = new List <ListItem>(); foreach (string filePath in filePaths) { string fileName = Path.GetFileName(filePath); files.Add(new ListItem(fileName, "~" + "/ModuleIcon/" + fileName)); } imageNumber = files.Count; FileUpload FilePP = new FileUpload(); FilePP = FileUpload1; if (FilePP.HasFile) { imageNumber++; PPImg = imageNumber + FilePP.FileName; path = path + @"\" + PPImg; FilePP.PostedFile.SaveAs(path); } modulOb.ModuleIcon = "ModuleIcon/" + PPImg; } string ModulId = hidModuleId.Value; int result = modulBll.UpdateModul(modulOb, ModulId); if (result == 1) { // lblStatus.Text = "Module Update Successfully"; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Module Update Successfully')", true); ClearAllControll(); } } } catch (Exception) { throw; } }
public DataTable CreateAttributesTable(IList <tbl_Attribute> lstAttributes, int id) { try { DataTable dt = new DataTable(); dt.Columns.AddRange(new DataColumn[1] { new DataColumn("S.No") }); dt.Columns["S.No"].AutoIncrement = true; dt.Columns["S.No"].AutoIncrementSeed = 1; dt.Columns["S.No"].AutoIncrementStep = 1; dt.Columns.Add("Requirement Reference"); dt.Columns.Add("Function/Module"); TransactionsManager brm = new TransactionsManager(); IList <tbl_Transactions> lst = brm.GetAllTransactions(id); var moduleId = lstAttributes.Select(q => q.tbl_DesignAccelerator.ModuleId); tbl_Module tblModule = new tbl_Module(); ModuleManager moduleManager = new ModuleManager(); tblModule = moduleManager.FindModuleNameForRunPlan(Convert.ToInt32(moduleId.First())); var moduleName = tblModule.ModuleName; foreach (var item in lst) { var a = item.HighLevelTxnID + "_" + item.HighLevelTxnDesc; dt.Columns.Add(a); } count = lst.Count; dt.Columns.Add("Attribute Description"); dt.Columns.Add("Attribute Type Description"); dt.Columns.Add("AttributeID"); dt.Columns.Add("Value1"); dt.Columns.Add("Value2"); dt.Columns.Add("Value3"); dt.Columns.Add("Value4"); dt.Columns.Add("Value5"); dt.Columns.Add("Value6"); dt.Columns.Add("Value7"); dt.Columns.Add("Value8"); dt.Columns.Add("Value9"); dt.Columns.Add("Value10"); dt.Columns.Add("Value11"); dt.Columns.Add("Value12"); dt.Columns.Add("Value13"); dt.Columns.Add("Value14"); dt.Columns.Add("Value15"); foreach (var item in lstAttributes) { DataRow dr = dt.NewRow(); dr[count + 3] = item.AttributeDesc; dr[count + 4] = item.tbl_AttributeType.AttributeTypeDesc; dr[count + 5] = item.AttributeID; dr["Function/Module"] = moduleName; dr["Requirement Reference"] = item.tbl_TxnAttributeMapping.Where(q => q.AttributeID == item.AttributeID).Select(q => q.ReqReference).FirstOrDefault(); // dr["isLinked"] = item.tbl_TxnAttributeMapping.Select(q => q.isLinked); int i = count + 6; foreach (var item1 in item.tbl_AttributeValues) { dr[i] = item1.AttributeValue; i++; } dt.Rows.Add(dr); } return(dt); } catch (Exception) { throw; } }