public virtual void UpdateApplication(Application app)
 {
     applicationDao.Update(app);
 }
        public JsonResult EditApplication(Application app)
        {
            JsonReturnMessages data = new JsonReturnMessages() { IsSuccess = true, Msg = "操作成功" };

            try
            {
                app.UpdateTime = DateTime.Now;
                app.UpdateUid = CurrentUser.UserUId;
                if (string.IsNullOrEmpty(Convert.ToString(app.ID)) || app.ID == 0)
                {//新增
                    app.CreateTime = DateTime.Now;
                    app.CreateUid = CurrentUser.UserUId;
                    BoFactory.GetVersionTrackBo.InsertApplication(app);
                }
                else
                {//修改
                    BoFactory.GetVersionTrackBo.UpdateApplication(app);
                }
            }
            catch (Exception ex)
            {
                data.Msg = ex.Message;
                data.IsSuccess = false;
                Log4NetHelper.Error(ex);
            }

            return Json(data);
        }
 public virtual void InsertApplication(Application app)
 {
     applicationDao.ExistApplication(app);
     applicationDao.Insert(app);
 }
        public ActionResult EditApplication(string id)
        {
            List<SelectListItem> unitList = new List<SelectListItem>();
            IList<SmartBox.Console.Common.Entities.SMC_Unit> js = GetUnitData();

            foreach (SmartBox.Console.Common.Entities.SMC_Unit r in js)
            {
                //unitList.Add(new SelectListItem { Text = "全局", Value = "" });
                unitList.Add(new SelectListItem { Text = r.Unit_Name, Value = r.Unit_ID });
            }
            //ViewData["unitData"] = Newtonsoft.Json.JsonConvert.SerializeObject(js);
            //获取当前用户的本单位
            //Dictionary<string, string> unitInfo = BoFactory.GetSMC_UserListBo.GetUnitByUL_UID(CurrentUser.UserUId);
            //if (unitInfo.Count > 0)
            //{
            //    string unitName = "本单位-" + unitInfo.ElementAt(0).Key;
            //    string unitId = unitInfo.ElementAt(0).Value;
            //    unitList.Add(new SelectListItem { Text = unitName, Value = unitId, Selected = true });
            //}

            //if (BoFactory.GetVersionTrackBo.IsSystemManager(CurrentUser.UserUId))
            //{
            //    //加入所有单位列表
            //    PageView view = new PageView();
            //    view.PageSize = 15;
            //    JsonFlexiGridData units = BoFactory.GetSMC_UnitBo.QueryUnitByUpperUnitCode(view, "");
            //    foreach (FlexiGridRow r in units.rows)
            //    {
            //        //unitList.Add(new SelectListItem { Text = "全局", Value = "" });
            //        unitList.Add(new SelectListItem { Text = r.cell[1], Value = r.id });
            //    }
            //}

            Application app;
            SelectHelper ddlPrivilege = new SelectHelper(BoFactory.GetVersionTrackBo.QueryAppPrivilegeList().ToDataTable(), "未指定", "");
            SelectHelper chkCategoryIDs = new SelectHelper(BoFactory.GetVersionTrackBo.QueryApplicationCategoryList().ToDataTable());
            if (string.IsNullOrEmpty(id))
            {
                app = new Application();
            }
            else
            {
                app = BoFactory.GetVersionTrackBo.GetApplication(id);

                foreach (SelectListItem item in unitList)
                {
                    if (item.Value == app.Unit)
                    {
                        item.Selected = true;
                        break;
                    }
                }
            }
            if (string.IsNullOrEmpty(app.CategoryIDs))
            {
                ViewData["CategoryIDs"] = chkCategoryIDs.GetSelectListItem("DisplayName", "ID", false);
            }
            else
            {
                ViewData["CategoryIDs"] = chkCategoryIDs.GetSelectListItem("DisplayName", "ID", app.CategoryIDs.Split(',').ToList(), false);
            }

            ViewData["Privilege"] = ddlPrivilege.GetSelectListItem("DisplayName", "ID", true);
            ViewData["Unit"] = unitList;
            return View(app);
        }