Beispiel #1
0
 public void SubmitForm(ProfileOperationsCompanyEntity companyEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         companyEntity.Modify(keyValue);
         service.Update(companyEntity);
         try
         {
             //添加日志
             LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "修改作业公司【" + companyEntity.CompanyName + "】成功!");
         }
         catch { }
     }
     else
     {
         companyEntity.Create();
         service.Insert(companyEntity);
         try
         {
             //添加日志
             LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "新建作业公司【" + companyEntity.CompanyName + "】成功!");
         }
         catch { }
     }
 }
        public ActionResult SubmitForm(ProfileOperationsCompanyEntity operaEntity, string vehicleTypeIds, string keyValue)
        {
            operaEntity.HasVehicleTypeIds = vehicleTypeIds;

            companycleApp.SubmitForm(operaEntity, keyValue);
            return(Success("操作成功。"));
        }
        public ActionResult GetVehicleTypeTree(string key)
        {
            var vehucleTypeData = vehucleTypeApp.GetList();
            ProfileOperationsCompanyEntity model = null;

            if (!string.IsNullOrEmpty(key))
            {
                model = companycleApp.GetForm(key);
            }

            var           treeList = new List <TreeViewModel>();
            TreeViewModel tree     = null;

            foreach (var item in vehucleTypeData)
            {
                tree = new TreeViewModel();
                bool hasChildren = vehucleTypeData.Count(t => t.VehicleTypeParentId == item.F_Id) == 0 ? false : true;
                bool isCheck     = false;

                if (model != null &&
                    !string.IsNullOrEmpty(model.HasVehicleTypeIds))
                {
                    string[] vehicleTypes = model.HasVehicleTypeIds.Split(',');
                    isCheck = vehicleTypes.Contains(item.F_Id);
                }

                tree.id          = item.F_Id;
                tree.text        = item.VehicleTypeName;
                tree.parentId    = item.VehicleTypeParentId == null ? "0" : item.VehicleTypeParentId;
                tree.isexpand    = true;
                tree.complete    = true;
                tree.showcheck   = true;
                tree.checkstate  = isCheck ? 1 : 0;
                tree.hasChildren = hasChildren;
                treeList.Add(tree);
            }

            return(Content(treeList.TreeViewJson()));
        }