Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(byte id)
        {
            WorkingGroup workinggroup = db.WorkingGroup.Find(id);

            db.WorkingGroup.Remove(workinggroup);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public void BeginSubGroup()
        {
            var nextGroup = new ScopeSanitizerToken();

            AllGroups.Add(nextGroup);
            LastestGroup.AddLast(nextGroup);
            WorkingGroup.Push(nextGroup);
        }
Exemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "Id,Name")] WorkingGroup workinggroup)
 {
     if (ModelState.IsValid)
     {
         db.Entry(workinggroup).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(workinggroup));
 }
Exemplo n.º 4
0
        public ActionResult Create([Bind(Include = "Id,Name")] WorkingGroup workinggroup)
        {
            if (ModelState.IsValid)
            {
                db.WorkingGroup.Add(workinggroup);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(workinggroup));
        }
Exemplo n.º 5
0
        // GET: /WorkingGroup/Delete/5
        public ActionResult Delete(byte?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WorkingGroup workinggroup = db.WorkingGroup.Find(id);

            if (workinggroup == null)
            {
                return(HttpNotFound());
            }
            return(View(workinggroup));
        }
Exemplo n.º 6
0
        public async Task <ActionResult> PostWorkingGroup([FromBody] WorkingGroup workingGroup)
        {
            try
            {
                await _workingGroupRepository.Add(workingGroup);
            }
            catch (DbUpdateConcurrencyException e)
            {
                _logger.LogError(e.Message);
                return(Problem(e.Message));
            }
            catch (DbUpdateException e)
            {
                _logger.LogError(e.Message);
                return(Problem(e.Message));
            }
            catch (Exception e)
            {
                _logger.LogError(e.Message);
                return(Problem(e.Message));
            }

            return(CreatedAtAction("PostWorkingGroup", new { workingGroup.Id, workingGroup }));
        }
Exemplo n.º 7
0
 public void ExitSubGroup()
 {
     WorkingGroup.Pop();
 }
Exemplo n.º 8
0
 public Task Update(int id, WorkingGroup newValue)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 9
0
 public async Task Add(WorkingGroup toAdd)
 {
     _context.WorkingGroups.Add(toAdd);
     await _context.SaveChangesAsync();
 }
        /// <summary>
        /// 开窗表格
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static MvcHtmlString DataBrowserWindow(this HtmlHelper helper, DataBrowserType type)
        {
            // 开窗元素ID
            string dataBrowser_id = "";

            // 根据枚举确定开窗类型
            Object obj = null;

            switch (type)
            {
            case DataBrowserType.Honor:
                obj            = new Honor();
                dataBrowser_id = "DataBrowser-Honor";
                break;

            case DataBrowserType.ModelWorker:
                obj            = new ModelWorker();
                dataBrowser_id = "DataBrowser-ModelWorker";
                break;

            case DataBrowserType.Proposal:
                obj            = new Proposal();
                dataBrowser_id = "DataBrowser-Proposal";
                break;

            case DataBrowserType.WorkersCongress:
                obj            = new WorkersCongress();
                dataBrowser_id = "DataBrowser-WorkersCongress";
                break;

            case DataBrowserType.WorkingTeam:
                obj            = new WorkingTeam();
                dataBrowser_id = "DataBrowser-WorkingTeam";
                break;

            case DataBrowserType.Employee:
                obj            = new Employee();
                dataBrowser_id = "DataBrowser-Employee";
                break;

            case DataBrowserType.Position:
                obj            = new Position();
                dataBrowser_id = "DataBrowser-Position";
                break;

            case DataBrowserType.WorkingUnit:
                obj            = new WorkingUnit();
                dataBrowser_id = "DataBrowser-WorkingUnit";
                break;

            case DataBrowserType.WorkingGroup:
                obj            = new WorkingGroup();
                dataBrowser_id = "DataBrowser-WorkingGroup";
                break;
            }

            // 生成表头信息
            var thead = new StringBuilder();

            thead.Append("<th></th>");

            Type t = obj.GetType();

            foreach (PropertyInfo pInfo in t.GetProperties())
            {
                thead.AppendFormat("<th>{0}</th>", pInfo.Name);
            }

            // 生成表中行信息
            var tbody = DataBrowserManager.GetTBodyString(type);

            // 生成开窗整体结构
            var result = new StringBuilder();

            result.AppendFormat(
                @"<div class='modal fade' id='{0}' tabindex='-1' role='dialog' aria-labelledby='myModalLabel-{0}' aria-hidden='true'>" +
                "<div class='modal-dialog databrowser-dialog'>" +
                "<div class='modal-content'>" +
                "<div class='modal-header'>" +
                "<button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>" +
                "<h4 class='modal-title' id='myModalLabel-{0}'>开窗测试</h4>" +
                "</div>" +
                "<div class='modal-body'>" +
                "<table class='table table-striped'>" +
                "<thead>" +
                "<tr>" +
                "{1}" +
                "</tr>" +
                "</thead>" +
                "<tbody>" +
                "{2}" +
                "</tbody>" +
                "</table>" +
                "</div>" +
                "<div class='modal-footer'>" +
                "<button type='button' class='btn btn-primary databrowser-ok'>选择</button>" +
                "<button type='button' class='btn btn-default' data-dismiss='modal'>关闭</button>" +
                "</div>" +
                "</div>" +
                "</div>" +
                "</div>", dataBrowser_id, thead, tbody
                );

            return(MvcHtmlString.Create(result.ToString()));
        }