Exemplo n.º 1
0
        //修改小组信息
        private void btnEdit_Click(object sender, EventArgs e)
        {
            //如果当前没有任何数据,则不执行任何操作
            if (this.dgvGroupList.CurrentRow == null || this.dgvGroupList.RowCount == 0)
            {
                return;
            }
            //获取要修改的内容
            string  f_teamLeader = this.dgvGroupList.CurrentRow.Cells["F_TeamLeader"].Value.ToString();
            T_Group objGroup     = (from b in this.groupList where b.F_TeamLeader.ToString().Equals(f_teamLeader) select b).First <T_Group>();
            //显示要修改的窗体(把图书信息传递到窗体上)
            EditGroup    objEdit = new EditGroup(objGroup);
            DialogResult result  = objEdit.ShowDialog();

            //根据修改是否成功来决定是否同步显示
            if (result == DialogResult.OK)
            {
                //首先获取修改后的对象
                objGroup = (T_Group)objEdit.Tag;
                //重新找到要修改的图书并修改属性值
                T_Group editGroup = (from b in this.groupList where b.F_TeamLeader.ToString().Equals(f_teamLeader) select b).First <T_Group>();
                editGroup.F_TeamLeader = objGroup.F_TeamLeader;
                editGroup.F_Telephone  = objGroup.F_Telephone;
                editGroup.F_Number     = objGroup.F_Number;
                editGroup.F_MuDistrict = objGroup.F_MuDistrict;
                editGroup.F_District   = objGroup.F_District;
                editGroup.F_Date       = objGroup.F_Date;
                editGroup.F_Address    = objGroup.F_Address;
                //同步刷新
                this.dgvGroupList.Refresh();
            }
        }
Exemplo n.º 2
0
        public Doc GroupEdits(Guid editGroupID, Func <Doc, Doc> groupEditFn)
        {
            // Push an EditGroupBoundary marker object.
            var doc = this;

            doc.Edits = doc.Edits.Push(Egb);
            // Apply the group edit function.
            doc = groupEditFn(doc);
            // Pop the edits back to the marker, collecting as we go.
            var revEdits = new Stack <IEdit> {
            };
            var edits    = doc.Edits;

            while (true)
            {
                if (edits.IsEmpty)
                {
                    throw new ApplicationException("Edit stack exhausted looking for EditGroupBoundary");
                }
                edits = edits.Pop(out var edit);
                if (edit == Egb)
                {
                    break;
                }
                revEdits.Push(edit);
            }
            // Construct a new EditGroup from the collected edits.
            var editGroup = new EditGroup(editGroupID, revEdits.ToArray());

            edits = edits.Push(editGroup);
            // Return an updated version.
            doc.Edits = edits;
            return(doc);
        }
Exemplo n.º 3
0
        private static void SaveBanners(EditGroup editGroup, int groupID)
        {
            var curList = GroupBanners.GetByGroupID(groupID);

            foreach (var banner in editGroup.Banners)
            {
                if (!curList.Any(item => item.ID == banner.ID))
                {
                    var groupBanner = Mapper.Map <GroupBanner>(banner);

                    groupBanner.GroupID = groupID;

                    GroupBanners.Insert(groupBanner);
                }
                else
                {
                    GroupBanners.UpdateGroupBannerType(banner.ID, banner.GroupBannerType);
                    curList.Remove(curList.Single(cls => cls.ID == banner.ID));
                }
            }

            foreach (var item in curList)
            {
                GroupBanners.Delete(item.ID);
            }
        }
Exemplo n.º 4
0
        //Удаление будет происходить, если при выбранной в комбобоксе группе нажать Delete
        //При удалении группы каскадно удалятся все студенты
        private void CBoxGroup_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key == System.Windows.Input.Key.Delete)                                         //здесь проверяем что нажата именно клавиша Delete
            {                                                                                     // удаление по клавише delete
                if (cBoxGroup.SelectedIndex > -1)                                                 //проверяем чтобы хоть что то было выделено (-1 ничего не выделено)
                {
                    groupService.DeleteGroup((cBoxGroup.SelectedItem as GroupViewModel).GroupId); //если все хорошо то выбираем группу
                    groups = groupService.GetAll();                                               //groupService передаем DeleteGroup
                    cBoxGroup.DataContext   = groups;                                             //и передаем контексту
                    cBoxGroup.SelectedIndex = 0;                                                  //база обновится в реалтайм без перезапуска при удалении
                }                                                                                 //перескочит на первую группу с индексом 0
            }

            if (e.Key == System.Windows.Input.Key.Insert)
            {// обновление по клавише Insert
                // не работает
                if (cBoxGroup.SelectedIndex > -1)
                {
                    GroupViewModel groupViewModel = cBoxGroup.SelectedItem as GroupViewModel;
                    EditGroup      dialog         = new EditGroup(groupViewModel);
                    var            result         = dialog.ShowDialog();
                    if (result == true)
                    {
                        groupService.UpdateGroup(groupViewModel);
                    }
                    groups = groupService.GetAll();
                    cBoxGroup.DataContext = groups;
                }
            }
        }
Exemplo n.º 5
0
        public dynamic Edit(EditGroup obj, int IdToEdit)
        {
            try
            {
                Group temp = new Group
                {
                    Key          = obj.Name,
                    HeadManId    = obj.HeadmanId,
                    CuratorId    = obj.CuratorId,
                    StudyForm    = obj.StudyForm,
                    Notes        = obj.Note,
                    EduFrom      = obj.EduFrom,
                    Speciality   = obj.Speciality,
                    DepartmentId = obj.Id,
                    EduLevel     = obj.EduLevel,
                };

                _main.Change(IdToEdit, temp);
                return(LocalRedirect("/Group/desc/" + IdToEdit));
            }
            catch (System.Exception)
            {
                return("Непредвиденная ошибка");
            }
        }
Exemplo n.º 6
0
        public EditGroup EditGroup(string groupId)
        {
            EditGroup action = new EditGroup(groupId);

            action.Client(client);
            action.Proxy(proxy);
            return(action);
        }
Exemplo n.º 7
0
        public ActionResult Edit(EditGroup editGroup)
        {
            try
            {
                var group = Mapper.Map <Group>(editGroup);

                group.LastUpdate = DateTime.Now;
                group.GroupType  = _groupType;

                var files = Utilities.SaveFiles(Request.Files, Utilities.GetNormalFileName(group.Title), StaticPaths.GroupImages);

                if (files.Count > 0)
                {
                    if (files.Any(a => a.FileUpload == "Image"))
                    {
                        var fImage = files.Where(a => a.FileUpload == "Image").Single();
                        group.Image = fImage.Title;
                    }

                    if (files.Any(a => a.FileUpload == "ButtonImage"))
                    {
                        var fBtnImage = files.Where(a => a.FileUpload == "ButtonImage").Single();
                        group.ButtonImage = fBtnImage.Title;
                    }
                }

                ViewBag.Success = true;

                int grouID = editGroup.ID;

                if (group.ID == -1)
                {
                    Groups.Insert(group);
                    grouID = group.ID;

                    SaveBanners(editGroup, grouID);

                    UserNotifications.Send(UserID, String.Format("جدید - گروه '{0}'", group.Title), "/Admin/Groups/Edit/" + group.ID, NotificationType.Success);
                    editGroup = new EditGroup();
                }
                else
                {
                    Groups.Update(group);
                    SaveBanners(editGroup, grouID);
                }
            }
            catch (Exception ex)
            {
                SetErrors(ex);
            }

            return(ClearView(editGroup, "/Areas/Admin/Views/Groups/Edit.cshtml"));
        }
Exemplo n.º 8
0
        //gets result of the EditGroup dialog
        private void btnEditGroups_Click(object sender, System.EventArgs e)
        {
            EditGroup    eg           = new EditGroup();
            DialogResult dialogResult = eg.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                abg.EditGroup(eg.GroupName, eg.ContactCard);
            }
            else if (dialogResult == DialogResult.Cancel)
            {
                //cancelled
            }
            eg.Dispose();
        }
Exemplo n.º 9
0
        private void TextBlock_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {//событие по нажатию мышью по надписи
            GroupViewModel groupViewModel = new GroupViewModel();

            groupViewModel.Commence = new DateTime(1990, 01, 01);
            EditGroup dialog = new EditGroup(groupViewModel);
            var       result = dialog.ShowDialog();

            if (result == true)
            {
                groupService.CreateGroup(groupViewModel);
            }
            groups = groupService.GetAll();
            cBoxGroup.DataContext = groups;
        }
Exemplo n.º 10
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();
        currentFilePath = "";
        MW   = this;
        egrp = new EditGroup();
        egrp.ShowAll();
        eprj = new EditProject();
        eprj.ShowAll();
        eunt = new EditUnit();
        eunt.ShowAll();
        ecpmd = new EditCompuMethod();
        ecpmd.ShowAll();
        emsg = new EditMessage();
        emsg.ShowAll();
        eprc = new EditProcess();
        eprc.ShowAll();
        etsk = new EditTask();
        etsk.ShowAll();
        esm = new EditStateMachine();
        esm.ShowAll();

        ts = new Gtk.TreeStore(typeof(string));
        this.treeviewGlobal.Model = ts;

        Gtk.TreeViewColumn prjColumn = new Gtk.TreeViewColumn();
        prjColumn.Title = "EasyOS";

        Gtk.CellRendererText projectCell = new Gtk.CellRendererText();
        prjColumn.PackStart(projectCell, true);
        prjColumn.AddAttribute(projectCell, "text", 0);
        treeviewGlobal.AppendColumn(prjColumn);

        treeviewGlobal.Visible    = false;
        this.alignFrmEditor.Child = eprj;
        this.frmEditor.ShowAll();
        this.frmEditor.Visible = false;

        this.addAction.Sensitive      = false;
        this.deleteAction.Sensitive   = false;
        this.generateAction.Sensitive = false;
        this.GenerateAction.Sensitive = false;
        this.saveAction.Sensitive     = false;
        this.SaveAction.Sensitive     = false;
        this.saveAsAction.Sensitive   = false;
        this.SaveAsAction.Sensitive   = false;
        this.refreshAction.Sensitive  = false;
    }
Exemplo n.º 11
0
        private void ListBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            if (e.Key == System.Windows.Input.Key.Delete)
            {// удаление по клавише delete
                if (listBox.SelectedIndex > -1)
                {
                    int              si               = cBoxGroup.SelectedIndex;
                    GroupViewModel   groupViewModel   = cBoxGroup.SelectedItem as GroupViewModel;
                    StudentViewModel studentViewModel = listBox.SelectedItem as StudentViewModel;

                    groupService.RemoveStudentFromGroup(groupViewModel.GroupId, studentViewModel.StudentId);
                    groups = groupService.GetAll();     // для обновления окна
                    cBoxGroup.DataContext   = groups;   // для обновления окна
                    cBoxGroup.SelectedIndex = si;       // для обновления окна
                }
            }
            if (e.Key == System.Windows.Input.Key.Insert)
            {// обновление по клавише Insert
                // не работает
                if (cBoxGroup.SelectedIndex > -1)
                {
                    GroupViewModel groupViewModel = cBoxGroup.SelectedItem as GroupViewModel;
                    EditGroup      dialog         = new EditGroup(groupViewModel);
                    var            result         = dialog.ShowDialog();
                    if (result == true)
                    {
                        groupService.UpdateGroup(groupViewModel);
                    }
                    groups = groupService.GetAll();
                    cBoxGroup.DataContext = groups;
                }
            }
            if (e.Key == System.Windows.Input.Key.Insert)
            {// обновление по клавише Insert
                // не работает
                if (listBox.SelectedIndex > -1)
                {
                    StudentViewModel studentViewModel = listBox.SelectedItem as StudentViewModel;
                    var dialog = new EditStudent(studentViewModel);
                    var result = dialog.ShowDialog();
                    if (result == true)
                    {
                        groupService.UpdateStudent(studentViewModel);
                        dialog.Close();
                    }
                }
            }
        }
Exemplo n.º 12
0
        public ActionResult Edit(int?id)
        {
            EditGroup group;

            if (id.HasValue)
            {
                group         = Mapper.Map <EditGroup>(Groups.GetByID(id.Value));
                group.Banners = GroupBanners.GetByGroupID(group.ID);
            }
            else
            {
                group = new EditGroup();
            }

            return(View("/Areas/Admin/Views/Groups/Edit.cshtml", group));
        }
Exemplo n.º 13
0
        public override void Edit(EditGroup edit, double value)
        {
            switch (edit)
            {
            //Größe wird bearbeitet
            case EditGroup.Size:
            {
                //der Start des ersten Objekts, ist der Start der Gruppe
                ContainingObjects[0].SetStart(this.GroupStart);

                //jedes Objekt wird vergrößert
                for (int i = 0; i < ContainingObjects.Count; i++)
                {
                    //bearbeiten des Objekts
                    ContainingObjects[i].Edit(DrawObject.EditObject.Size, value);

                    try
                    {
                        //Der Start des nächsten Objekts ist das ende des aktuellen Objekts
                        ContainingObjects[i + 1].SetStart(ContainingObjects[i].GetEnd());
                    }
                    catch { }
                }

                //Start und Endpunkt wird neu abgespeichert
                SafeValues();
            }
            break;

            //Winkel wird bearbeitet
            case EditGroup.Angle:
            {
                //WinkelDifferenz zum vorherigen Winkel wird abgespeichert
                var angleDifference = value - Angle;

                //neuer Winkel wird abgespeichert
                Angle = value;

                //Winkel darf 360 nicht überschreiten
                if (Angle >= 360)
                {
                    Angle -= 360;
                }

                for (int i = 0; i < ContainingObjects.Count; i++)
                {
                    //Wenn es sich nicht um das Erste Objekt handelt,
                    if (i != 0)
                    {
                        //Startpunkt ist der Enkpunkt des vorigen Objekts
                        ContainingObjects[i].ObjectStart = ContainingObjects[i - 1].GetEnd();
                    }

                    //neuer Endpunkt wird berechnet
                    ContainingObjects[i].CalculateEnd();

                    //Objekt wird erneut gezeichnet
                    ContainingObjects[i].Redraw();

                    //Die Winkeldifferenz wird dem Winkel des Objekts hinzugerechnet
                    ContainingObjects[i].Rotate(ContainingObjects[i].Angle + angleDifference);
                }
            }
            break;
            }
        }
Exemplo n.º 14
0
 public override void Edit(EditGroup edit)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 15
0
 public AfterEdit(Activity ctx, EditGroup editGroup, OnFinish finish)
     : base(ctx, finish)
 {
     _editGroup = editGroup;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Bearbeiten mit Faktor
 /// </summary>
 /// <param name="edit"></param>
 /// <param name="factor"></param>
 public abstract void Edit(EditGroup edit, double factor);
Exemplo n.º 17
0
 /// <summary>
 /// Bearbeiten der Gruppe
 /// </summary>
 /// <param name="edit">Art der Bearbeitung</param>
 public abstract void Edit(EditGroup edit);