コード例 #1
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));
        }
コード例 #2
0
        public JsonResult QueryDayLog(RequestParam param)
        {
            ILogDataService logService = IocMvcFactoryHelper.GetInterface <ILogDataService>();

            Common.Data.JsonData json = logService.QueryLogs(param);
            return(Json(json));
        }
コード例 #3
0
        public List <CategoryItems> QueryAllAppSetting()
        {
            IAppSettingService   appSetService = IocMvcFactoryHelper.GetInterface <IAppSettingService>();
            List <CategoryItems> items         = appSetService.QueryAll();

            return(items);
        }
コード例 #4
0
        public ActionResult AddContacterDialog()
        {
            IAppSettingService appSetService = IocMvcFactoryHelper.GetInterface <IAppSettingService>();

            ViewData["ParentNode"] = appSetService.SelectNodeItemByParentCode("LianXiRenLeiXingGuanLi");
            return(View());
        }
コード例 #5
0
        public List <CategoryItems> QueryAppSettingList(string parentCode)
        {
            IAppSettingService   appSetService = IocMvcFactoryHelper.GetInterface <IAppSettingService>();
            List <CategoryItems> items         = appSetService.SelectNodeItemByParentCode(parentCode);

            return(items);
        }
コード例 #6
0
        public JsonResult QueryNodes(string parenCode)
        {
            Common.Data.JsonData json          = new JsonData();
            IAppSettingService   appSetService = IocMvcFactoryHelper.GetInterface <IAppSettingService>();

            json = appSetService.SelectNodesByParent(parenCode);
            return(Json(json));
        }
コード例 #7
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));
        }
コード例 #8
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));
        }
コード例 #9
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));
        }
コード例 #10
0
        public List <UinMenuObjcet> QueryAllMenuData()
        {
            IMenuService         ms    = IocMvcFactoryHelper.GetInterface <IMenuService>();
            List <UinMenuObjcet> menus = ms.QueryMenusByAuthor(string.Empty)
                                         .Select(s => s.MapObject <Menu, UinMenuObjcet>()).ToList();//这个参数后期修改为当前操作用户
            Menu uin = menus.Where(s => s.Code == "UinImageGroupService")
                       .Select(s => s.MapObject <UinMenuObjcet, Menu>())
                       .FirstOrDefault();

            for (int i = 0; i < menus.Count; i++)
            {
                if (menus[i].ParentId == -1)
                {
                    continue;
                }
                UinMenuObjcet p = menus.Where(s => s.Id == menus[i].ParentId).FirstOrDefault();
                if (p == null)
                {
                    menus[i].Tip = string.Format("Lose isEnable of parent[id={0}]", menus[i].ParentId);
                }
                else
                {
                    menus[i].ParentName = p.Name;
                    menus[i].ParentCode = p.Code;
                }
            }
            //对于查询出的菜单列表进行用户查询限定组装
            if (uin != null)
            { //是否查询举报列表
                UinMenuObjcet ui = menus.Where(s => s.Code == "UinImageGroupService").FirstOrDefault();
                ui.Childerns = new List <Menu>();
                IAppSettingService   appSettingService = IocMvcFactoryHelper.GetInterface <IAppSettingService>();
                List <CategoryItems> reports           = appSettingService.SelectNodeItemByParentCode(EAppSetting.ReportEnum.ToString());//查询举报分类集合
                //将该菜单变为子节点菜单
                if (reports.Count > 0)
                {
                    UinMenuObjcet first = uin.MapObject <Menu, UinMenuObjcet>();
                    first.ParentCode = first.Code;
                    ui.Childerns.Add(first);
                    foreach (CategoryItems item in reports)
                    {
                        UinMenuObjcet copy = uin.MapObject <Menu, UinMenuObjcet>();//进行一个实体Copy,避免引用类型更改集合中数据项
                        copy.Url        = copy.Url + "?" + EAppSetting.ReportEnum.ToString() + "=" + item.ItemValue;
                        copy.Name      += " - " + item.Name;
                        copy.IsChild    = true;
                        copy.ParentCode = uin.Code;
                        copy.Code       = uin.Code + "." + item.Code.ToString();
                        copy.ParentId   = copy.Id;
                        // ui.Childerns.Add(copy);
                        menus.Add(copy);
                    }
                }
            }
            return(menus);
        }
コード例 #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 ActionResult FlagReportDialog(bool usingParentWinSelfTool, Guid?optionId, string table)
        {
            IAppSettingService service = IocMvcFactoryHelper.GetInterface <IAppSettingService>();
            string             item    = EAppSetting.ReportEnum.ToString();

            ViewData[item] = service.SelectNodeItemByParentCode(item);
            ViewData["usingParentWinSelfTool"] = usingParentWinSelfTool;
            ViewData["optionId"]    = optionId;
            ViewData["optionTable"] = table;
            return(View());
        }
コード例 #13
0
        public JsonResult InsertAppData(NodeRequestParam param)
        {
            JsonData        json          = new JsonData();
            IAppDataService appSetService = IocMvcFactoryHelper.GetInterface <IAppDataService>();

            json = appSetService.Add(new AppModel()
            {
                AppName = param.Name,
                AppCode = param.Code
            });
            return(Json(json));
        }
コード例 #14
0
        public void LoopSendEmali(List <EmailAccount> accs, string subject)
        {//每日激活邮件账户
         //查询邮件账户列表
            string            dir          = LogPrepare.GetLogPath();
            ELogType          el           = ELogType.EmailLog;
            string            file         = LogPrepare.GetLogName(el);
            IEmailDataService emailService = IocMvcFactoryHelper.GetInterface <IEmailDataService>();

            foreach (var item in accs)
            {
                string time  = DateTime.Now.ToString(Common.Data.CommonFormat.DateTimeFormat);
                string title = "[HrApp Everyday active]";
                try
                {
                    //使用邮件账户进行邮件发送
                    short smtp = item.Smtp;
                    //拼接发送的邮件内容
                    EmailSystemSetting ess = new EmailSystemSetting()
                    {
                        EmailAccount      = item.Account,
                        EmailAuthortyCode = item.AuthortyCode,
                        EmailHost         = item.SmtpHost,
                        EmailHostPort     = EmailSystemSetting.GetHostPortSmtp(smtp)
                    };
                    ess.Smtp = (EnumSMTP)smtp;
                    StringBuilder body = new StringBuilder();
                    body.AppendLine(" Guid:<br/> ");
                    for (int i = 0; i < 10; i++)
                    {
                        body.AppendLine(string.Format(" {0}<br/> ", Guid.NewGuid().ToString().ToUpper()));
                    }
                    string       text      = string.Format("{0} <br/>  smtp= {1}<br/> time= {2} <br/>{3}  ", title, item.Account, time, body.ToString());
                    string       receive   = InitAppSetting.Global.ReceiverInEmailActive;
                    AppEmailData emailData = new AppEmailData()
                    {
                        EmailCreateTime = DateTime.Now,
                        To      = string.IsNullOrEmpty(receive) ? "*****@*****.**" : receive,
                        Subject = subject,
                        From    = item.Account,
                        Body    = text
                    };
                    emailService.SendEmail(ess, emailData, ess.Smtp);
                    LoggerWriter.CreateLogFile(title + "[Success]" + time, dir, el, file, true);
                }
                catch (Exception ex)
                {
                    title += ex.Message;
                    LoggerWriter.CreateLogFile(title + "[Error]" + time, dir, el, file, true);
                }
            }
        }
コード例 #15
0
 public override void Execute(INotification notification)
 {
     switch (notification.Type)
     {
     case AppNotify.Get_AllEmailSMTP:
         Task.Factory.StartNew(() =>
         {
             IEmailDataService email  = IocMvcFactoryHelper.GetInterface <IEmailDataService>();
             List <EmailAccount> accs = email.QueryEmailAccountInDB();
             FacadeFactory.FacadeInstance.SendNotification(AppNotify.GlobalExecuteEvent, accs, AppNotify.Back_AllEmailSMTP);
         });
         break;
     }
 }
コード例 #16
0
        public JsonResult QueryNodesByIndex(string keySpell)
        {
            Common.Data.JsonData json = new JsonData()
            {
                Result = true
            };
            IAppSettingService   appService = IocMvcFactoryHelper.GetInterface <IAppSettingService>();
            List <CategoryItems> data       = appService.QueryNodes(keySpell);

            json.Data    = data;
            json.Total   = data.Count;
            json.Success = true;
            return(Json(json));
        }
コード例 #17
0
        public ActionResult CommonSelectDialog(string enumName, int id)
        { //公用的选择框的对话框窗体
            List <EnumData> list = new List <EnumData>(); try

            {
                IEnumDataService enumService = IocMvcFactoryHelper.GetInterface <IEnumDataService>();
                list = enumService.QueryEnumMember(enumName);
            }
            catch (Exception ex)
            {
                list = new List <EnumData>();
            }
            ViewData["Id"] = id;
            return(View(list));
        }
コード例 #18
0
        public ActionResult AppSettingDialog(int id = 0)
        {
            CategoryItems      item       = new CategoryItems();
            IAppSettingService appService = IocMvcFactoryHelper.GetInterface <IAppSettingService>();

            if (id > 0)
            { //查询带编辑的数据
                item = appService.Get(id);
            }
            ViewData[ParamNameTemplate.AppSettingParentNode] =
                (item.Id > 0 && item.ParentCode != InitAppSetting.DefaultAppsettingRootCode) ?
                appService.QueryNodes(item.ParentCode)
                :QueryAppSettingList(InitAppSetting.DefaultAppsettingRootCode);
            return(View(item));
        }
コード例 #19
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));
        }
コード例 #20
0
        public JsonResult SaveAppSetting(NodeRequestParam param)
        {
            IAppSettingService appSetService = IocMvcFactoryHelper.GetInterface <IAppSettingService>();
            JsonData           json          = appSetService.Add(new CategoryItems()
            {
                ItemDesc   = param.Desc,
                Code       = param.Code,
                ParentCode = param.ParentCode,
                Name       = param.Name,
                ParentId   = param.ParentId,
                ItemValue  = param.Value
            });

            return(Json(json));
        }
コード例 #21
0
        public JsonResult SaveSpecialSpellName(NodeRequestParam param)
        {
            JsonData json = new JsonData();

            if (string.IsNullOrEmpty(param.Name))
            {
            }
            ISpecialSpellNameService appSetService = IocMvcFactoryHelper.GetInterface <ISpecialSpellNameService>();

            json = appSetService.Add(new SpecialSpellName()
            {
                Name = param.Name[0].ToString(),//只读取第一个字符
                Code = param.Code
            });
            return(Json(json));
        }
コード例 #22
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));
        }
コード例 #23
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));
        }
コード例 #24
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));
        }
コード例 #25
0
        public JsonResult EditAppSetting(NodeRequestParam node)
        {
            Common.Data.JsonData json = new JsonData()
            {
                Result = true
            };
            node.Code = string.Empty;//这个接口不运行修改编码【为实现子节点直接相互联动,需要另一接口进行控制】
            IAppSettingService appService = IocMvcFactoryHelper.GetInterface <IAppSettingService>();

            try
            {
                if (node.ParentId == -1)
                {
                    node.ParentCode = InitAppSetting.DefaultAppsettingRootCode;
                }
                json.Success = appService.Update(new CategoryItems()
                {
                    Id         = int.Parse(node.Id),
                    ParentId   = node.ParentId,
                    ParentCode = node.ParentCode,
                    Name       = node.Name,
                    ItemDesc   = node.Desc,
                    ItemValue  = node.Value
                });
                if (json.Success)
                {//更新系统配置
                    InitAppSetting.AppSettingItemsInDB = RefreshAppSetting.QueryAllAppSetting(appService);
                    RefreshAppSetting.RefreshFileVersion();
                }
            }
            catch (Exception ex)
            {
                json.Message = ex.Message;
            }
            return(Json(json));
        }
コード例 #26
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));
        }
コード例 #27
0
 public JsonResult SignAccount(ReportParam param)
 {
     Common.Data.JsonData json = IocMvcFactoryHelper.GetInterface <IReportEnumDataService>().Add(param);
     return(Json(json));
 }
コード例 #28
0
        private void TestEmail(string title)
        {
            string text = "使用代码进行邮箱测试功能";
            string time = DateTime.Now.ToString(Common.Data.CommonFormat.DateTimeFormat);

            text += "<br/>邮件创建时间 :" + time;
            for (int i = 0; i < 10; i++)
            {
                text += string.Format("<br/> Guid{0}={1}", (i + 1), Guid.NewGuid().ToString().ToUpper());
            }
            string   logDir = LogPrepare.GetLogPath();
            ELogType el     = ELogType.EmailLog;
            string   day    = LogPrepare.GetLogName(el);

            try
            {
                Dictionary <string, string> emailSetting = InitAppSetting.AppSettingItemsInDB;
                string   type       = emailSetting[EAppSetting.SMTP.ToString()];
                string   sendBy     = emailSetting[EAppSetting.SystemEmailSendBy.ToString()];
                string   authorCode = emailSetting[EAppSetting.SystemEmailSMPTAuthor.ToString()];
                string   smtpClient = emailSetting[EAppSetting.SMTPClient.ToString()];
                EnumSMTP smtp;
                Enum.TryParse(type, out smtp);
                AppEmailData emailData = new AppEmailData()
                {
                    EmailCreateTime = DateTime.Now,
                    To      = InitAppSetting.Global.ReceiverInEmailActive,// "*****@*****.**",
                    Subject = title,
                    From    = sendBy,
                    Body    = text
                };
                EmailSystemSetting setting = new Model.EmailSystemSetting()
                {
                    EmailHostPort     = smtp == EnumSMTP.NETS163? 25:587,
                    EmailAuthortyCode = authorCode,
                    EmailAccount      = sendBy,
                    EmailHost         = smtpClient
                };

                #region 直接发送,不存储【测试可用】

                /*
                 * EmailData email = new EmailData()
                 * {
                 *  EmailTo =InitAppSetting.Global.ReceiverInEmailActive,
                 *  EmailSubject = title,
                 *  EmailBody = text,
                 *  CreateTime = DateTime.Now,
                 *  EmailFrom = sendBy
                 * };
                 * EmailService es = new EmailService(smtpClient, sendBy, authorCode, 25, true);
                 * es.SendEmailBy163(email);
                 * */
                #endregion
                IEmailDataService eds = IocMvcFactoryHelper.GetInterface <IEmailDataService>();
                eds.SendEmail(setting, emailData, smtp);
                LoggerWriter.CreateLogFile(time + "\t[OK]进行邮件测试", logDir, el, day, true);
            }
            catch (Exception ex)
            {
                string msg = time + "\t[ Error]" + ex.Message;
                LoggerWriter.CreateLogFile(msg, logDir, el, day, true);
            }
        }