private void preferencesBTN_Click(object sender, EventArgs e) { var selectedNode = itemsTV.SelectedNode; if (selectedNode == null || selectedNode.Tag == null) { return; } if (selectedNode.Tag.GetType() == typeof(ServerLog)) { var server = (ServerLog)selectedNode.Tag; using (var frm = new IAADL_App.Forms.ServerForm()) { frm.EditServerDialog(server); selectedNode.Text = server.Name; } } else if (selectedNode.Tag.GetType() == typeof(GroupLog)) { var group = (GroupLog)selectedNode.Tag; var editGroupForm = new GroupForm(group); if (editGroupForm.ShowDialog() != DialogResult.OK) { return; } // add node. selectedNode.Text = group.Name; } }
//private void dgvCustomerInfor_CellDoubleClick(object sender, DataGridViewCellEventArgs e) //{ // User user = new User(); // user.UserName = ""; // user.Telephone = ""; // user.CarRequirement = ""; // user.Id = Convert.ToInt32(dgvCustomerInfor.CurrentRow.Cells["CustomerId"].Value.ToString()); // dgvUserRequrement.DataSource = userBLL.SelectbyUser(user); //} private void dgvGroupList_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dgvGroupList.Columns[e.ColumnIndex].Name == "btnEditGroup") { Group groupEdit = new Group(); groupEdit.Id = Convert.ToInt32(dgvGroupList.CurrentRow.Cells[2].Value.ToString()); groupEdit.GroupName = dgvGroupList.CurrentRow.Cells[3].Value.ToString(); groupEdit.CreatTime = DateTime.Now.ToString(); GroupForm carEditForm = new GroupForm(groupEdit, this); carEditForm.Show(); } if (dgvGroupList.Columns[e.ColumnIndex].Name == "btnDeleteGroup") { Group groupEdit = new Group(); groupEdit.Id = Convert.ToInt32(dgvGroupList.CurrentRow.Cells[2].Value.ToString()); try { groupBLL.DeleteByGroup(groupEdit); MessageBox.Show("删除成功"); dgvGroupList.DataSource = groupBLL.FindAllInfo(); } catch (Exception ex) { MessageBox.Show("删除分组失败:" + ex.Message); } } }
private void GroupButton_Click(object sender, EventArgs e) { var groupForm = new GroupForm(this); groupForm.StartPosition = FormStartPosition.Manual; groupForm.Location = Location; groupForm.Show(); Hide(); }
public JsonResult Form(GroupForm form, HttpPostedFileBase image, string imagePath) { if (image != null && image.ContentLength > 0) { var driveService = GoogleDriveService.GetDriveService(); var fileID = GoogleDriveService.uploadFile(driveService, image.InputStream, image.FileName, imagePath); form.ImageUrl = fileID; } return(SaveChanges(form, Facade <GroupFacade>().AddGroup)); }
public ProjectManagerForm() { AfterSet = () => { Title.Text = "Vivid Project Manager"; if (NewProject == null) { LoadProject = new ButtonForm().Set(5, 35, 120, 25, "Edit Project") as ButtonForm; NewProject = new ButtonForm().Set(5, 5, 120, 25, "New Project") as ButtonForm; DeleteProject = new ButtonForm().Set(5, 65, 120, 25, "Delete Project") as ButtonForm; var projGroup = new GroupForm().Set(5, 5, 250, 400) as GroupForm; Body.Add(projGroup); var projInfoGroup = new GroupForm().Set(260, 5, 405, 500) as GroupForm; Body.Add(projInfoGroup); projGroup.Add(NewProject); projGroup.Add(LoadProject); projGroup.Add(DeleteProject); LoadProject.Click = (b) => { var cp = ProjectTree.Selected; Console.WriteLine("Editing Project:" + cp.TextData[0] + " Type:" + cp.TextData[2]); switch (cp.TextData[2]) { case "GameMap": EditProject(cp.TextData[0], Vivid.Project.ProjectType.GameMap); break; } }; NewProject.Click = (b) => { var new_proj = new NewProjectForm().Set(AppInfo.W / 2 - 200, AppInfo.H / 2 - 150, 400, 300, "New Project") as NewProjectForm; UI.CurUI.Top = new_proj; }; ProjectTree = new TreeViewForm().Set(AppInfo.W - 350, 10, 320, 450, "") as TreeViewForm; ProjectTree.Root = new TreeNode("Projets"); Body.Add(ProjectTree); } }; }
public int SaveChanges(GroupForm form) { var tGroup = Table <Group>(); var group = tGroup.GetOrAdd(w => w.ID == form.ID); MapProperty(form, group, form.InlineEditProperty); UpdateAuditFields(group, form.ByUserID); // save SaveChanges(); return(group.ID); }
private void groupEditB_Click(object sender, EventArgs e) { editGroupIndex = settingsGroupDefinitions.SelectedIndex; if (editGroupIndex < 0) { return; } string editGroupLabel = settingsGroupDefinitions.Items[editGroupIndex].ToString(); using (GroupForm form = new GroupForm()) { form.groupName.Text = editGroupLabel; foreach (string option in tempGroups[editGroupLabel]) { form.groupOptions.Items.Add(option); } form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { int duplicateLocation = settingsGroupDefinitions.FindStringExact(form.groupName.Text); if (duplicateLocation > -1 && duplicateLocation != editGroupIndex) { MessageBox.Show("Duplicate for key: " + form.groupName.Text); editGroupIndex = -1; return; } if (duplicateLocation > -1) { // name is same tempGroups[editGroupLabel] = form.groupOptions.Items.Cast <string>().ToList(); } else { tempGroups.Remove(editGroupLabel); settingGroupBy.Items.Remove(editGroupLabel); editGroupLabel = form.groupName.Text; tempGroups.Add(editGroupLabel, form.groupOptions.Items.Cast <string>().ToList()); settingsGroupDefinitions.Items[editGroupIndex] = editGroupLabel; settingGroupBy.Items.Add(form.groupName.Text); } } } editGroupIndex = -1; }
private void buttonEdit_Click(object sender, EventArgs e) { if (listViewGroups.SelectedItems.Count <= 0) { return; } int groupIndex = listViewGroups.SelectedItems[0].Index; Group group = this.journal.groups[groupIndex]; GroupForm groupForm = new GroupForm(group); groupForm.ShowDialog(); RedRawGroups(); }
private void btnAddGroup_Click(object sender, EventArgs e) { var tour = _tours.Where(m => m.Id.Equals(Int32.Parse(gridViewTour.SelectedRows[0].Cells[0].Value.ToString()))).First(); var dialog = new GroupForm(_unitOfWork, _tourAnalysisService, tour, null, false); var check = dialog.ShowDialog(); if (check.Equals(DialogResult.OK)) { MessageBox.Show("Thêm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); var tourId = Int32.Parse(this.gridViewTour.SelectedRows[0].Cells["Id"].Value.ToString()); var groups = _unitOfWork.Tours.GetGroupsByTourId(tourId); this.LoadGroupGridView(groups, _selectedGroupIndex); } dialog.Dispose(); }
private void dgvListGroups_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { try { int currentRow = e.RowIndex; if (currentRow != -1) { var idGroup = Convert.ToInt32(dgvListGroups.Rows[currentRow].Cells["GroupId"].Value); Group currentGroup; using (var db = new IstraContext()) { currentGroup = db.Groups.FirstOrDefault(a => a.Id == idGroup); } if (currentGroup != null) { var groupForm = new GroupForm(currentGroup); groupForm.MdiParent = this.MdiParent; groupForm.Show(); Filter((int?)cbDirectionOfTraining.SelectedValue, tbNameGroup.Text, (int?)cbTypeGroup.SelectedValue, (int?)cbTeachers.SelectedValue, cbActivity.Text, sortColumn, sortOrder); if (currentRow != dgvListGroups.Rows.Count) { if (dgvListGroups.Rows.Count != 0) { dgvListGroups.Rows[currentRow].Selected = true; dgvListGroups.CurrentCell = dgvListGroups.Rows[currentRow].Cells["Name"]; } } else { dgvListGroups.Rows[dgvListGroups.Rows.Count - 1].Selected = true; dgvListGroups.CurrentCell = dgvListGroups.Rows[currentRow].Cells["Name"]; } } else { MessageBox.Show("Не удалось найти группу в базе данных", "Ошибка", MessageBoxButtons.OK); } } } catch (Exception ex) { var m = new System.Diagnostics.StackTrace(false).GetFrame(0).GetMethod(); string methodName = m.DeclaringType.ToString() + ";" + m.Name; CurrentSession.ReportError(methodName, ex.Message); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public List <GroupForm> getGroupForm() { DataTable data = ConnectionDB.getData("Select[Form_ID], [Form_Name] from[SYS_FORM]"); List <GroupForm> list = new List <GroupForm>(); for (int i = 0; i < data.Rows.Count; i++) { string form_id = data.Rows[i]["Form_ID"].ToString(); string form_name = data.Rows[i]["Form_Name"].ToString(); var groupForm = new GroupForm(); groupForm.formID = form_id; groupForm.formName = form_name; list.Add(groupForm); // có được danh sách gồm các nhóm và ID nhóm Form } return(list); }
private void GroupAddToolStripMenuItem2_Click(object sender, EventArgs e) { GroupForm groupForm = new GroupForm(); List <Commission> commissions = db.Commissions.ToList(); //принимаем данные с таблицы комиссии //подключаем данные и выводим список комиссий в comboBox1 groupForm.comboBox1.DataSource = commissions; groupForm.comboBox1.ValueMember = "ComId"; groupForm.comboBox1.DisplayMember = "ComName"; if (groupForm.ShowDialog() == DialogResult.OK) { db.Groups.Add(groupForm.Groups); db.SaveChanges(); } }
/// <summary> /// 命令执行 /// </summary> /// <param name="context"></param> public override void Execute(DataContext context) { byte[] cmdData = context.CmdData; if (cmdData.Length == 0) { context.Flush(RespondCode.CmdDataLack); return; } GroupForm form = cmdData.ProtoBufDeserialize <GroupForm>(); if (Compiled.Debug) { form.Debug("=== Social.GroupMembers 上行数据==="); } string groupName = form.GroupName ?? "未命名圈子"; string interest = string.Empty; if (form.Interest != null) { interest = form.Interest.ToString(); } byte[] iconData = null; string iconExt = ".jpg"; if (null != form.GroupIcon) { iconData = form.GroupIcon.Data; iconExt = form.GroupIcon.Name ?? ".jpg"; } GroupInfo groupInfo = SocialBiz.CreateGroup(context.UserId, groupName, interest, iconData, iconExt); if (null != groupInfo) { context.Flush <GroupBase>(groupInfo.ToGroupBase()); } else { context.Flush(RespondCode.ExecError); } }
void editGroupFormShown(object sender, EventArgs e) { GroupForm form = sender as GroupForm; PwGroup group = null; TabControl mainTabControl = null; //This might not work, especially in .NET 2.0 RTM, a shame but more //up to date users might as well use the feature if possible. try { FieldInfo fi = typeof(GroupForm).GetField("m_pwGroup", BindingFlags.NonPublic | BindingFlags.Instance); group = (PwGroup)fi.GetValue(form); Control[] cs = form.Controls.Find("m_tabMain", true); if (cs.Length == 0) { return; } mainTabControl = cs[0] as TabControl; } catch { // that's life, just move on. return; } if (group == null) { return; } lock (_lockRPCClientManagers) { //TODO2: Only consider managers of client types that have at least one valid client already authorised foreach (KeePassRPCClientManager manager in _RPCClientManagers.Values) { if (manager.Name != "Null") { manager.AttachToGroupDialog(this, group, mainTabControl); } } } }
//Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) //{ // MessageBox.Show("assembly: " + args.Name); // AssemblyName name = new AssemblyName(args.Name); // if (name.Name == "System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") // { // return typeof(System.Web.HttpApplication).Assembly; // } // return null; //} void GlobalWindowManager_WindowAdded(object sender, GwmWindowEventArgs e) { //return; // not in 0.8 (soon after hopefully...) PwEntryForm ef = e.Form as PwEntryForm; if (ef != null) { ef.Shown += new EventHandler(editEntryFormShown); return; } GroupForm gf = e.Form as GroupForm; if (gf != null) { gf.Shown += new EventHandler(editGroupFormShown); return; } }
private void lsb_groups_MouseDoubleClick(object sender, MouseEventArgs e) { if (lsb_groups.SelectedItem.ToString() == null) { return; } String groupName = lsb_groups.SelectedItem.ToString(); ChaitProtocol.Client.ChaitClient.Instance.JoinGroup(groupName); if (groupChatForms.Keys.Contains(groupName)) { groupChatForms[groupName].BringToFront(); } else { GroupForm gcf = new GroupForm(); gcf.Text = groupName; groupChatForms.Add(groupName, gcf); gcf.Show(); } }
private void groupAddB_Click(object sender, EventArgs e) { using (GroupForm form = new GroupForm()) { form.groupName.Text = "New Group"; form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { if (settingsGroupDefinitions.FindStringExact(form.groupName.Text) > -1) { MessageBox.Show("Duplicate for key: " + form.groupName.Text); return; } tempGroups.Add(form.groupName.Text, form.groupOptions.Items.Cast <string>().ToList()); settingsGroupDefinitions.Items.Add(form.groupName.Text); settingGroupBy.Items.Add(form.groupName.Text); } } }
public void Updating_feed_url_test() { using (var uow = UnitOfWorkFactory.Create <NovelContext>()) { var service = new GroupService(uow); var groupsWithFeedUrl = service.View <Connector>().Where(w => w.ConnectorType == R.ConnectorType.GROUP_FEED).Select(s => s.SourceID).ToList(); var groupsWithoutFeedUrl = service.View <Group>().Where(w => !string.IsNullOrEmpty(w.Url) && !groupsWithFeedUrl.Contains(w.ID)).ToList(); foreach (var g in groupsWithoutFeedUrl.Where(w => w.Url.Contains("blogspot"))) { var groupForm = new GroupForm { ID = g.ID, InlineEditProperty = "Feeds", Feeds = new Feed[] { new Feed { Url = g.Url.Trim(new[] { '/', ' ' }) + "/feeds/posts/default?alt=rss" } } }; service.SaveChanges(groupForm); } } }
void editGroupFormShown(object sender, EventArgs e) { GroupForm form = sender as GroupForm; PwGroup group = null; TabControl mainTabControl = null; //This might not work, especially in .NET 2.0 RTM, a shame but more //up to date users might as well use the feature if possible. try { FieldInfo fi = typeof(GroupForm).GetField("m_pwGroup", BindingFlags.NonPublic | BindingFlags.Instance); group = (PwGroup)fi.GetValue(form); Control[] cs = form.Controls.Find("m_tabMain", true); if (cs.Length == 0) { return; } mainTabControl = cs[0] as TabControl; } catch { // that's life, just move on. return; } if (group == null) { return; } lock (_lockRPCClientManagers) { _lockRPCClientManagers.HeldBy = Thread.CurrentThread.ManagedThreadId; _RPCClientManagers["general"].AttachToGroupDialog(this, group, mainTabControl); } }
private void добавитьГруппуToolStripMenuItem_Click(object sender, EventArgs e) { var groupForm = new GroupForm(null); groupForm.ShowDialog(); }
/// <summary> /// Initializes the GUI components. /// </summary> void InitializeGUI() { // Set up the fonts _guiFont = GameScreenHelper.DefaultGameGUIFont; GUIManager.Font = _guiFont; GUIManager.Tooltip.Font = _guiFont; Character.NameFont = _guiFont; _cScreen = new Panel(GUIManager, Vector2.Zero, ScreenManager.ScreenSize) { CanFocus = true }; // Set up all the forms used by this screen _statsForm = new StatsForm(UserInfo, _cScreen); _statsForm.RequestRaiseStat += StatsForm_RequestRaiseStat; _inventoryForm = new InventoryForm(_dragDropHandler, x => x == UserInfo.Inventory, InventoryInfoRequester, new Vector2(250, 0), _cScreen); _inventoryForm.RequestDropItem += InventoryForm_RequestDropItem; _inventoryForm.RequestUseItem += InventoryForm_RequestUseItem; _shopForm = new ShopForm(_dragDropHandler, new Vector2(250, 0), _cScreen); _shopForm.RequestPurchase += ShopForm_RequestPurchase; _skillsForm = new SkillsForm(SkillCooldownManager, new Vector2(100, 0), _cScreen, UserInfo.KnownSkills); _skillsForm.RequestUseSkill += SkillsForm_RequestUseSkill; _infoBox = new InfoBox(GameData.ScreenSize - new Vector2(5, 5), _guiFont); _equippedForm = new EquippedForm(_dragDropHandler, EquipmentInfoRequester, new Vector2(500, 0), _cScreen); _equippedForm.RequestUnequip += EquippedForm_RequestUnequip; _chatForm = new ChatForm(_cScreen, new Vector2(0, _cScreen.Size.Y)); _chatForm.Say += ChatForm_Say; _chatDialogForm = new NPCChatDialogForm(new Vector2(50, 50), _cScreen); _chatDialogForm.SelectResponse += ChatDialogForm_SelectResponse; _chatDialogForm.RequestEndDialog += ChatDialogForm_RequestEndDialog; _statusEffectsForm = new StatusEffectsForm(_cScreen, new Vector2(_cScreen.Size.X, 0), this); _quickBarForm = new QuickBarForm(this, _cScreen, _cScreen.Position); _guildForm = new GuildForm(_cScreen, new Vector2(100, 100)) { GuildInfo = UserInfo.GuildInfo, IsVisible = false }; _guildForm.JoinRequested += _guildForm_JoinRequested; _guildForm.LeaveRequested += _guildForm_LeaveRequested; _groupForm = new GroupForm(_cScreen, new Vector2(50, 350), new Vector2(150, 150)) { GroupInfo = UserInfo.GroupInfo }; Func <QuestID, bool> questStartReqs = x => UserInfo.HasStartQuestRequirements.HasRequirements(x) ?? false; Func <QuestID, bool> questFinishReqs = x => UserInfo.QuestInfo.ActiveQuests.Contains(x) && (UserInfo.HasFinishQuestRequirements.HasRequirements(x) ?? false); _availableQuestsForm = new AvailableQuestsForm(_cScreen, new Vector2(200), new Vector2(250, 350), questStartReqs, questFinishReqs); _availableQuestsForm.QuestAccepted += availableQuestsForm_QuestAccepted; _latencyLabel = new Label(_cScreen, new Vector2(_cScreen.ClientSize.X - 75, 5)) { Text = string.Format(_latencyString, 0), ForeColor = Color.White }; _skillCastProgressBar = new SkillCastProgressBar(_cScreen); var toolbar = new Toolbar(_cScreen, new Vector2(200, 200)); toolbar.ItemClicked += Toolbar_ItemClicked; var gameMenu = new GameMenuForm(_cScreen); gameMenu.ClickedLogOut += GameMenuClickedLogOut; _peerTradeForm = new PeerTradeForm(_cScreen, new Vector2(200)) { PeerTradeInfoHandler = Socket.PacketHandler.PeerTradeInfoHandler }; // Add the forms to the GUI settings manager (which also restores any existing settings) _guiStatePersister = new GUIStatePersister("Default"); // FUTURE: Allow changing of the profile _guiStatePersister.Add("InventoryForm", _inventoryForm); _guiStatePersister.Add("EquippedForm", _equippedForm); _guiStatePersister.Add("StatsForm", _statsForm); _guiStatePersister.Add("ChatForm", _chatForm); _guiStatePersister.Add("ToolbarForm", toolbar); _guiStatePersister.Add("GuildForm", _guildForm); _guiStatePersister.Add("StatusEffectsForm", _statusEffectsForm); _guiStatePersister.Add("SkillsForm", _skillsForm); _guiStatePersister.Add("QuickBarForm", _quickBarForm); _guiStatePersister.Add("PeerTradeForm", _peerTradeForm); // Set the focus to the screen container _cScreen.SetFocus(); }
private void ToolStripMenuItemGroup_Click(object sender, EventArgs e) { GroupForm form = new GroupForm(this); form.ShowDialog(); }
public int AddGroup(GroupForm form) { using (var uow = UnitOfWorkFactory.Create <NovelContext>()) { var service = new GroupService(uow); var id = service.SaveChanges(form); var connectorService = new ConnectorService(uow); if (form.Feeds != null || form.InlineEditProperty == form.PropertyName(m => m.Feeds)) { var feedService = new FeedService(uow); foreach (var feed in form.Feeds) { feed.UrlHash = feed.Url.GetIntHash(); feed.Status = feed.Status == 0 ? R.FeedStatus.ACTIVE : feed.Status; feed.LastSuccessDate = DateTime.Now.AddYears(-10); var feedForm = new GenericForm <Feed> { ByUserID = form.ByUserID, DataModel = feed }; var feedID = feedService.SaveChanges(feedForm); // add to connector only if it a new feed if (feed.ID == 0) { // connect series to feed var connectorForm = new ConnectorForm() { ByUserID = form.ByUserID, ConnectorType = R.ConnectorType.GROUP_FEED, SourceID = id, TargetID = feedID }; connectorService.SaveChanges(connectorForm); } } } if (form.Glossaries != null && form.InlineEditProperty == form.PropertyName(m => m.Glossaries)) { foreach (var glossary in form.Glossaries) { var glossaryService = new GlossaryService(uow); var glossaryForm = new GlossaryForm(); new PropertyMapper <Glossary, GlossaryForm>(glossary, glossaryForm).Map(); glossaryForm.ByUserID = form.ByUserID; var glossaryID = glossaryService.SaveChanges(glossaryForm); // connect group to glossary var connectorForm = new ConnectorForm() { ByUserID = form.ByUserID, ConnectorType = R.ConnectorType.GROUP_GLOSSARY, SourceID = id, TargetID = glossaryID }; connectorService.SaveChanges(connectorForm); } } return(id); } }
private void SelectionButton_Click(object sender, EventArgs e) { var groupForm = new GroupForm(teams); groupForm.ShowDialog(); }
public async Task <IActionResult> SaveGroup([FromBody] GroupForm model) { try { if (model == null || model.group == null) { return(Ok(new ConsumptionResponse() { success = false, message = "请求参数有误" })); } var newgroup = model.group; if (newgroup.Id > 0) { //ID存在为更新,需要处理是否真实存在? var group = await work.GetRepository <Group>() .GetFirstOrDefaultAsync(predicate: x => x.Id == newgroup.Id); if (group == null) { return(Ok(new ConsumptionResponse() { success = false, message = "该用户组已不存在。" })); } group.GroupName = newgroup.GroupName; work.GetRepository <Group>().Update(group); #region 更新组用户 //查询组下已存在的用户 var groupUsers = await work.GetRepository <GroupUser>().GetAllAsync(predicate: x => x.GroupCode == group.GroupCode); for (int i = 0; i < groupUsers.Count; i++) { var arg = groupUsers[i]; //如果数据库存在的用户在更新列表当中查不到,代表删除,否则新增 var u = model.groupUser?.FirstOrDefault(t => t.Id == arg.Id); if (u == null) { work.GetRepository <GroupUser>().Delete(arg); } } #endregion #region 更新组模块 //查询组下已存在的模块 var groupFuncs = await work.GetRepository <GroupFunc>().GetAllAsync(predicate: x => x.GroupCode == group.GroupCode); for (int i = 0; i < groupFuncs.Count; i++) { var arg = groupFuncs[i]; var u = model.groupFunc?.FirstOrDefault(t => t.Id == arg.Id); if (u == null) { work.GetRepository <GroupFunc>().Delete(arg); } else //如果存在,那么更新模块内容 { arg.Auth = u.Auth; work.GetRepository <GroupFunc>().Update(arg); model.groupFunc.Remove(u);//移除 } } #endregion } else { var group = await work.GetRepository <Group>() .GetFirstOrDefaultAsync(predicate: x => x.GroupCode == newgroup.GroupCode || x.GroupName == newgroup.GroupName); if (group != null) { return(Ok(new ConsumptionResponse() { success = false, message = "组编号/名称已重复,请勿重复添加!" })); } //添加组信息 work.GetRepository <Group>().Insert(newgroup); } //添加新增组用户信息 model.groupUser?.ForEach(u => { u.GroupCode = newgroup.GroupCode; work.GetRepository <GroupUser>().Insert(u); }); //添加新增组模块信息 model.groupFunc?.ForEach(f => { f.GroupCode = newgroup.GroupCode; work.GetRepository <GroupFunc>().Insert(f); }); if (await work.SaveChangesAsync() > 0) { return(Ok(new ConsumptionResponse() { success = true })); } return(Ok(new ConsumptionResponse() { success = false, message = "新增组数据错误" })); } catch (Exception ex) { logger.LogDebug(ex, ""); return(Ok(new ConsumptionResponse() { success = false, message = "新增组异常" })); } }
private void BtnGroup_Click(object sender, EventArgs e) { GroupForm groupForm = new GroupForm(); groupForm.ShowDialog(); }
private void Change_Click(object sender, EventArgs e) { if (dataGridView.SelectedCells.Count == 0) { MessageBox.Show("Виберіть хочаб одну строку в таблиці", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } // идентификатор записи // вызываем форму таблиц и редактируем выделенную строку var id = dataGridView.SelectedRows[0].Cells[0].Value; List <Commission> commissions = db.Commissions.ToList(); //принимаем данные с таблицы комиссии List <Subjects> subjects = db.Subjects.ToList(); //принимаем данные с таблицы предметов if (typeof(T) == typeof(Subjects)) { var subject = set.Find(id) as Subjects; if (subject != null) { var form = new SubjectForm(subject); if (form.ShowDialog() == DialogResult.OK) { subject = form.Subject; db.SaveChanges(); dataGridView.Refresh(); } } } else if (typeof(T) == typeof(Teacher)) { var teacher = set.Find(id) as Teacher; if (teacher != null) { TeacherForm teacherForm = new TeacherForm(teacher); //подключаем данные и выводим список комиссий в comboBox1 teacherForm.comboBox1.DataSource = commissions; teacherForm.comboBox1.ValueMember = "ComId"; teacherForm.comboBox1.DisplayMember = "ComName"; //подключаем данные и выводим список предметов в comboBox2 teacherForm.comboBox2.DataSource = subjects; teacherForm.comboBox2.ValueMember = "SubjId"; teacherForm.comboBox2.DisplayMember = "ShortName"; if (teacherForm.ShowDialog() == DialogResult.OK) { teacher = teacherForm.Teacher; db.SaveChanges(); dataGridView.Refresh(); } } } else if (typeof(T) == typeof(Groups)) { var groups = set.Find(id) as Groups; if (groups != null) { GroupForm groupForm = new GroupForm(); groupForm.comboBox1.DataSource = commissions; groupForm.comboBox1.ValueMember = "ComId"; groupForm.comboBox1.DisplayMember = "ComName"; if (groupForm.ShowDialog() == DialogResult.OK) { groups = groupForm.Groups; db.SaveChanges(); dataGridView.Refresh(); } } } else if (typeof(T) == typeof(Commission)) { var commission = set.Find(id) as Commission; if (commission != null) { var form = new CommissionForm(commission); if (form.ShowDialog() == DialogResult.OK) { commission = form.Commission; db.SaveChanges(); dataGridView.Refresh(); } } } }
public static BaseForm getForm(string name) { BaseForm f = new ObjectForm(); switch (name) { case "Object": f = new ObjectForm(); break; case "Linq": f = new LinqForm(); break; case "People": f = new PeopleForm(); break; case "ConnectToUniversityPeople": f = new ConnectToUniversityPeopleForm(); break; case "Worker": f = new Workers(); break; case "Leadership": f = new LeadershipForm(); break; case "Teacher": f = new TeacherForm(); break; case "Staff": f = new StaffForm(); break; case "Student": f = new StudentForm(); break; case "Entrant": f = new EntrantForm(); break; case "Thing": f = new ThingForm(); break; case "CultureThing": f = new CultureThingForm(); break; case "MatherialThing": f = new MatherialThingForm(); break; case "Building": f = new BuildingForm(); break; case "Room": f = new RoomForm(); break; case "PersonalThing": f = new RersonalThingForm(); break; case "Literature": f = new LiteratureForm(); break; case "Electronic": f = new ElectronicForm(); break; case "NotMatherialThing": f = new NotMatherialForm(); break; case "GroupOfPeople": f = new GroupOfPeopleForm(); break; case "Faculty": f = new FacultyForm(); break; case "Group": f = new GroupForm(); break; case "ManageOfPeople": f = new ManageOfPeopleForm(); break; case "Mark": f = new MarkForm(); break; case "Award": f = new AwardForm(); break; //case "Event": // f = new EventForm(); // break; //case "ControlKnowledge": // f = new ControlKnowledgeForm(); // break; case "Subject": f = new SubjectForm(); break; } return(f); }