예제 #1
0
 public Common.Data.JsonData Add(Organze model)
 {
     Common.Data.JsonData json = new Common.Data.JsonData()
     {
         Result = true
     };
     if (string.IsNullOrEmpty(model.Name))
     {
         json.Message = Lang.Tip_NameIsRequired;
         return(json);
     }
     if (string.IsNullOrEmpty(model.Code))
     {
         model.Code = model.Name.TextConvertChar();
     }
     model.CreateTime = DateTime.Now;
     try
     {
         json.Success = organzeDal.Add(model);
     }
     catch (Exception ex)
     {
         json.Message = ex.Message;
     }
     return(json);
 }
예제 #2
0
        public JsonResult QueryAllMenuByFilter(FilterParam param)
        {
            Common.Data.JsonData json = new Common.Data.JsonData()
            {
                Result = true
            };
            List <int> ids = new List <int>();

            //过滤的id
            if (param.Ignores != null)
            {
                int id = 0;
                for (int i = 0; i < param.Ignores.Count; i++)
                {
                    int.TryParse(param.Ignores[i], out id);
                    ids.Add(id);
                }
            }
            List <UinMenuObjcet> ms = QueryAllMenuData().Where(s =>
                                                               ((!param.ContainerDelete && s.IsEnable) || (param.ContainerDelete)) && //对于是否查询已启用项进行处理
                                                               (!ids.Contains(s.Id)) //是否过滤指定的项
                                                               ).ToList();

            //json 串
            string jsonString = ms.ConvertJson <List <UinMenuObjcet> >();

            json.Data    = ms;
            json.Total   = ms.Count;
            json.Success = true;
            return(Json(json));
        }
예제 #3
0
        public JsonResult CallEmailService(SendEmailData email)
        {
            Common.Data.JsonData json = new Common.Data.JsonData()
            {
                Result = true
            };
            //查询邮件账户
            EmailSystemSetting setting = RefreshAppSetting.GetSystemEmailAccount();
            IEmailDataService  es      = IocMvcFactoryHelper.GetInterface <IEmailDataService>();

            es.LogPath = InitAppSetting.LogPath;
            AppEmailData data = new AppEmailData()
            {
                Body    = email.Body,
                From    = setting.EmailAccount,
                Mailer  = email.Mailer,
                To      = email.To,
                Subject = email.Subject
            };

            if (!string.IsNullOrEmpty(email.SendTime))
            {
                data.SendTime = Convert.ToDateTime(email.SendTime);
            }
            json.Success    = es.SendEmail(setting, data, setting.Smtp);
            json.AttachData = email;
            return(Json(json));
        }
예제 #4
0
        public JsonResult QueryDayLog(RequestParam param)
        {
            ILogDataService logService = IocMvcFactoryHelper.GetInterface <ILogDataService>();

            Common.Data.JsonData json = logService.QueryLogs(param);
            return(Json(json));
        }
예제 #5
0
        public JsonResult QueryUinDataList(QueryContactParam param)
        {
            IDataFromOtherService contactService = IocMvcFactoryHelper.GetInterface <IDataFromOtherService>();

            Common.Data.JsonData json = contactService.QueryUinList(DateTime.Parse(param.StartTime), DateTime.Parse(param.EndTime), param.BeginRow, param.EndRow);
            json.AttachData = param;
            return(Json(json));
        }
예제 #6
0
        public Common.Data.JsonData Add(ReportParam model)
        {
            //添加举报项
            DateTime         time   = DateTime.Now;
            ReportEnumDetail detail = new ReportEnumDetail()
            {
                Report = new List <ReportEnumRec>(),
                ReportContainerNote = new List <ReporterAndNote>()
            };

            Common.Data.JsonData json = new Common.Data.JsonData()
            {
                Result = true
            };
            try
            {
                bool writeReportNote = false;
                if (!string.IsNullOrEmpty(model.Note))
                {
                    detail.Note = new ReportNote()
                    {
                        UINote = model.Note, CreateTime = time
                    };
                    reportRepository.SaveNote(detail.Note);
                    writeReportNote = true;
                }
                foreach (Guid item in model.Ids)
                {
                    ReportEnumRec rec = new ReportEnumRec()
                    {
                        ReportEnum = model.ReportType, BeenReporterId = item, CreateTime = time
                    };
                    detail.Report.Add(rec);
                    if (writeReportNote)
                    {//填写了举报信息描述
                        ReporterAndNote rn = new ReporterAndNote()
                        {
                            CreateTime = time, ReportNoteId = detail.Note.Id, ReportId = rec.Id
                        };
                        detail.ReportContainerNote.Add(rn);
                    }
                }
                //举报的对象入库
                reportRepository.SaveReported(detail.Report);
                if (writeReportNote)
                {
                    reportRepository.SaveReportedAndNote(detail.ReportContainerNote);
                }
                //关联举报的对象
                json.Data    = detail;
                json.Success = true;
            }
            catch (Exception ex)
            {
                json.Message = ex.Message;
            }
            return(json);
        }
예제 #7
0
        public JsonResult QuerAccont(RequestParam param)
        {
            Common.Data.JsonData json       = new Common.Data.JsonData();
            IAppAccountService   appService = IocMvcFactoryHelper.GetInterface <IAppAccountService>();

            json            = appService.QuerySignInAccount(param);
            json.AttachData = param;
            return(Json(json));
        }
예제 #8
0
        public ActionResult MenuList()
        {
            Common.Data.JsonData json = new Common.Data.JsonData();
            List <UinMenuObjcet> menu = QueryAllMenuData();

            json.Data  = menu;
            json.Total = menu.Count;
            return(View(json));
        }
예제 #9
0
 public JsonResult QueryAllMenus()
 {
     Common.Data.JsonData json = new Common.Data.JsonData()
     {
         Result = true
     };
     json.Data    = QueryAllMenuData();
     json.Success = true;
     return(Json(json));
 }
예제 #10
0
        public JsonResult SaveCompany(BaseRequestParam param)
        {
            IOrganizationService organzeService = IocMvcFactoryHelper.GetInterface <IOrganizationService>();

            Common.Data.JsonData json = organzeService.Add(new Organze()
            {
                Name = param.Name, Code = param.Code
            });
            return(Json(json));
        }
예제 #11
0
        public JsonResult ChangeMenuParentNode(int id, int pid)
        {
            Common.Data.JsonData json = new Common.Data.JsonData()
            {
                Result = true
            };
            IMenuService ms = IocMvcFactoryHelper.GetInterface <IMenuService>();

            json.Success = ms.ChangeParentMenu(id, pid);
            return(Json(json));
        }
예제 #12
0
        public JsonResult SaveContacter(SampleRequestParam param)
        {
            Common.Data.JsonData json      = new Common.Data.JsonData();
            ContactData          contacter = new ContactData()
            {
                ContactName   = param.Name,
                ContactTypeId = string.IsNullOrEmpty(param.Code)?-1: int.Parse(param.Code),
                Value         = param.Value,
                Desc          = param.Desc
            };
            IContactDataService contactService = IocMvcFactoryHelper.GetInterface <IContactDataService>();

            json = contactService.Add(contacter);
            return(Json(json));
        }
예제 #13
0
 public Common.Data.JsonData Add(ContactData model)
 {
     Common.Data.JsonData json = new Common.Data.JsonData()
     {
         Result = true
     };
     try
     {
         json.Success = appRepostory.Add(model);
     }
     catch (Exception ex)
     {
         json.Message = ex.Message;
     }
     return(json);
 }
예제 #14
0
 public Common.Data.JsonData QueryAllMenu()
 {
     Common.Data.JsonData json = new Common.Data.JsonData()
     {
         Result = true
     };
     try
     {
         json.Data    = menuRepository.QueryMenus();
         json.Success = true;
     }
     catch (Exception ex)
     {
         json.Message = ex.Message;
     }
     return(json);
 }
예제 #15
0
        public JsonResult ChangeMenuType(int id, int type)
        {
            Common.Data.JsonData json = new Common.Data.JsonData()
            {
                Result = true
            };
            IMenuService menuService = IocMvcFactoryHelper.GetInterface <IMenuService>();

            try
            {
                json.Success = menuService.ChangeMenuType(id, type);
            }
            catch (Exception ex)
            {
                json.Message = ex.Message;
            }
            return(Json(json));
        }
예제 #16
0
        public JsonResult QueryCompnayList(RequestParam param)
        {
            Common.Data.JsonData json = new Common.Data.JsonData()
            {
                Result = true
            };
            //条件查询数目 add
            IOrganizationService organzeService = IocMvcFactoryHelper.GetInterface <IOrganizationService>();

            json.Total = organzeService.Count(param);
            if (json.Total > 0)
            {
                json.Data = organzeService.QueryOrganzes(param.QueryKey);
            }
            json.Success    = true;
            json.AttachData = param;
            return(Json(json));
        }
예제 #17
0
        public JsonResult GetUploadFile()
        {
            Common.Data.JsonData json = new Common.Data.JsonData()
            {
                Result = true
            };
            HttpFileCollectionBase files = HttpContext.Request.Files;

            if (files.Count < 1)
            {
                json.Message = AppLanguage.Lang.Tip_PleaseSelectFile;
                json.Success = false;
                return(Json(json));
            }
            string dir = Server.MapPath("/UploadFile/") + DateTime.Now.ToString(Common.Data.CommonFormat.DateIntFormat);

            if (!System.IO.Directory.Exists(dir))
            {
                System.IO.Directory.CreateDirectory(dir);
            }
            int succNum = 0;

            json.Message = string.Format("本次总共上传文件 {0} 份", files.Count);
            //进行文件存储
            for (int i = 0; i < files.Count; i++)
            {
                try
                {
                    HttpPostedFileBase hf       = files[i];
                    string[]           fileInfo = hf.FileName.Split('.');
                    hf.SaveAs(dir + "/" + DateTime.Now.ToString(Common.Data.CommonFormat.DateTimeIntFormat) + "." + fileInfo[fileInfo.Length - 1]);
                    succNum++;
                    json.Message += string.Format("<br/>第{0}张上传成功。", i + 1);
                }
                catch (Exception ex)
                {
                    json.Message += string.Format("<br/>第{0}张上传失败。", i + 1);
                }
            }
            json.Success = succNum > 0;
            return(Json(json));
        }
예제 #18
0
        public JsonResult SaveMenu(EnumRequestParam param)
        {
            Common.Data.JsonData json = new Common.Data.JsonData()
            {
                Result = true
            };
            IMenuService ms = IocMvcFactoryHelper.GetInterface <IMenuService>();
            Menu         m  = new Model.Menu()
            {
                Name     = param.Name,
                Code     = param.Code,
                Remark   = param.Desc,
                Url      = param.Value,
                MenuType = (short)EMenuType.MenuNode.GetHashCode()
            };
            string et = param.EnumMember;

            if (string.IsNullOrEmpty(et))
            {
                m.MenuType = (short)EMenuType.MenuRoot.GetHashCode();
            }
            else
            {
                //提取转换
                EMenuType t;
                if (!Enum.TryParse(et, out t))
                {
                    json.Message = AppLanguage.Lang.Tip_MenuTypeValidInMenu;
                    return(Json(json));
                }
                m.MenuType = (short)t.GetHashCode();
            }
            if (m.MenuType == (short)EMenuType.MenuNode.GetHashCode() && string.IsNullOrEmpty(param.Value))
            {
                json.Success = false;
                json.Message = AppLanguage.Lang.Tip_MenuUrlIsRequired;
                return(Json(json));
            }
            json = ms.Add(m);
            return(Json(json));
        }
예제 #19
0
        public Common.Data.JsonData QueryUinList(DateTime beginTime, DateTime endTime, int beginRow, int endRow)
        {
            //根据数据库配置
            int count = 0;

            Common.Data.JsonData json = new Common.Data.JsonData()
            {
                Result = true
            };
            try
            {
                //查询配置判断是否需要切换数据库[ioc代码注入时会切换库]
                json.Data    = dataFromRepository.QueryUinList(beginTime, endTime, beginRow, endRow, out count);
                json.Total   = count;
                json.Success = true;
            }
            catch (Exception ex)
            {
                json.Message = ex.Message;
            }
            return(json);
        }
예제 #20
0
 public Common.Data.JsonData Add(Menu model)
 {
     Common.Data.JsonData json = new Common.Data.JsonData()
     {
         Result = true
     };
     if (string.IsNullOrEmpty(model.Code))
     {                                                  //中文转拼音
         model.Code = model.Name.TextConvertChar(true); // 转换形式 助手  =ZhuShou
     }
     if (model.MenuType == (short)EMenuType.MenuNode.GetHashCode())
     {//存储的是菜单内容,url是必须输入项
         string msg = string.IsNullOrEmpty(model.Url) ? AppLanguage.Lang.Tip_UrlIsRequestInMenu : string.Empty;
         if (string.IsNullOrEmpty(msg))
         {
             json.Message = msg;
             return(json);
         }
     }
     model.CreateTime = DateTime.Now;
     try
     {
         bool succ = menuRepository.Add(model);
         logDal.WriteLog(ELogType.DataInDBLog,
                         string.Format(LogData.InsertDbNoteFormat(), typeof(Menu).Name),
                         "insert", succ);
         json.Success = true;
     }
     catch (Exception ex)
     {
         string msg = ex.Message;
         logDal.WriteLog(ELogType.DataInDBLog,
                         string.Format(LogData.InsertDbNoteFormat(), typeof(Menu).Name) + "\r\n" + msg,
                         "insert Error", false);
         json.Message = msg;
     }
     return(json);
 }
예제 #21
0
        public JsonResult SaveEnum(SampleRequestParam param)
        {
            Common.Data.JsonData json = new Common.Data.JsonData()
            {
                Result = true
            };
            int ev = 0;

            if (!int.TryParse(param.Value, out ev))
            {
                json.Message = AppLanguage.Lang.Tip_EnumValueIsDigit;
                return(Json(json));
            }
            IEnumDataService enumBll = IocMvcFactoryHelper.GetInterface <IEnumDataService>();

            json = enumBll.Add(new EnumData()
            {
                Name   = param.Name,
                Code   = param.Code,
                Value  = ev,
                Remark = param.Desc
            });
            return(Json(json));
        }
예제 #22
0
 public JsonResult SignAccount(ReportParam param)
 {
     Common.Data.JsonData json = IocMvcFactoryHelper.GetInterface <IReportEnumDataService>().Add(param);
     return(Json(json));
 }
예제 #23
0
        public JsonResult ChangeMenuStatue(int id, bool isStop)
        {
            Common.Data.JsonData json = new Common.Data.JsonData();

            return(Json(json));
        }