public SectionModel Create() { SectionModel sectionModel = new SectionModel { NeedFooterPointer = true, HeaderName = "COIN PACKS", SectionTypeEnum = SectionTypeEnum.SoftCurrency }; sectionModel.UiItems = new ProductModel[2][]; //первая строка sectionModel.UiItems[0] = new[] { factory.Create(150, 20, "coins5"), factory.Create(400, 50, "coins10") }; //вторая строка sectionModel.UiItems[1] = new[] { factory.Create(1200, 140, "coins25"), factory.Create(2600, 280, "coins30") }; return(sectionModel); }
private void threadSearchByProductionNumber_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { this.Cursor = null; btnSearchbyProductionNumber.IsEnabled = true; if (e.Error != null) { MessageBox.Show(e.Error.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } productionMemoList = e.Result as List <ProductionMemoModel>; List <ProductionMemoModel> productionMemoViewList = new List <ProductionMemoModel>(); foreach (ProductionMemoModel productionMemo in productionMemoList) { ProductionMemoModel productionMemoView = new ProductionMemoModel { MemoId = productionMemo.MemoId, }; productionMemoView.SectionId = ""; SectionModel section = sectionList.Where(s => s.SectionId == productionMemo.SectionId).FirstOrDefault(); if (section != null) { productionMemoView.SectionId = section.Name; } productionMemoViewList.Add(productionMemoView); } dgProductionMemo.ItemsSource = productionMemoViewList; }
public SectionModel mFillDatasetImageData(SectionModel _SectionModel) { string[] sSectionShp = Directory.GetFiles(_SectionModel.sFolderName, "dataset_image_data.shp"); _SectionModel.sSectionShp_FileName = sSectionShp[0]; string[] sMapShp = Directory.GetFiles(_SectionModel.sFolderName, "*.shp"); sMapShp = sMapShp.Where(val => val != _SectionModel.sSectionShp_FileName).ToArray(); _SectionModel.sMapShp_FileName = sMapShp; string[] sConnectBin = Directory.GetFiles(_SectionModel.sFolderName, "*.bin"); _SectionModel.sConnectBin_FileName = sConnectBin[0]; string[] sFolderStructTxt = Directory.GetFiles(_SectionModel.sFolderName, "*.txt"); _SectionModel.sFolderStructTxt_FileName = sFolderStructTxt[0]; Console.WriteLine("========================================================"); Console.WriteLine($"sSectionShp_FileName : {_SectionModel.sSectionShp_FileName}"); foreach (var shp in sMapShp) { Console.WriteLine($"sMapShp_FileName : {shp}"); } Console.WriteLine($"sConnectBin_FileName : {_SectionModel.sConnectBin_FileName}"); Console.WriteLine($"sFolderStructTxt_FileName : {_SectionModel.sFolderStructTxt_FileName}"); Console.WriteLine("========================================================"); return(_SectionModel); }
public ActionResult UpdateOrSaveSectionAction(int?id, string section_name, string section_title, string section_description, string section_content, string section_type, string rel_group) { return(RunActionWhenLogin((loginuser) => { id = id ?? 0; var model = new SectionModel(); model.SectionID = id.Value; model.SectionName = section_name; model.SectionTitle = section_title; model.SectionDescription = section_description; model.SectionContent = section_content; model.SectionType = section_type; model.RelGroup = rel_group; model.UpdateTime = DateTime.Now; var res = string.Empty; if (model.SectionID > 0) { //update res = _IPageService.UpdateSection(model); } else { //add res = _IPageService.AddSection(model); } return GetJsonRes(res); })); }
public async Task <IActionResult> Edit(int id, [Bind("SectionModelId,SpaceModelId,SeatPrices,Name")] SectionModel sectionModel) { // if (id != sectionModel.SectionModelId) // { // return NotFound(); // } // // if (ModelState.IsValid) // { // try // { // _context.Update(sectionModel); // await _context.SaveChangesAsync(); // } // catch (DbUpdateConcurrencyException) // { // if (!SectionModelExists(sectionModel.SectionModelId)) // { // return NotFound(); // } // else // { // throw; // } // } // return RedirectToAction(nameof(Index)); // } // ViewData["SpaceModelId"] = new SelectList(_context.Lokacije, "SpaceModelId", "SpaceModelId", sectionModel.SpaceModelId); // return View(sectionModel); return(null); }
public IActionResult AddSection(SectionCreateVM model) { int size = _context.Sections.Where(x => x.CourseId == model.CourseId && x.ParentSectionId == model.ParentSectionId).Count(); if (ModelState.IsValid) { if (model.Id > 0) { var entity = _context.Sections.FirstOrDefault(x => x.Id == model.Id); if (entity != default) { entity.Name = model.Name; _context.Update(entity); } } else { var entity = new SectionModel { Id = model.Id, CourseId = model.CourseId, Name = model.Name, ParentSectionId = model.ParentSectionId, DisplayOrder = size + 1 }; _context.Add(entity); } _context.SaveChanges(); return(RedirectToAction(nameof(Edit), new { id = model.CourseId })); } else { return(View(model)); } }
public bool Validate(SectionModel sectionModel) { ProductSizeEnum?sectionItemsSize = null; foreach (ProductModel[] line in sectionModel.UiItems) { foreach (ProductModel itemModel in line) { if (sectionItemsSize == null) { sectionItemsSize = itemModel.ProductSizeEnum; } else if (itemModel.ProductSizeEnum != sectionItemsSize) { //В одном разделе есть объекты разного размера //я к такому пока не готов return(false); } //У товара нет идентификатора if (itemModel.Id == 0) { log.Error($"{nameof(Validate)} {nameof(itemModel.Id)} is null." + $" {nameof(itemModel.ResourceTypeEnum)} {itemModel.ResourceTypeEnum}"); } } } return(true); }
public SectionForm(TreeNode treeNode, SectionModel sectionModel, bool isChanging) { InitializeComponent(); _treeNode = treeNode; _sectionModel = sectionModel; _isChanging = isChanging; }
public List <SectionModel> GetSections() { string getSectionCommandString = "SELECT Name_Section, Risk_Section FROM Section"; var sections = new List <SectionModel>(); using (SqlConnection sqlConnection = new SqlConnection(connectionStringSQL)) { sqlConnection.Open(); SqlCommand GetSectionCommand = new SqlCommand(getSectionCommandString, sqlConnection); SqlDataReader dataReaderSection = GetSectionCommand.ExecuteReader(); while (dataReaderSection.Read()) { var section = new SectionModel { NameSection = dataReaderSection["Name_Section"] as string, RiskSection = Convert.ToInt32(dataReaderSection["Risk_Section"]) }; sections.Add(section); } dataReaderSection.Close(); sqlConnection.Close(); } return(sections); }
public ActionResult EditSection(int id) { CMSHandler CMSH = new CMSHandler(); CMSDataContext db = new CMSDataContext(); //Get the only one article to edit Section sectionToEdit = db.Sections.Single(p => p.Id == id); if (!(Roles.IsUserInRole(sectionToEdit.Role))) { Session["tempforview"] = "You dont have a permission to edit this article"; return(RedirectToAction("Login", "Account")); } //prepare data from db SectionModel sectionModel = new SectionModel(); sectionModel.BakeryId = sectionToEdit.BakeryId; sectionModel.Name = sectionToEdit.Name; sectionModel.Description = sectionToEdit.Description; //getdropdown list of roles and select previous role as a default sectionModel.Ids = CMSH.getDropDownListBakeryIDs(int.Parse(Session["id"].ToString())); sectionModel.Roles = CMSH.getDropDownListRoles(sectionToEdit.Role); return(View(sectionModel)); }
public ActionResult GetSectionDTable() { SectionModel model = new SectionModel(); var SQLQuery = @"SELECT Tbl_FMRes_Section.*, Tbl_FMRes_Function.FunctionTitle, Tbl_FMRes_Department.DeptTitle FROM Tbl_FMRes_Section INNER JOIN Tbl_FMRes_Function ON Tbl_FMRes_Section.FunctionID = Tbl_FMRes_Function.FunctionID INNER JOIN Tbl_FMRes_Department ON Tbl_FMRes_Function.DeptID = Tbl_FMRes_Department.DeptID "; using (SqlConnection Connection = new SqlConnection(GlobalFunction.ReturnConnectionString())) { Connection.Open(); using (SqlCommand command = new SqlCommand("[dbo].[SP_FMResponsibility]", Connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@SQLStatement", SQLQuery)); SqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { model.getSectionList.Add(new SectionList() { SectionID = GlobalFunction.ReturnEmptyInt(dr[0]), SectionTitle = GlobalFunction.ReturnEmptyString(dr[1]), FunctionTitle = GlobalFunction.ReturnEmptyString(dr[4]), DeptTitle = GlobalFunction.ReturnEmptyString(dr[5]), }); } } Connection.Close(); } return(PartialView("SectionTab/_TableSection", model.getSectionList)); }
/// <summary> /// Scores a section. Returns 1)Available 2)Earned, and 3)percentage /// </summary> public static Tuple <double, double, double> ScoreSection(SectionModel section, Inspection inspection) { List <ScoredQuestion> scores = inspection.scores; List <ScoredQuestion> RelevantScores = scores.Where(score => score.question.SectionId == section.Id && score.question.IsScorable()).ToList(); return(ScoreQuestions(RelevantScores)); }
public ActionResult GetSectionForm(int ActionID, int SectionID) { SectionModel model = new SectionModel(); if (ActionID == 2) { Tbl_FMRes_Section sectionTbl = (from a in BOSSDB.Tbl_FMRes_Section where a.SectionID == SectionID select a).FirstOrDefault(); model.SectionList.SectionTitle = sectionTbl.SectionTitle; model.SectionList.FunctionID = GlobalFunction.ReturnEmptyInt(sectionTbl.FunctionID); model.SectionList.DeptID = GlobalFunction.ReturnEmptyInt(sectionTbl.Tbl_FMRes_Function.Tbl_FMRes_Department.DeptID); model.SectionList.SectionID = sectionTbl.SectionID; var functionList = (from a in BOSSDB.Tbl_FMRes_Function where a.DeptID == model.SectionList.DeptID orderby a.FunctionTitle select a).ToList(); model.FunctionList = new SelectList(functionList, "FunctionID", "FunctionTitle"); } else { model.SectionList.DeptID = (from a in BOSSDB.Tbl_FMRes_Department orderby a.DeptTitle select a.DeptID).FirstOrDefault(); var functionList = (from a in BOSSDB.Tbl_FMRes_Function where a.DeptID == model.SectionList.DeptID orderby a.FunctionTitle select a).ToList(); model.FunctionList = new SelectList(functionList, "FunctionID", "FunctionTitle"); } model.DeptList = new SelectList(BOSSDB.Tbl_FMRes_Department, "DeptID", "DeptTitle"); model.DeptList = (from li in model.DeptList orderby li.Text select li).ToList(); model.ActionID = ActionID; return(PartialView("SectionTab/_SectionForm", model)); }
public List <SectionModel> GetSections(List <int> sectionIds, string connectionString, int tenantId) { using (var context = CreateContext(connectionString, tenantId)) { var sections = context.Sections.Where(i => sectionIds.Contains(i.SectionId)); if (sections.Any()) { List <SectionModel> sectionModelList = new List <SectionModel>(); foreach (var section in sections) { var sectionModel = new SectionModel { SectionId = section.SectionId, SeatsPerRow = section.SeatsPerRow, SectionName = section.SectionName, SeatRows = section.SeatRows, StandardPrice = section.StandardPrice }; sectionModelList.Add(sectionModel); } return(sectionModelList); } } return(null); }
public List<SectionModel> GetSections() { // Get sections from TestRail var sectionsJson = (JArray)SendRequest(_testRailApiClient.SendGet, "get_sections/" + _testRailProjectId, null); // Format sections list var sections = new List<SectionModel>(); foreach (var sectionJson in sectionsJson) { var section = new SectionModel { Name = (string)sectionJson["name"], Description = (string)sectionJson["description"], Depth = (int)sectionJson["depth"], Id = (int)sectionJson["id"], ParentId = (int?)sectionJson["parent_id"] }; sections.Add(section); } // Update each section with the root section sections.ForEach(s => s.RootSectionId = s.GetRootSection(sections).Id); return sections; }
private void insertTasksFor(ProjectSuggestion projectSuggestion) { var indexOfTargetSection = suggestionsSubject.Value.IndexOf(section => section.Header == projectSuggestion.WorkspaceName); if (indexOfTargetSection < 0) { return; } var targetSection = suggestionsSubject.Value.ElementAt(indexOfTargetSection); var indexOfSuggestion = targetSection.Items.IndexOf(project => project == projectSuggestion); if (indexOfSuggestion < 0) { return; } var newItemsInSection = targetSection.Items.InsertRange(indexOfSuggestion + 1, projectSuggestion.Tasks.OrderBy(task => task.Name)); var newSection = new SectionModel <string, AutocompleteSuggestion>(targetSection.Header, newItemsInSection); var newSuggestions = suggestionsSubject.Value.ToList(); newSuggestions[indexOfTargetSection] = newSection; suggestionsSubject.OnNext(newSuggestions); }
protected void Load(SectionModel[] sectionModels) { foreach (var section in sectionModels) { foreach (var token in section.Tokens) { _translations.Add(string.Format(KeyFormat, section.Language, section.Id, token.Id), token.Val); } } }
protected virtual void onAddItem(SectionModel sec) { }