Esempio n. 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var config = new Utility.SiteConfig();
         SocketURL            = config.SocketURL;
         RealName             = WebUtil.GetUser(this.Context).RealName;
         HasWechatServiceAuth = base.CheckAuthByModuleCode("1191501") ? 1 : 0;
         var company = WebUtil.GetCompany(this.Context);
         if (company != null)
         {
             if (company.IsAdmin)
             {
                 ServerEndTime = "永久";
             }
             else
             {
                 ServerEndTime = company.ServerEndTime > DateTime.MinValue ? company.ServerEndTime.ToString("yyyy年MM月dd日") : "已过期";
             }
         }
         LogoPath = "html/images/NewLogo.png";
         string LogoFullPath = HttpContext.Current.Server.MapPath("~/" + LogoPath);
         if (!System.IO.File.Exists(LogoFullPath))
         {
             LogoPath = "/" + LogoPath;
         }
     }
 }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CanEdit = base.CheckAuthByModuleCode("1101376") ? 1 : 0;
            var config = new Utility.SiteConfig();

            IsFuShunJu = config.IsFuShunJu ? 1 : 0;
        }
Esempio n. 3
0
        public static string getAPIURL()
        {
            var    config = new Utility.SiteConfig();
            string apiURL = config.APIURL;

            return(apiURL);
        }
Esempio n. 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         var user = WebUtil.GetUser(this.Context);
         is400User   = user.PositionName.Equals("400专员");
         UserID      = user.UserID;
         AddUserName = user.LoginName;
         var data = Foresight.DataAccess.Seat.GetSeatByIDAndUserID(0, WebUtil.GetUser(this.Context).UserID);
         if (data != null)
         {
             this.hdRecordLocation.Value = data.RecordLocation;
         }
         var config = new Utility.SiteConfig();
         SocketURL = config.SocketURL;
         RealName  = WebUtil.GetUser(this.Context).RealName;
         LogoPath  = "html/images/NewLogo.png";
         string LogoFullPath = HttpContext.Current.Server.MapPath("~/" + LogoPath);
         if (!System.IO.File.Exists(LogoFullPath))
         {
             LogoPath = "/" + LogoPath;
         }
         SetAuthInfo();
     }
 }
Esempio n. 5
0
        public static string GetCommPassword()
        {
            string newpassword = DateTime.Now.ToString("yyyyMMdd");
            string prepwd      = new Utility.SiteConfig().PreIndex;

            newpassword = prepwd + newpassword;
            return(newpassword);
        }
Esempio n. 6
0
        /// <summary>
        /// 发送短信
        /// </summary>
        /// <param name="mobile">号码</param>
        /// <param name="body">短信内容</param>
        /// <returns></returns>
        public static bool Send(string mobile, string body)
        {
            var    config  = new Utility.SiteConfig();
            string sign    = "【" + config.smsSign + "】";
            string content = sign + HttpContext.Current.Server.UrlEncode(body);

            return(doPostSmsMethod(mobile, content));
        }
Esempio n. 7
0
        private static bool doPostSmsMethod(string phonenumber, string sendbody)
        {
            SmsModel sms = new SmsModel();

            try
            {
                var    config      = new Utility.SiteConfig();
                string serverUrl   = config.PaasSmsServer;
                string result      = String.Empty;
                string username    = config.PaasSms_UserName;
                string password    = config.PaasSms_Password;
                string postJsonTpl = "\"account\":\"{0}\",\"password\":\"{1}\",\"phone\":\"{2}\",\"report\":\"true\",\"msg\":\"{3}\"";
                string jsonBody    = string.Format(postJsonTpl, username, password, phonenumber, sendbody);
                jsonBody = "{" + jsonBody + "}";
                HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(serverUrl);
                httpWebRequest.ContentType = "application/json";
                httpWebRequest.Method      = "POST";

                // Create NetworkCredential Object
                NetworkCredential admin_auth = new NetworkCredential(username, password);

                // Set your HTTP credentials in your request header
                httpWebRequest.Credentials = admin_auth;

                // callback for handling server certificates
                ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };

                using (StreamWriter streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
                {
                    streamWriter.Write(jsonBody);
                    streamWriter.Flush();
                    streamWriter.Close();
                    HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
                    using (StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream()))
                    {
                        result = streamReader.ReadToEnd();
                    }
                }
                if (string.IsNullOrEmpty(result))
                {
                    return(false);
                }
                var response = Utility.JsonConvert.DeserializeObject <PaasSmsResponse>(result);
                if (response.code.Equals("0"))
                {
                    return(true);
                }
                LogHelper.WriteInfo("Utility.PaasSms.doPostSmsMethod", response.errorMsg);
                return(false);
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("Utility.PaasSms", "doPostSmsMethod", ex);
                return(false);
            }
        }
Esempio n. 8
0
        public static void SendTest(string mobile, string body, out string result)
        {
            var    config  = new Utility.SiteConfig();
            string uriStr  = config.smsServer;
            string userId  = config.smsUserID;
            string account = config.smsAccount;
            string token   = config.smsPassword;
            string sign    = config.smsSign;

            result = GetResponse(uriStr, string.Format("action=send&userid={0}&account={1}&password={2}&mobile={3}&content={4}", userId, account, token, mobile, HttpUtility.UrlEncode(body, Encoding.UTF8)), Encoding.UTF8, 50000);
        }
Esempio n. 9
0
        public static bool SendSms(string mobile, string content, string verifyCode)
        {
            var config = new Utility.SiteConfig();

            if (config.PaasSmsServerEnable)
            {
                return(Utility.PaasSms.Send(mobile, content));
            }
            else if (config.tencentSmsEnable)
            {
                return(Utility.TencentSms.Send(mobile, verifyCode));
            }
            return(false);
        }
Esempio n. 10
0
        public ApplyRefundRequest(ApplyRefund_BizContent _biz_content)
        {
            var config = new Utility.SiteConfig();

            this.api_from_type = "Out_Api";
            this.method        = "heemoney.pay.refund";
            this.version       = "1.0";
            this.app_id        = config.HuiShouYin_APPID;
            this.mch_uid       = config.HuiShouYin_MCHUID;
            this.charset       = "utf-8";
            this.sign_type     = "MD5";
            this.timestamp     = DateTime.Now.ToString("yyyyMMddHHmmss");
            this.biz_content   = GetBIZ(_biz_content);
            this.sign          = GetSign(_biz_content, config.HuiShouYin_KEY);
        }
Esempio n. 11
0
        private static bool doPostSmsMethod(string phoneNumber, string verifyCode, int minute = 15)
        {
            SmsModel sms = new SmsModel();

            try
            {
                var    config    = new Utility.SiteConfig();
                string serverUrl = config.tencentServer;
                string random    = Utility.Tools.GetRandomString(8);
                serverUrl = string.Format(serverUrl, config.tencentAppID, random);
                string         result         = String.Empty;
                long           time           = getCurrentTime();
                string         sig            = calculateSignature(phoneNumber, time, random);
                int            tpl_id         = config.tencentTemplateID;
                string         postJsonTpl    = "\"ext\":\"\",\"extend\":\"\",\"params\":[\"" + verifyCode + "\",\"" + minute + "\"],\"sig\":\"" + sig + "\",\"sign\":\"\",\"tel\":{\"mobile\":\"" + phoneNumber + "\",\"nationcode\":\"86\"},\"time\":" + time + ",\"tpl_id\":" + tpl_id + "";
                string         jsonBody       = "{" + postJsonTpl + "}";
                HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(serverUrl);
                httpWebRequest.ContentType = "application/json";
                httpWebRequest.Method      = "POST";
                using (StreamWriter streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
                {
                    streamWriter.Write(jsonBody);
                    streamWriter.Flush();
                    streamWriter.Close();
                    HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
                    using (StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream()))
                    {
                        result = streamReader.ReadToEnd();
                    }
                }
                if (string.IsNullOrEmpty(result))
                {
                    return(false);
                }
                var response = Utility.JsonConvert.DeserializeObject <TencentSmsResponse>(result);
                if (response.result == 0)
                {
                    return(true);
                }
                LogHelper.WriteInfo("Utility.TencentSms.doPostSmsMethod", result);
                return(false);
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("Utility.TencentSms", "doPostSmsMethod", ex);
                return(false);
            }
        }
Esempio n. 12
0
        public static void SaveWechat_Config_Path(string VirName, Dictionary <string, object> dic)
        {
            var    siteconfig = new Utility.SiteConfig();
            string ConfigPath = siteconfig.Wechat_SitePath + VirName + @"\weixin\Web.config";

            if (!System.IO.File.Exists(ConfigPath))
            {
                ConfigPath = siteconfig.Wechat_SitePath + @"weixin\Web.config";
            }
            if (!System.IO.File.Exists(ConfigPath))
            {
                ConfigPath = siteconfig.Wechat_SitePath + @"Web.config";
            }
            if (System.IO.File.Exists(ConfigPath))
            {
                Utility.IISManager.UpdateConfigValue(ConfigPath, dic);
            }
        }
Esempio n. 13
0
        public static Dictionary <string, string> doGetCompanyParam(ref string error)
        {
            var config = new Utility.SiteConfig();
            var data   = new Dictionary <string, string>();

            data["JPushKey_Customer"]          = config.JPushKey_Customer;
            data["JPushMasterSecret_Customer"] = config.JPushMasterSecret_Customer;
            data["JPushKey_User"]          = config.JPushKey_User;
            data["JPushMasterSecret_User"] = config.JPushMasterSecret_User;

            data["tencentSecretId"]   = config.tencentSecretId;
            data["tencentSecretKey"]  = config.tencentSecretKey;
            data["tencentAppID"]      = config.tencentAppID;
            data["SmsServerSendType"] = "1";

            data["RandJsToken"] = System.Configuration.ConfigurationManager.AppSettings["RandJsToken"];
            return(data);
        }
Esempio n. 14
0
        public static string PushMessage(string title, Dictionary <string, object> extras, List <string> cids, string sendtype = "android")
        {
            PushPayload pushPayload = new PushPayload();

            pushPayload.Notification = new Notification();
            pushPayload.Platform     = sendtype;
            pushPayload.Audience     = new Audience()
            {
                RegistrationId = cids
            };
            if (pushPayload.Platform.Equals("android"))
            {
                pushPayload.Notification.Android = new Android()
                {
                    Title  = title,
                    Extras = extras
                };
            }
            else if (pushPayload.Platform.Equals("ios"))
            {
                pushPayload.Notification.IOS = new IOS()
                {
                    Badge  = "+1",
                    Extras = extras
                };
            }
            pushPayload.Message = new Message()
            {
                Title       = title,
                ContentType = "text",
                Extras      = extras
            };
            pushPayload.Options = new Options
            {
                IsApnsProduction = false
            };
            var config   = new Utility.SiteConfig();
            var client   = new JPushClient(config.JPushKey_User, config.JPushMasterSecret_User);
            var response = client.SendPushAsync(pushPayload).Result;

            return(response.Content);
        }
Esempio n. 15
0
        public static void CreateDataBase(string DatabaseName, int CompanyID)
        {
            var config = new Utility.SiteConfig();

            try
            {
                string DBFilePath = config.DBFilePath;
                string cmdtext    = @"create database " + DatabaseName + @" on primary (name=" + DatabaseName + @"_data,filename='" + DBFilePath + DatabaseName + @"_data.mdf',size=5,filegrowth=1) log on (name=" + DatabaseName + @"_data_log,filename='" + DBFilePath + DatabaseName + "_data_log.ldf',size=5,filegrowth=10%)GO";
                Utility.SQLHelper.ExecuteSql("master", cmdtext);//调用ExecuteNonQuery()来创建数据库
            }
            catch (Exception)
            {
            }
            string sqlFileName = config.sqlFileName;

            Utility.SQLHelper.ExecuteSQLFile(sqlFileName, DatabaseName);
            string sqlFileData = config.sqlFileData;

            Utility.SQLHelper.ExecuteSQLFile(sqlFileData, DatabaseName);
        }
Esempio n. 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RealName = WebUtil.GetUser(this.Context).RealName;
                var config = new Utility.SiteConfig();
                SocketURL = config.SocketURL;
                var company = WebUtil.GetCompany(this.Context);
                if (company != null)
                {
                    if (company.IsAdmin)
                    {
                        ServerEndTime = "永久";
                    }
                    else
                    {
                        ServerEndTime = company.ServerEndTime > DateTime.MinValue ? company.ServerEndTime.ToString("yyyy年MM月dd日") : "已过期";
                    }
                }
                var      list       = Foresight.DataAccess.SysMenu.GetSysMenuPageCodeList();
                string   GroupName  = Utility.EnumModel.SysMenuGroupNameDefine.appgl.ToString();
                string[] appgl_list = list.Where(p => p.GroupName.Equals(GroupName)).Select(p => p.ModuleCode).ToArray();

                GroupName = Utility.EnumModel.SysMenuGroupNameDefine.jygl.ToString();
                string[] jygl_list = list.Where(p => p.GroupName.Equals(GroupName)).Select(p => p.ModuleCode).ToArray();

                GroupName = Utility.EnumModel.SysMenuGroupNameDefine.jspt.ToString();
                string[] jspt_list = list.Where(p => p.GroupName.Equals(GroupName)).Select(p => p.ModuleCode).ToArray();

                GroupName = Utility.EnumModel.SysMenuGroupNameDefine.sjzx.ToString();
                string[] sjzx_list = list.Where(p => p.GroupName.Equals(GroupName)).Select(p => p.ModuleCode).ToArray();

                GroupName = Utility.EnumModel.SysMenuGroupNameDefine.xtsz.ToString();
                string[] xtsz_list = list.Where(p => p.GroupName.Equals(GroupName)).Select(p => p.ModuleCode).ToArray();
                this.show_appgl = base.CheckAuthByModuleCodeList(appgl_list) ? 1 : 0;
                this.show_jygl  = base.CheckAuthByModuleCodeList(jygl_list) ? 1 : 0;
                this.show_jspt  = base.CheckAuthByModuleCodeList(jspt_list) ? 1 : 0;
                this.show_sjzx  = base.CheckAuthByModuleCodeList(sjzx_list) ? 1 : 0;
                this.show_xtsz  = base.CheckAuthByModuleCodeList(xtsz_list) ? 1 : 0;
            }
        }
Esempio n. 17
0
 public static string PushSocketNotifyAlert(Utility.EnumModel.SocketNotifyDefine type, int ID = 0, string url = "")
 {
     try
     {
         string domain_path = new Utility.SiteConfig().SITE_URL;
         url = string.IsNullOrEmpty(url) ? domain_path : url;
         JObject obj = new JObject();
         obj.Add("url", url);
         obj.Add("socketserver", "http://" + new Utility.SiteConfig().SocketURL);
         obj.Add("action", "notifyalert");
         obj.Add("type", type.ToString());
         obj.Add("ID", ID);
         obj.Add("systemtype", "platform");
         SocketIOClient.SocketClient.EmitMsg(obj);
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
     return(string.Empty);
 }
Esempio n. 18
0
        public static void ExecuteSql(string DatabaseName, string cmdText)
        {
            var config = new Utility.SiteConfig();

            System.Data.SqlClient.SqlConnection conn      = new System.Data.SqlClient.SqlConnection(config.ConnString);
            System.Data.SqlClient.SqlCommand    cmdBakRst = null;
            try
            {
                cmdBakRst             = new System.Data.SqlClient.SqlCommand(cmdText, conn);
                cmdBakRst.Connection  = conn;
                cmdBakRst.CommandType = System.Data.CommandType.Text;
                cmdBakRst.Connection.Open();
                String[] sqlArr = System.Text.RegularExpressions.Regex.Split(cmdText.Trim(), "GO", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                foreach (string strsql in sqlArr)
                {
                    if (strsql.Trim().Length > 1)
                    {
                        cmdBakRst.CommandText = strsql.Trim();
                        cmdBakRst.ExecuteNonQuery();
                    }
                }
            }
            catch (System.Data.SqlClient.SqlException sexc)
            {
                LogHelper.WriteError("Utility.SQLHelper", "ExecuteSql", sexc);
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("Utility.SQLHelper", "ExecuteSql", ex);
            }
            finally
            {
                cmdBakRst.Connection.Close();
                cmdBakRst.Dispose();
                conn.Close();
                conn.Dispose();
            }
        }
Esempio n. 19
0
        public static string GetSearchConditions(List <string> SearchAreas, string keyword)
        {
            string cmd = string.Empty;

            for (int i = 0; i < SearchAreas.Count; i++)
            {
                if (i == 0)
                {
                    cmd += "[" + SearchAreas[i] + "] like '%" + keyword + "%'";
                }
                else
                {
                    cmd += " or [" + SearchAreas[i] + "] like '%" + keyword + "%'";
                }
            }
            cmd += " or [RoomID] in (select [RoomID] from [RoomPhoneRelation] where [RelatePhoneNumber] like '%" + keyword + "%')";
            var config = new Utility.SiteConfig();

            if (config.IsMallOn)
            {
                cmd += " or [RoomID] in (select [RoomID] from [RoomPhoneRelation] where [RelatePhoneNumber] in (select [PhoneNumber] from [User] where [UserID] in (select [UserID] from [Mall_UserFamily] where [PhoneNumber] like '%" + keyword + "%')))";
            }
            return(cmd);
        }
Esempio n. 20
0
        public static List <Dictionary <string, object> > GetRotatingTypeList(bool IncludeALL = false)
        {
            var config = new Utility.SiteConfig();
            var list   = new List <Dictionary <string, object> >();
            var dic    = new Dictionary <string, object>();

            dic["id"]   = 1;
            dic["name"] = "业主APP首页";
            list.Add(dic);
            dic         = new Dictionary <string, object>();
            dic["id"]   = 3;
            dic["name"] = "业主APP登录";
            list.Add(dic);
            dic         = new Dictionary <string, object>();
            dic["id"]   = 7;
            dic["name"] = "业主APP引导页";
            list.Add(dic);
            dic         = new Dictionary <string, object>();
            dic["id"]   = 9;
            dic["name"] = "业主APP引导页底部图片";
            list.Add(dic);
            if (config.IsFuShunJu)
            {
                dic         = new Dictionary <string, object>();
                dic["id"]   = 2;
                dic["name"] = "业主APP商城";
                list.Add(dic);
                dic         = new Dictionary <string, object>();
                dic["id"]   = 4;
                dic["name"] = "商家APP首页";
                list.Add(dic);
                dic         = new Dictionary <string, object>();
                dic["id"]   = 5;
                dic["name"] = "商家APP登录";
                list.Add(dic);
                dic         = new Dictionary <string, object>();
                dic["id"]   = 6;
                dic["name"] = "业主APP社区";
                list.Add(dic);
                dic         = new Dictionary <string, object>();
                dic["id"]   = 8;
                dic["name"] = "福顺券发放背景图片";
                list.Add(dic);
                dic         = new Dictionary <string, object>();
                dic["id"]   = 10;
                dic["name"] = "福顺券到期背景图片";
                list.Add(dic);
                dic         = new Dictionary <string, object>();
                dic["id"]   = 11;
                dic["name"] = "商圈模块福顺优选图片";
                list.Add(dic);
                dic         = new Dictionary <string, object>();
                dic["id"]   = 12;
                dic["name"] = "商圈模块团购图片";
                list.Add(dic);
                dic         = new Dictionary <string, object>();
                dic["id"]   = 13;
                dic["name"] = "商圈模块抢购图片";
                list.Add(dic);
                dic         = new Dictionary <string, object>();
                dic["id"]   = 14;
                dic["name"] = "新人专项资料完善图片";
                list.Add(dic);
                dic         = new Dictionary <string, object>();
                dic["id"]   = 15;
                dic["name"] = "员工APP首页";
                list.Add(dic);
            }
            if (IncludeALL)
            {
                dic         = new Dictionary <string, object>();
                dic["id"]   = 0;
                dic["name"] = "不限";
                list.Insert(0, dic);
            }
            return(list);
        }
Esempio n. 21
0
        public static void GetHomeDataCount(int UserID, out int NormalSeatCount, out int InvalidSeatCount, out int ServiceCount, out int SuggestionCount, out int TotalInCallCount, out int TotalOutCallCount, out decimal TotalInCallMin, out decimal TotalOutCallMin)
        {
            NormalSeatCount   = 0;
            InvalidSeatCount  = 0;
            ServiceCount      = 0;
            SuggestionCount   = 0;
            TotalInCallCount  = 0;
            TotalOutCallCount = 0;
            TotalInCallMin    = 0;
            TotalOutCallMin   = 0;
            string cmdtext    = "select [PickUpTime],[HangUpTime],[PhoneType] from [PhoneRecord]";
            var    recordList = GetList <PhoneRecord>(cmdtext, new List <SqlParameter>()).ToArray();

            using (SqlHelper helper = new SqlHelper())
            {
                var parameters = new List <SqlParameter>();
                cmdtext = "select count(1) from [Seat] where [DriverStatus]=1";
                var result = helper.ExecuteScalar(cmdtext, CommandType.Text, parameters);
                if (result != null)
                {
                    int.TryParse(result.ToString(), out NormalSeatCount);
                }
                cmdtext = "select count(1) from [Seat] where [DriverStatus]=2";
                result  = helper.ExecuteScalar(cmdtext, CommandType.Text, parameters);
                if (result != null)
                {
                    int.TryParse(result.ToString(), out InvalidSeatCount);
                }

                string cmdwhere = " and (exists(select 1 from [UserServiceType] where [ServiceTypeID]=CustomerService.ServiceType1ID and ([UserID]=@UserID or exists(select 1 from [UserRoles] where [RoleID]=[UserServiceType].RoleID and [UserID]=@UserID))) or CustomerService.ServiceType1ID=0)";
                parameters.Add(new SqlParameter("@UserID", UserID));
                int BaoXiuServiceID = new Utility.SiteConfig().BaoXiuServiceID;

                cmdtext = "select ProjectID,ServiceType1ID from [CustomerService] where 1=1" + cmdwhere;
                var serviceList = GetList <CustomerService>(cmdtext, parameters).ToArray();
                //result = helper.ExecuteScalar(cmdtext, CommandType.Text, parameters);
                //if (result != null)
                //{
                //    int.TryParse(result.ToString(), out SuggestionCount);
                //}
                var EqualProjectIDList = new List <int>();
                var InProjectIDList    = new List <int>();
                Project.GetMyProjectListByUserID(UserID, out EqualProjectIDList, out InProjectIDList);
                if (InProjectIDList.Count > 0 || EqualProjectIDList.Count > 0)
                {
                    var myProjectIDList = Project.GetProjectIDListbyIDList(InProjectIDList: InProjectIDList, EqualProjectIDList: EqualProjectIDList);
                    if (myProjectIDList.Length > 0)
                    {
                        serviceList = serviceList.Where(p => myProjectIDList.Contains(p.ProjectID)).ToArray();
                    }
                }
                SuggestionCount = serviceList.Where(p => p.ServiceType1ID != BaoXiuServiceID).ToArray().Length;
                ServiceCount    = serviceList.Where(p => p.ServiceType1ID == BaoXiuServiceID).ToArray().Length;

                var totalInRecordList = recordList.Where(p => p.PhoneType == 1).ToArray();
                TotalInCallCount = totalInRecordList.Length;
                TotalInCallMin   = totalInRecordList.Sum(p => p.TotalCallHour);
                TotalInCallMin   = Math.Round(TotalInCallMin, 2, MidpointRounding.AwayFromZero);

                var totalOutnRecordList = recordList.Where(p => p.PhoneType == 2).ToArray();
                TotalOutCallCount = totalOutnRecordList.Length;
                TotalOutCallMin   = totalOutnRecordList.Sum(p => p.TotalCallHour);
                TotalOutCallMin   = Math.Round(TotalOutCallMin, 2, MidpointRounding.AwayFromZero);
            }
        }
Esempio n. 22
0
 public static string doPushMessage(string title, Dictionary <string, object> extras, string[] cids = null, string sendtype = "android", string msg_content = "", int PushAPP = 1, bool IsToAll = false)
 {
     try
     {
         if (cids == null && !IsToAll)
         {
             return("没有接收用户");
         }
         PushPayload pushPayload = new PushPayload();
         //pushPayload.notification = new Notification();
         if (IsToAll)
         {
             pushPayload.audience = Audience.all();
         }
         else
         {
             pushPayload.audience = Audience.s_registrationId(cids);
         }
         pushPayload.message = Message.content(msg_content);
         //pushPayload.message.setTitle(title);
         pushPayload.message.setContentType("text");
         foreach (var item in extras)
         {
             pushPayload.message.AddExtras(item.Key, item.Value.ToString());
         }
         pushPayload.message.AddExtras("sound", "widget://res/newmessage.mp3");
         var notification = new Notification();
         notification.setAlert(msg_content);
         if (sendtype.Equals("android"))
         {
             pushPayload.platform             = Platform.android();
             notification.AndroidNotification = new AndroidNotification();
             //notification.AndroidNotification.setAlert(msg_content);
             foreach (var item in extras)
             {
                 notification.AndroidNotification.AddExtra(item.Key, item.Value.ToString());
             }
             notification.AndroidNotification.AddExtra("sound", "widget://res/newmessage.mp3");
             //pushPayload.notification = notification;
         }
         else if (sendtype.Equals("ios"))
         {
             pushPayload.platform         = Platform.ios();
             notification.IosNotification = new IosNotification();
             notification.IosNotification.setBadge(1);
             notification.IosNotification.setSound("widget://res/newmessage.mp3");
             notification.IosNotification.setAlert(msg_content);
             foreach (var item in extras)
             {
                 notification.IosNotification.AddExtra(item.Key, item.Value.ToString());
             }
             pushPayload.notification = notification;
         }
         pushPayload.options.apns_production = true;
         pushPayload.options.time_to_live    = 3600;
         var    config = new Utility.SiteConfig();
         string key    = string.Empty;
         string secret = string.Empty;
         if (PushAPP == 1)
         {
             key    = config.JPushKey_User;
             secret = config.JPushMasterSecret_User;
         }
         else if (PushAPP == 2)
         {
             key    = config.JPushKey_Customer;
             secret = config.JPushMasterSecret_Customer;
         }
         else if (PushAPP == 3)
         {
             key    = config.JPushKey_Business;
             secret = config.JPushMasterSecret_Business;
         }
         var client   = new JPushClient(key, secret);
         var response = client.SendPush(pushPayload);
         return("code:" + response.ResponseResult.responseCode + " content:" + response.ResponseResult.responseContent);
     }
     catch (Exception ex)
     {
         Utility.LogHelper.WriteError("Jpush.JpushAPI", "PushMessage", ex);
         return(ex.Message);
     }
 }
Esempio n. 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var config = new Utility.SiteConfig();

            BaiduAK = config.BaiduAK;
        }
Esempio n. 24
0
 public static void ExecuteSQLFile(String sqlFileName, string DatabaseName)
 {
     System.Data.SqlClient.SqlConnection mySqlConnection = null;
     try
     {
         var    config  = new Utility.SiteConfig();
         string connStr = config.ConnString;
         mySqlConnection = new System.Data.SqlClient.SqlConnection(connStr);
         System.Data.SqlClient.SqlCommand Command = mySqlConnection.CreateCommand();
         Command.Connection.Open();
         Command.Connection.ChangeDatabase(DatabaseName);
         using (FileStream stream = new FileStream(sqlFileName, FileMode.Open, FileAccess.ReadWrite))
         {
             StreamReader  reader = new StreamReader(stream, Encoding.Default);
             StringBuilder builder = new StringBuilder();
             String        strLine = "";
             char          spaceChar = ' ';
             string        sprit = "/", whiffletree = "-";
             while ((strLine = reader.ReadLine()) != null)
             {
                 // 文件结束
                 if (strLine == null)
                 {
                     break;
                 }
                 // 跳过注释行
                 if (strLine.StartsWith(sprit) || strLine.StartsWith(whiffletree))
                 {
                     continue;
                 }
                 // 去除右边空格
                 strLine = strLine.TrimEnd(spaceChar);
                 if (strLine.Trim().ToUpper() != @"GO")
                 {
                     builder.AppendLine(strLine);
                 }
                 else
                 {
                     Command.CommandText = builder.ToString().TrimEnd(' ');
                     try
                     {
                         Command.ExecuteNonQuery();
                     }
                     catch (Exception ex)
                     {
                         LogHelper.WriteError("更新数据库失败", DatabaseName, ex);
                     }
                     builder.Remove(0, builder.Length);
                 }
             }
             stream.Dispose();
         }
     }
     catch (Exception ex)
     {
     }
     finally
     {
         if (mySqlConnection != null && mySqlConnection.State != ConnectionState.Closed)
         {
             mySqlConnection.Close();
         }
     }
 }