示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            WorkingTeam workingTeam = db.WorkingTeams.Find(id);

            db.WorkingTeams.Remove(workingTeam);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "ID,UnitCode,TeamName,CarCount,EmployeeCount,MonitorEmployeeID,MonitorPoliticalStatus,SubMonitorEmployeeID,SubMonitorPoliticalStatus")] WorkingTeam workingTeam)
 {
     if (ModelState.IsValid)
     {
         db.Entry(workingTeam).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(workingTeam));
 }
示例#3
0
        public ActionResult Create([Bind(Include = "ID,UnitCode,TeamName,CarCount,EmployeeCount,MonitorEmployeeID,MonitorPoliticalStatus,SubMonitorEmployeeID,SubMonitorPoliticalStatus")] WorkingTeam workingTeam)
        {
            if (ModelState.IsValid)
            {
                db.WorkingTeams.Add(workingTeam);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(workingTeam));
        }
示例#4
0
        // GET: WorkingTeam/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WorkingTeam workingTeam = db.WorkingTeams.Find(id);

            if (workingTeam == null)
            {
                return(HttpNotFound());
            }
            return(View(workingTeam));
        }
        /// <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()));
        }