/// <summary>
        /// 生成实体类
        /// </summary>
        /// <param name="ProjectName">项目名称</param>
        /// <param name="ClassName">类名备注</param>
        /// <param name="EntityName">实体类名称</param>
        /// <param name="table">表名</param>
        /// <returns></returns>
        public ActionResult GetCodeBuilderEntity(string ProjectName, string ClassName, string EntityName, string table)
        {
            codematicbll.Company     = "Learun";
            codematicbll.Author      = "she";
            codematicbll.CreateYear  = DateTime.Now.ToString("yyyy");
            codematicbll.CreateDate  = DateTime.Now.ToString("yyyy.MM.dd HH:mm");
            codematicbll.ClassName   = ClassName;
            codematicbll.ProjectName = ProjectName;
            codematicbll.EntityName  = EntityName;

            DataTable dt = new DataTable();
            string    PrimaryKeyColumns = "";

            if (ConfigHelper.AppSettings("CodeMaticMode") == "PowerDesigner")
            {
                dt = codematicbll.GetColumns(table);
                PrimaryKeyColumns = codematicbll.GetPrimaryKey(table);
            }
            else if (ConfigHelper.AppSettings("CodeMaticMode") == "DataBase")
            {
                dt = base_databasebll.GetColumnList(table);
                dt.Columns["column"].ColumnName   = "column_Name";
                dt.Columns["datatype"].ColumnName = "data_type";
                dt.Columns["length"].ColumnName   = "char_col_decl_length";
                dt.Columns["remark"].ColumnName   = "comments";
                PrimaryKeyColumns = base_databasebll.GetPrimaryKey(table);
            }
            return(Content(codematicbll.CodeBuilder_Entity(table, PrimaryKeyColumns, dt)));
        }
예제 #2
0
        public ActionResult Edit(long id, string body, string title)
        {
            ResultInfo ri = new ResultInfo();

            if (id > 0)
            {
                var model = NewsBLL.Instance.GetModel(id);
                if (model == null)
                {
                    ri.Msg = "新闻不存在";
                }
                else if (model.IsDelete == 0)
                {
                    model.NTitle = title;
                    model.NBody  = HttpUtility.UrlDecode(body);
                    ri           = NewsBLL.Instance.Update(model);
                    if (ri.Ok)
                    {
                        ri.Url = ConfigHelper.AppSettings("NewsDetail").FormatWith(id);
                    }
                }
                else
                {
                    ri.Msg = "新闻已被删除";
                }
            }
            else
            {
                ri.Msg = "新闻异常";
            }
            return(Result(ri));
        }
        public SmartHubConnectionProcessor(IConnectionService connectionService, IUserChannelService userChannelService)
        {
            this.connectionService  = connectionService;
            this.userChannelService = userChannelService;

            concurrencyConnection = ConfigHelper.AppSettings <int>("ConcurrencyConnection", 5);
        }
예제 #4
0
        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            var domain     = ConfigHelper.AppSettings("Domain");
            var target_uri = filterContext.RequestContext.HttpContext.Request.Url.PathAndQuery;
            var identity   = filterContext.HttpContext.User.Identity;

            if (!identity.IsAuthenticated)
            {
                var userAgent    = filterContext.RequestContext.HttpContext.Request.UserAgent;
                var redirect_uri = string.Format("{0}/Ui/Callback", domain);     //这里需要完整url地址,对应Controller里面的OAuthController的Callback
                var scope        = "snsapi_userinfo";
                var state        = Math.Abs(DateTime.Now.ToBinary()).ToString(); //state保证唯一即可,可以用其他方式生成
                //这里为了实现简单,将state和target_uri保存在Cache中,并设置过期时间为2分钟。您可以采用其他方法!!!
                HttpContext.Current.Cache.Add(state, target_uri, null, DateTime.Now.AddMinutes(2), TimeSpan.Zero, CacheItemPriority.Normal, null);
                //LogWriter.Default.WriteInfo(string.Format("begin weixin oauth: scope: {0}, redirect_uri: {1} , state: {2} , user agent: {3} ", scope, redirect_uri, state, userAgent));
                var weixinOAuth2Url = string.Format(
                    "https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri={1}&response_type=code&scope={2}&state={3}#wechat_redirect",
                    WeixinConfig.AppID, redirect_uri, scope, state);
                filterContext.Result = new RedirectResult(weixinOAuth2Url);
            }
            else
            {
                base.OnAuthorization(filterContext);
            }
        }
예제 #5
0
        public ActionResult Publish(string title, string body)
        {
            ResultInfo ri = new ResultInfo();

            if (UserBaseBLL.Instance.IsRoot)
            {
                News model = new News()
                {
                    NTitle     = title,
                    NBody      = HttpUtility.UrlDecode(body),
                    IsDelete   = 0,
                    CreateTime = DateTime.Now,
                    CreateUser = UserID.ToString(),
                    IsTop      = 0,
                    PVCount    = 0
                };
                int result = NewsBLL.Instance.Add(model);
                if (result > 0)
                {
                    ri.Url = ConfigHelper.AppSettings("NewsDetail").FormatWith(result);
                    ri.Ok  = true;
                    ri.Msg = "新闻发布成功";
                }
                else
                {
                    ri.Msg = "新闻发布失败";
                }
            }
            else
            {
                ri.Msg = "你没有权限";
            }
            return(Result(ri));
        }
예제 #6
0
        /// <summary>
        /// 获取新用户(30天内注册的)
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        public List <UserViewModel> GetNewUsers()
        {
            int       days = Convert.ToInt32(ConfigHelper.AppSettings("NewUsersDays"));
            DataTable dt   = dal.GetNewUsers(days);

            return(ModelConvertHelper <UserViewModel> .ConvertToList(dt));
        }
예제 #7
0
        /// <summary>
        /// 获取红人用户(红人榜按照积分等级进行排名选前20)
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        public List <UserViewModel> GetHotUsers()
        {
            int       count = Convert.ToInt32(ConfigHelper.AppSettings("HotUsersCount"));
            DataTable dt    = dal.GetHotUsers(count);

            return(ModelConvertHelper <UserViewModel> .ConvertToList(dt));
        }
예제 #8
0
        public void UpWhois(string ip)
        {
            string        DomainName = ConfigHelper.AppSettings("Whois");
            string        RR         = ConfigHelper.AppSettings("AName");
            AliyunRequest model      = new AliyunRequest();

            model.AccessKeyId       = ConfigHelper.AppSettings("AL_ID");
            model.Access_Key_Secret = ConfigHelper.AppSettings("AL_KEY");
            AliyunUtils.Init(model);

            //获取单前ID值
            var data = new Dictionary <string, string> {
            };

            data.Add("DomainName", DomainName);
            ResponseDescribeDomainRecords getRes = AliyunUtils.GetResponse(ActionType.DescribeDomainRecords, data) as ResponseDescribeDomainRecords;
            var oldModel = getRes.DomainRecords.Record.Where(x => x.RR == RR).FirstOrDefault();

            //修改单前ID值
            data.Clear();
            data.Add("RecordId", oldModel.RecordId);
            data.Add("RR", RR);
            data.Add("Type", oldModel.Type);
            data.Add("Value", ip);
            data.Add("TTL", oldModel.TTL.ToString());
            data.Add("Line", oldModel.Line);
            var upRes = AliyunUtils.GetResponse(ActionType.UpdateDomainRecord, data);
        }
예제 #9
0
        /// <summary>
        ///  保存配置文件
        /// </summary>
        /// <param name="model">对象</param>
        public static bool SaveConifg <T>(T model) where T : new()
        {
            var    _t       = typeof(T);
            String filepath = Util.MapPath(ConfigHelper.AppSettings(ConfigPath + _t.Name));

            return(XmlHelper <T> .Save(model, filepath));
        }
예제 #10
0
        private BBSListViewModel GetQuestionList(HomeSortTypeEnum sortType)
        {
            string           sortConfit = ConfigHelper.AppSettings("HomeSortConfig-{0}".FormatWith(sortType.ToString()));
            int              count      = ConfigHelper.AppSettings("HomeListCount").ToInt32();
            BBSListViewModel model      = new BBSListViewModel();

            model.QuestionPage = InitPage();
            model.QuestionList = QuestionBLL.Instance.GetListBySortType(sortType, count, sortConfit, model.QuestionPage);

            bool isVip = UserBaseBLL.Instance.IsVIP(UserID);//当前用户是否VIP用户

            model.QuestionList?.Where(a => a.TopicID == 1037)?.ToList()?.ForEach(item =>
            {
                if (IsLogin)
                {
                    //是会员 或者 购买过了 则显示
                    item.HideForNoVipUserOrNotBuy = !isVip && DB.BuyOtherLog.FirstOrDefault(a => a.CreateUser == UserID && a.MainID == item.QuestionId) == null;
                }
                else
                {
                    item.HideForNoVipUserOrNotBuy = true;
                }
            });
            return(model);
        }
예제 #11
0
        /// <summary>
        /// 获取总行数
        /// </summary>
        /// <param name="_Model"></param>
        /// <returns></returns>
        public int GetRecordCount(cloud_alarm model)
        {
            int TotalItems = 0;

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("select   count(1) as TotalItems  from ");
                strSql.Append(" ( ");
                strSql.Append(" select ");
                strSql.Append(" a.id, ");
                strSql.Append(" a.EquipmentId, ");
                strSql.Append(" b.name as  EquipmentName, ");
                strSql.Append(" a.code,");
                strSql.Append(" c.codeName, ");
                strSql.Append(" c.ReasonMark,");
                strSql.Append(" c.ResolventMark, ");
                strSql.Append(" a.CreateTime, ");
                strSql.Append(" c.Remark ,");
                strSql.Append(" case a.IsRead  when '0'  then '未读' when  '1' then  '已读' else '未知' end as  IsReadState,");
                strSql.Append(" case a.IsOk  when '0'  then '未解决' when  '1' then  '已解决' else '未知' end as  IsOkState ");
                strSql.Append(" from  cloud_alarm a left join  cloud_equipment b on a.EquipmentId = b.EquipmentId");
                strSql.Append(" left join cloud_helpinfo c on c.`Code`= a.`Code`");
                strSql.Append(" left join  cloud_userequipment d on d.EquipmentId= b.EquipmentId ");//客户关联设备
                strSql.Append(" where  1=1  ");

                if (model.CodeName != null && model.CodeName != "")
                {
                    strSql.Append(string.Format(" and  c.CodeName  like '%{0}%' ", model.CodeName));
                }
                if (model.UserId != null && model.UserId != "")
                {
                    string roleId = ManageProvider.Provider.Current().RoleId;
                    //客户角色1
                    if (roleId.Contains(ConfigHelper.AppSettings("CustomerRoleId")))
                    {
                        strSql.Append(string.Format("  and  d.UserId='{0}' ", model.UserId));//客户看到的
                    }

                    //销售代表2
                    if (roleId.Contains(ConfigHelper.AppSettings("RoleIdByXiaoShou")))
                    {
                        strSql.Append(string.Format("  and b.Businesspeople='{0}' ", model.UserId));//销售看到的
                    }
                }
                strSql.Append("order by a.CreateTime desc ");
                strSql.Append(" )  a ; ");

                DataTable dt = Repository().FindTableBySql(strSql.ToString());
                if (dt != null && dt.Rows.Count > 0)
                {
                    TotalItems = Convert.ToInt32(dt.Rows[0]["TotalItems"]);
                }
            }
            catch (Exception ex)
            {
            }
            return(TotalItems);
        }
예제 #12
0
파일: Service1.cs 프로젝트: gxlbang/yoga
        private void SendMessage(string Number, string U_Number, string CurrMoney, string result, string Money, string time)
        {
            var usermodel = database.FindEntity <Ho_PartnerUser>(U_Number);
            var first     = new First()
            {
                color = "#000000",
                value = usermodel.Name + ",您电费缴费" + result
            };
            var keynote1 = new Keynote1()
            {
                color = "#0000ff",
                value = Money + "元"
            };
            var keynote2 = new Keynote2()
            {
                color = "#0000ff",
                value = time
            };
            var keynote3 = new Keynote3()
            {
                color = "#0000ff",
                value = CurrMoney + "元"
            };

            //var keynote4 = new Keynote4()
            //{
            //    color = "#0000ff",
            //    value = rent.CreateTime.Value.ToString("yyyy年MM月dd日")
            //};
            //var keynote5 = new Keynote5()
            //{
            //    color = "#0000ff",
            //    value = "已派师傅:" + wxuser.Name + " " + wxuser.Mobile
            //};
            Weixin.Mp.Sdk.Domain.Remark remark = new Remark();
            remark.color = "#464646";
            remark.value = result == "成功" ? "感谢您的使用。" : "费用已经退回您的余额,稍后重新尝试!";
            Weixin.Mp.Sdk.Domain.Data data = new Data();
            data.first    = first;
            data.keynote1 = keynote1;
            data.keynote2 = keynote2;
            data.keynote3 = keynote3;
            //data.keynote4 = keynote4;
            //data.keynote5 = keynote5;
            data.remark = remark;
            Weixin.Mp.Sdk.Domain.Miniprogram miniprogram = new Miniprogram();
            miniprogram.appid    = "";
            miniprogram.pagepath = "";
            Weixin.Mp.Sdk.Domain.TemplateMessage templateMessage = new TemplateMessage();
            templateMessage.AppId       = ConfigHelper.AppSettings("WEPAY_WEB_APPID");
            templateMessage.AppSecret   = ConfigHelper.AppSettings("WEPAY_WEb_AppSecret");
            templateMessage.data        = data;
            templateMessage.miniprogram = miniprogram;
            templateMessage.template_id = "LvmnXS1GVISLKU0sg3bmRq78G7xHq6BiQvOTr5i2a4Y";

            templateMessage.touser = usermodel.OpenId;
            templateMessage.url    = "http://am.zst0771.com/Personal/AmmeterPayCost?number=" + Number;
            templateMessage.SendTemplateMessage();
        }
예제 #13
0
        /// <summary>
        /// 获取老用户(180天以上的)
        /// </summary>
        /// <returns></returns>
        public List <UserViewModel> GetOldUsers()
        {
            int       days  = Convert.ToInt32(ConfigHelper.AppSettings("NewUsersDays"));
            int       count = Convert.ToInt32(ConfigHelper.AppSettings("HotUsersCount"));
            DataTable dt    = dal.GetOldUsers(days, count);
            var       model = ModelConvertHelper <UserViewModel> .ConvertToList(dt);

            return(model.OrderByDescending(a => { return a.SignCount + a.CommentCount; }).ToList());
        }
예제 #14
0
        protected void ConnectServer()
        {
            var server = ConfigHelper.AppSettings("Server");
            var index  = server.LastIndexOf(':');
            var host   = server.Substring(0, index);
            var port   = int.Parse(server.Substring(index + 1));

            ConnectServer(host, port);
        }
예제 #15
0
        /// <summary>
        /// 获取总行数
        /// </summary>
        /// <param name="_Model"></param>
        /// <returns></returns>
        public int GetRecordCount(cloud_componentrepairrecord model)
        {
            int TotalItems = 0;

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("select   count(1) as TotalItems  from ");
                strSql.Append(" ( ");
                strSql.Append(" select ");
                strSql.Append(" c.OrderNumber , ");
                strSql.Append(" c.Name as equipmentName , ");
                strSql.Append(" a.*  ,");
                strSql.Append(" d.Id as repairrecordId,");
                strSql.Append(" d.Starttime,");
                strSql.Append(" d.Endtime,");
                strSql.Append(" ( select datediff(d.Starttime, d.Endtime)) as Lev ");
                strSql.Append(" from  cloud_componentlist a  ");
                strSql.Append(" inner join   cloud_equipmentcomponen b  on  a.Id= b.component");
                strSql.Append(" inner join cloud_equipment  c on c.EquipmentId = b.EquipmentId ");
                strSql.Append(" left join   cloud_componentrepairrecord  d  on d.Cloud_componentId= a.Id   and   b.EquipmentId = d.EquipmentId ");
                strSql.Append(" left join  cloud_userequipment  e on  e.EquipmentId= c.EquipmentId   ");
                strSql.Append(" where  1=1  ");
                if (model.ComponentName != null && model.ComponentName != "")
                {
                    strSql.Append(string.Format(" and  a.Name  like '%{0}%' ", model.ComponentName));
                }
                if (model.UserId != null && model.UserId != "")
                {
                    string roleId = ManageProvider.Provider.Current().RoleId;
                    //客户角色1
                    if (roleId.Contains(ConfigHelper.AppSettings("CustomerRoleId")))
                    {
                        strSql.Append(string.Format("  and  e.UserId='{0}' ", model.UserId));//客户看到的
                    }

                    //销售代表2
                    if (roleId.Contains(ConfigHelper.AppSettings("RoleIdByXiaoShou")))
                    {
                        strSql.Append(string.Format("  and c.Businesspeople='{0}' and  (c.AgentUserId is null  or  c.AgentUserId='') ", model.UserId));//销售看到的
                    }
                }
                strSql.Append(" order by Lev asc ");
                strSql.Append(" )  a ; ");

                DataTable dt = Repository().FindTableBySql(strSql.ToString());
                if (dt != null && dt.Rows.Count > 0)
                {
                    TotalItems = Convert.ToInt32(dt.Rows[0]["TotalItems"]);
                }
            }
            catch (Exception ex)
            {
            }
            return(TotalItems);
        }
예제 #16
0
        public ActionResult Edit(Product model)
        {
            ResultInfo ri = new ResultInfo();

            if (ModelState.IsValid)
            {
                Product _model = ProductBLL.Instance.GetModel(model.ProductID);
                if (_model == null)
                {
                    ri.Msg = "该产品已被删除";
                }
                else
                {
                    Action <string> action = (imagePath) =>
                    {
                        _model.CompanyName = model.CompanyName;
                        _model.PTitle      = model.PTitle;
                        _model.PLocation   = model.PLocation;
                        _model.PDesc       = model.PDesc;
                        _model.PFunction   = model.PFunction;
                        _model.PPrice      = model.PPrice;
                        _model.PSize       = model.PSize;
                        _model.Contact     = model.Contact;
                        _model.ProductPic  = imagePath;
                        _model.PUnit       = model.PUnit;
                        _model.PWeight     = model.PWeight;
                        _model.SendDay     = model.SendDay;
                        _model.UpdateUser  = UserID.ToString();
                        _model.UpdateTime  = DateTime.Now;

                        ri = ProductBLL.Instance.Update(_model);
                        if (ri.Ok)
                        {
                            ri.Url = ConfigHelper.AppSettings("ProductDetail").FormatWith(_model.ProductID);
                        }
                    };
                    //是否修改上传照片
                    if (GetRequest <bool>("ischange"))
                    {
                        string oldImagePath = _model.ProductPic;
                        ri = UpLoadImg("ProductPic", "/Content/Job/CP");
                        if (ri.Ok)
                        {
                            action(ri.Url);
                            UploadHelper.DeleteUpFile(oldImagePath);
                        }
                    }
                    else
                    {
                        action(_model.ProductPic);
                    }
                }
            }
            return(Result(ri));
        }
예제 #17
0
        /// <summary>
        /// 加载数据库表字段 返回JSon
        /// </summary>
        /// <returns></returns>
        public ActionResult GetFieldTreeJson()
        {
            string        tableCode = Request["tableCode"];//表名
            StringBuilder sb        = new StringBuilder();
            string        ImportId  = DataFactory.Database().FindEntity <Base_ExcelImport>("ImportTable", tableCode).ImportId;

            if (string.IsNullOrEmpty(ImportId))
            {
                return(Content(sb.ToString()));
            }
            List <Base_ExcelImportDetail> list = DataFactory.Database().FindList <Base_ExcelImportDetail>("ImportId", ImportId);
            DataTable dt = new DataTable();

            if (ConfigHelper.AppSettings("CodeMaticMode") == "PowerDesigner")
            {
                dt = codematicbll.GetColumns(tableCode);
            }
            else if (ConfigHelper.AppSettings("CodeMaticMode") == "DataBase")
            {
                dt = base_databasebll.GetColumnList(tableCode);
                dt.Columns["column"].ColumnName   = "column_Name";
                dt.Columns["datatype"].ColumnName = "data_type";
                dt.Columns["length"].ColumnName   = "char_col_decl_length";
                dt.Columns["remark"].ColumnName   = "comments";
            }

            //list.Find()
            sb.Append("[");
            sb.Append("{");
            sb.Append("\"id\":\"0\",");
            sb.Append("\"text\":\"" + tableCode + "\",");
            sb.Append("\"value\":\"0\",");
            sb.Append("\"isexpand\":true,");
            sb.Append("\"hasChildren\":true,");
            sb.Append("\"ChildNodes\":[");
            foreach (DataRow dr in dt.Rows)
            {
                sb.Append("{");
                sb.Append("\"id\":\"" + dr["column_Name"].ToString() + "\",");
                sb.Append("\"text\":\"" + dr["comments"].ToString() + "\",");
                sb.Append("\"value\":\"" + dr["column_Name"].ToString() + "\",");
                sb.Append("\"title\":\"" + dr["column_Name"].ToString() + "\",");
                sb.Append("\"length\":\"" + dr["char_col_decl_length"].ToString() + "\",");
                sb.Append("\"showcheck\":true,");
                sb.Append(string.Format("\"checkstate\":{0},", list.Exists(x => x.FieldName == dr["column_Name"].ToString()) ? "1" : "0"));
                sb.Append("\"isexpand\":true,");
                sb.Append("\"hasChildren\":false");
                sb.Append("},");
            }
            sb = sb.Remove(sb.Length - 1, 1);
            sb.Append("]");
            sb.Append("}");
            sb.Append("]");
            return(Content(sb.ToString()));
        }
예제 #18
0
파일: UrlHelper.cs 프로젝트: radtek/HKSJ
 /// <summary>
 /// 读取App.Config中的QiniuPublicDomain,合并resourceName生成完整的Url
 /// </summary>
 /// <param name="resourceName">七牛Resource Key</param>
 /// <returns>以http://开头的Url或者null</returns>
 public static string QiniuPublicCombine(string resourceName)
 {
     if (string.IsNullOrEmpty(resourceName) || resourceName.StartsWith("http://") || resourceName.StartsWith("https://"))
     {
         return(resourceName);
     }
     else
     {
         return("http://" + VirtualPathUtility.AppendTrailingSlash(ConfigHelper.AppSettings("QiniuPublicDomain")) + resourceName);
     }
 }
예제 #19
0
        private static bool CheckUploadFileType(string fileName)
        {
            //允许的文件类型,如"rar,txt"
            var allowUploadFileType = ConfigHelper.AppSettings("AllowUploadFileType");

            //得到后缀,如rar
            var fileType = fileName.Substring(fileName.LastIndexOf(".") + 1);
            var typeList = allowUploadFileType.Split(',');

            return(typeList.Contains(fileType) ? true : false);
        }
예제 #20
0
 /// <summary>
 /// IP限制验证
 /// </summary>
 /// <param name="Account"></param>
 /// <param name="IPAddress"></param>
 /// <param name="IPAddressName"></param>
 /// <param name="OpenId"></param>
 public void VerifyIPAddress(string Account, string IPAddress, string IPAddressName, string OpenId)
 {
     if (ConfigHelper.AppSettings("VerifyIPAddress") == "true")
     {
         List <DbParameter> parameter = new List <DbParameter>();
         parameter.Add(DbFactory.CreateDbParameter("@IPAddress", IPAddress));
         parameter.Add(DbFactory.CreateDbParameter("@IPAddressName", IPAddressName));
         parameter.Add(DbFactory.CreateDbParameter("@OpenId", DESEncrypt.Decrypt(OpenId)));
         int IsOk = DataFactory.Database().ExecuteByProc("[Login].dbo.[PROC_verify_IPAddress]", parameter.ToArray());
     }
 }
예제 #21
0
        public void CheckWhois()
        {
            string localIp = ConfigHelper.AppSettings("IP");
            string currIp  = localIp;

            if (localIp != currIp)
            {
                UpWhois(currIp);
                ConfigHelper.SetValue("IP", currIp);
            }
        }
예제 #22
0
        //构造请求参数
        public Dictionary <string, object> BuildRequest(bool isasync)
        {
            Isasync = isasync;
            Dictionary <string, object> paramMap = new Dictionary <string, object>();

            //授权码 可从后台获取
            //string auth_code = ConfigMgr.Ins["auth_code"].AsString();
            string auth_code = ConfigHelper.AppSettings("auth_code");

            if (string.IsNullOrEmpty(auth_code))
            {
                throw new Exception("授权码为空");
            }
            else
            {
                paramMap["auth_code"] = auth_code;
            }

            //异步通知 url
            //string notify_url = ConfigMgr.Ins["notify_url"].AsString();
            string notify_url = ConfigHelper.AppSettings("notify_url");

            if (Isasync && !string.IsNullOrEmpty(notify_url))
            {
                paramMap["notify_url"] = notify_url;
            }

            if (request_content == null)
            {
                throw new Exception("请求内容为空");
            }
            paramMap["request_content"] = Newtonsoft.Json.JsonConvert.SerializeObject(request_content);
            paramMap["timestamp"]       = TimeStamp;

            //签名随机字符串  可从后台获取和更改
            string random_code = ConfigHelper.AppSettings("random_code").AsString();

            if (string.IsNullOrEmpty(random_code))
            {
                throw new Exception("签名随机字符串为空");
            }

            //签名
            StringBuilder sb = new StringBuilder();

            foreach (var pair in paramMap.OrderBy(o => o.Key))
            {
                sb.Append(pair.Value);
            }
            sb.Append(random_code);
            paramMap["sign"] = CreateMD5Hash(sb.ToString());

            return(paramMap);
        }
예제 #23
0
        /// <summary>
        /// 读取配置文件
        /// </summary>
        /// <returns></returns>
        public static T LoadConfig <T>() where T : new()
        {
            var _t    = typeof(T);
            T   model = CacheHelper.Get <T>(CacheName + _t.Name);

            if (model == null)
            {
                String filepath = Util.MapPath(ConfigHelper.AppSettings(ConfigPath + _t.Name));
                model = XmlHelper <T> .Load(filepath);

                CacheHelper.Insert(CacheName, model, filepath);
            }
            return(model);
        }
예제 #24
0
        public ResultInfo UpLoadImg(string requestName, string savePath, ImgExtTypeEnum imgExt = ImgExtTypeEnum.jpg, Action <Func <ResultInfo>, ResultInfo> beforeSaveFile = null, string filename = null, bool onlyThumbImg = false, bool isNeedFile = true)
        {
            ResultInfo         ri     = new ResultInfo();
            HttpPostedFileBase upfile = Request.Files[requestName];

            if (isNeedFile)
            {
                if (upfile == null)
                {
                    ri.Msg = "请选择要上传的文件";
                }
                else
                {
                    string ext = Path.GetExtension(upfile.FileName);
                    if (!CheckFileExt(ext))
                    {
                        ri.Msg = $"不允许上传{ext}类型的文件!";
                    }
                    else
                    {
                        int maxlength = Convert.ToInt32(ConfigHelper.AppSettings("UploadFileMax"));//最大上传大小/M
                        if (upfile.ContentLength > maxlength * 1024 * 1024)
                        {
                            ri.Msg = "上传文件最大只能是{0}M".FormatWith(maxlength);
                        }
                        else
                        {
                            if (beforeSaveFile != null)
                            {
                                beforeSaveFile(() =>
                                {
                                    SaveFile(ri, upfile, savePath, ext, imgExt, filename, onlyThumbImg);
                                    return(ri);
                                }, ri);
                            }
                            else
                            {
                                SaveFile(ri, upfile, savePath, ext, imgExt, filename, onlyThumbImg);
                            }
                        }
                    }
                }
            }
            else
            {
                beforeSaveFile(null, ri);
            }
            return(ri);
        }
예제 #25
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AutofacConfig.Register();

            //Chat();
            if (Convert.ToBoolean(ConfigHelper.AppSettings("OpenGlobalRun")))
            {
                ReSetCloseAccount();
                NiceAnswer();
            }
        }
예제 #26
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public AutoRunProgram()
        {
            if (int.TryParse(ConfigHelper.AppSettings("AutoUpdateAttStatusInterval"), out _interval))
            {
                cnnStr = "Server=.;Database=PinkOneMngSys;user id=admin;password=Pinkone_2019;";
#if DEBUG
                cnnStr = "Server=212.64.49.60;Database=PinkOneMngSys;user id=admin;password=Pinkone_2019;";
#endif
                adoHelper = new AdoNetHelper(cnnStr);

                //更新数据
                updateTask = new Task(Update_Handle);
                updateTask.Start();
            }
        }
예제 #27
0
        public int Get_TagRandomNumber()
        {
            var val = CSharpCacheHelper.Get(APPConst.TagRandomNumber);

            if (val == null)
            {
                var config = ConfigHelper.AppSettings(APPConst.TagRandomNumber).ToInt32();
                Set_TagRandomNumber(config);
                return(config);
            }
            else
            {
                return(Convert.ToInt32(val));
            }
        }
예제 #28
0
        public static void Register()
        {
            Token            = ConfigHelper.AppSettings("Token");
            EncodingAESKey   = ConfigHelper.AppSettings("EncodingAESKey");
            AppID            = ConfigHelper.AppSettings("AppID");
            AppSecret        = ConfigHelper.AppSettings("AppSecret");
            PartnerKey       = ConfigHelper.AppSettings("PartnerKey");
            mch_id           = ConfigHelper.AppSettings("mch_id");
            device_info      = ConfigHelper.AppSettings("device_info");
            spbill_create_ip = ConfigHelper.AppSettings("spbill_create_ip");
            var openJSSDK = int.Parse(ConfigHelper.AppSettings("OpenJSSDK")) > 0;

            TokenHelper = new TokenHelper(6000, AppID, AppSecret, openJSSDK);
            TokenHelper.Run();
        }
예제 #29
0
        public Form1()
        {
            InitializeComponent();

            //ddoper.CorpId = "ding9936f1c1a7d506d9acaaa37764f94726";
            //ddoper.CorpSecret = "FJi_OKqaRYt3t5s8Z5R7FtuflLyEGzZXD9yMfL2aSRZBTarrKs43Ub5oorVEEn5l";
            ddoper.AgentID   = ConfigHelper.AppSettings("AgentID");
            ddoper.AppKey    = ConfigHelper.AppSettings("AppKey");
            ddoper.AppSecret = ConfigHelper.AppSettings("AppSecret");
            dpr = new DeptProvider(ddoper);
            ddoper.SetDept(dpr.GetDepts());
            ddcio = new DinDingCheckInOutOper(ddoper, dkc, new AttContext());
            aro   = new AttRecordOper(ddoper);
            ddcio.GetCheckInOutRecord = aro.GetCheckInOutRecord;
        }
예제 #30
0
        public int Get_NewShowCount()
        {
            var val = CSharpCacheHelper.Get(APPConst.NewShowCount);

            if (val == null)
            {
                var config = ConfigHelper.AppSettings(APPConst.NewShowCount).ToInt32();
                Set_NewShowCount(config);
                return(config);
            }
            else
            {
                return(Convert.ToInt32(val));
            }
        }