private void OrUpdateParent(HttpContext context)
        {
            var result = new NySoftland.Core.Result();

            try
            {
                var organizationItem = context.Request["organizationItem"];

                var item       = Newtonsoft.Json.JsonConvert.DeserializeObject <Organization>(organizationItem);
                var updateItem = oService.GenericService.GetModel(item.ID);
                updateItem.IsShow = item.IsShow;
                oService.GenericService.Update(updateItem);


                updateParent(updateItem);

                oService.GenericService.Save();
                userService.GenericService.Save();

                result.IsSucess = true;
                result.Message  = "同步成功";
            }
            catch (Exception ex)
            {
                result.IsSucess = false;

                result.Message = "保存失败!失败原因:" + ex.Message;
            }
            string json = Newtonsoft.Json.JsonConvert.SerializeObject(result);

            context.Response.Write(json);
        }
        public void ProcessRequest(HttpContext context)
        {
            //var result3 = new NySoftland.Core.Result();
            //result3.IsSucess = true;
            //result3.Datas = "/Scripts/Admin/images/BEA_AD_logo.png";

            //context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result3));
            //return;

            //文件上传的目录
            string         floder = context.Request["floder"];
            HttpPostedFile file;

            if (String.IsNullOrEmpty(context.Request["file"]))
            {
                file = context.Request.Files["contentFile"];
            }
            else
            {
                file = context.Request.Files[context.Request["file"]];
            }

            var json = String.Empty;

            if (file != null && file.ContentLength > 0)
            {
                if (!String.IsNullOrEmpty(context.Request["maxLength"]))
                {
                    int maxLength = 0;
                    int.TryParse(context.Request["maxLength"], out maxLength);

                    if (maxLength < file.ContentLength)
                    {
                        var result = new NySoftland.Core.Result();
                        result.IsSucess = false;
                        result.Message  = String.Format("只允许上传小于{0}的图片!", Fxm.Utility.FileHelper.FileSizeToString(maxLength));

                        json = Newtonsoft.Json.JsonConvert.SerializeObject(result);
                        context.Response.Write(json);
                        context.Response.End();
                    }
                }

                string fileName = Guid.NewGuid().ToString() + "_" + System.IO.Path.GetFileName(file.FileName);
                var    filePath = floder + @"/" + fileName;

                var datas  = new byte[file.ContentLength];
                var stream = file.InputStream;
                stream.Read(datas, 0, file.ContentLength);

                var result1 = FileHelper.UploadDocument(datas, filePath, DZAFCPortal.Config.AppSettings.SharePointSiteUrl, DZAFCPortal.Config.Base.ImageExtensions);

                json = Newtonsoft.Json.JsonConvert.SerializeObject(result1);
                context.Response.Write(json);
            }
        }
        /// <summary>
        /// 保存
        /// </summary>
        /// <returns></returns>
        private void AddOrUpdate(HttpContext context)
        {
            var result = new NySoftland.Core.Result();

            try
            {
                var organizationItem = context.Request["organizationItem"];
                var item             = Newtonsoft.Json.JsonConvert.DeserializeObject <Organization>(organizationItem);
                var updateItem       = oService.GenericService.GetModel(item.ID);
                updateItem.SortNum     = item.SortNum;
                updateItem.IsShow      = item.IsShow;
                updateItem.Description = item.Description;

                oService.GenericService.Update(updateItem);
                oService.GenericService.Save();

                //子类同时修改状态
                var updateparentItem = oService.GenericService.GetAll().Where(p => p.ParentID == item.ID).ToList();
                if (updateparentItem != null && updateparentItem.Count > 0)
                {
                    foreach (Organization og in updateparentItem)
                    {
                        og.IsShow = item.IsShow;
                        oService.GenericService.Update(og);
                        var userItem = userService.GenericService.GetAll().Where(p => p.OrganizationID == og.ID).ToList();
                        foreach (User user in userItem)
                        {
                            user.IsShow = item.IsShow;
                            userService.GenericService.Update(user);
                            userService.GenericService.Update(user);
                        }
                    }
                    oService.GenericService.Save();
                }


                result.IsSucess = true;
                result.Message  = "保存成功";
            }
            catch (Exception ex)
            {
                result.IsSucess = false;

                result.Message = "保存失败!失败原因:" + ex.Message;
            }
            string json = Newtonsoft.Json.JsonConvert.SerializeObject(result);

            context.Response.Write(json);
        }
示例#4
0
        public void ProcessRequest(HttpContext context)
        {
            var result     = new NySoftland.Core.Result();
            var json       = string.Empty;
            var saveType   = string.Empty;
            var jsonSource = string.Empty;

            var op = context.Request.Params["Op"];

            if (op == null)
            {
                return;
            }

            switch (op)
            {
            case "GetEdit":
                var flag = Convert.ToBoolean(context.Request.Params["GetApp"]);
                result = facade.GenerateResourceForModuleManagement(flag);
                json   = new JavaScriptSerializer().Serialize(result);
                break;

            case "SaveModuleGroup":
                saveType   = context.Request.Params["SaveType"];
                jsonSource = context.Request.Params["Source"];

                result = facade.SavgModuleGroup(saveType, jsonSource);
                json   = new JavaScriptSerializer().Serialize(result);
                break;

            case "SaveModule":
                saveType   = context.Request.Params["SaveType"];
                jsonSource = context.Request.Params["Source"];

                result = facade.SaveModule(saveType, jsonSource);
                json   = new JavaScriptSerializer().Serialize(result);
                break;

            case "Remove":
                var objectId      = context.Request.Params["ID"];
                var isModuleGroup = Convert.ToBoolean(context.Request.Params["IsModuleGroupType"]);

                result = facade.Remove(objectId, isModuleGroup);
                json   = new JavaScriptSerializer().Serialize(result);
                break;
            }
            context.Response.Write(json);
            context.Response.End();
        }
        public void ProcessRequest(HttpContext context)
        {
            var result = new NySoftland.Core.Result();
            var json   = string.Empty;

            var operation = context.Request.Params["Op"];

            if (operation == null)
            {
                return;
            }

            switch (operation)
            {
            case "GetEdit":
                var moduleid = context.Request.Params["ModuleID"];
                result = facade.GenerateResourceEditForOperation(moduleid);
                json   = new JavaScriptSerializer().Serialize(result);

                break;

            case "GetReadonly":
                result = facade.GenerateResourceReadOnlyForOperation();
                json   = new JavaScriptSerializer().Serialize(result);

                break;

            case "SaveOperation":
                var sourceOpBaseSave = context.Request.Params["Source"];
                var moduleID         = context.Request.Params["ModuleID"];
                result = facade.SaveOperation(sourceOpBaseSave, moduleID);
                json   = new JavaScriptSerializer().Serialize(result);

                break;

            case "RemoveOperation":
                var sourceOpCountSave = context.Request.Params["Source"];
                result = facade.RemoveOperaion(sourceOpCountSave);
                json   = new JavaScriptSerializer().Serialize(result);

                break;
            }
            context.Response.Write(json);
            context.Response.End();
        }