Esempio n. 1
0
        public Package <string> Login(string account, string password, string appName)
        {
            try
            {
                //验证是否有权访问
                if (!authHeader.ValideUser(authHeader.UserName, authHeader.PassWord))
                {
                    return(new Package <string>(false, "没有访问权限!", null));
                }

                //手机登录&&会员名登录(只有Iport用户名首次登陆才会在sph用户表插入用户信息)
                if (TokenTool.VerifyMobile(account) == "ture")
                {
                    return(GetInfoByMobileLogin(account, password));
                }//手机号登陆
                else
                {
                    return(GetInfoByUserNameLogin(account, password));
                }
            }
            catch (Exception ex)
            {
                return(new Package <string>(false, string.Format("{0}:获取数据发生异常。{1}", ex.Source, ex.Message), null));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 校验手机号
        /// </summary>
        /// <param name="strMobile"></param>
        /// <returns></returns>
        private string VerifyMobile(string strMobile)
        {
            string strJson = string.Empty;

            //判断是否已注册
            string sql =
                string.Format("select * from TB_SYS_USERINFO  where mobile='{0}'", strMobile);
            var dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathIport).ExecuteTable(sql);

            if (dt.Rows.Count != 0)
            {
                strJson = JsonConvert.SerializeObject(new DicPackage(false, null, "手机号已注册!").DicInfo());
                log.LogCatalogFailure("手机号已注册!");
                return(strJson);
            }

            //手机号验证
            string strMessage = TokenTool.VerifyMobile(strMobile);

            if (strMessage != "ture")
            {
                strJson = JsonConvert.SerializeObject(new DicPackage(false, null, strMessage).DicInfo());
                log.LogCatalogFailure(strMessage);
                return(strJson);
            }

            return(strJson);
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var account  = Request.Params["Account"];
            var password = Request.Params["Password"];

            Dictionary <string, string> info = new Dictionary <string, string>();

            try
            {
                if (account == null || password == null)
                {
                    info.Add("参数Account,Password不能为空!举例", "http://218.92.115.55/M_Sph/Login.aspx?Account=18000000000&Password=123456");
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }

                //手机登录&&会员名登录(只有Iport用户名首次登陆才会在sph用户表插入用户信息)
                if (TokenTool.VerifyMobile(account) == "ture")
                {
                    Json = GetInfoByMobileLogin(account, password);
                }//手机号登陆
                else
                {
                    Json = GetInfoByUserNameLogin(account, password);
                }
            }
            catch (Exception ex)
            {
                info.Add("IsLogin", "No");
                info.Add("Message", string.Format("{0}:获取数据发生异常。{1}", ex.Source, ex.Message));
                Json = JsonConvert.SerializeObject(info);
            }
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //身份校验
            if (!InterfaceTool.IdentityVerifyForSys(Request))
            {
                Json = JsonConvert.SerializeObject(new DicPackage(false, null, "身份认证错误!").DicInfo());
                return;
            }

            //账号(手机号或Iport账号)
            string strAccount = Request.Form["Account"];
            //密码
            string strPassword = Request.Form["Password"];

            ////账号(手机号或Iport账号)
            //string strAccount = Request.Params["Account"];
            ////密码
            //string strPassword = Request.Params["Password"];

            SysLog log = new SysLog(Request);

            log.strAccount     = strAccount;
            log.strBehavior    = "用户登陆";
            log.strBehaviorURL = "/Entrance/Sys/Login.aspx";

            try
            {
                if (strAccount == null || strPassword == null)
                {
                    Json = JsonConvert.SerializeObject(new DicPackage(false, null, "参数错误,登陆失败!").DicInfo());
                    return;
                }

                ILogin2 iLogin = new ILogin2(log);

                //手机号登录&&Iport账号登录
                if (TokenTool.VerifyMobile(strAccount) == "ture")
                {
                    Json = iLogin.GetInfoByMobileLogin(strAccount, strPassword);
                }//手机号登陆
                else
                {
                    Json = iLogin.GetInfoByUserNameLogin(strAccount, strPassword);
                }//Iport账号登录
            }
            catch (Exception ex)
            {
                Json = JsonConvert.SerializeObject(new DicPackage(false, null, string.Format("{0}:用户登陆数据发生异常。{1}", ex.Source, ex.Message)).DicInfo());
                log.LogCatalogFailure(string.Format("{0}:用户登陆数据发生异常。{1}", ex.Source, ex.Message));
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //身份校验
            if (!InterfaceTool.IdentityVerify(Request))
            {
                Json = JsonConvert.SerializeObject(new DicPackage(false, null, "身份认证错误!").DicInfo());
                return;
            }

            //账号(手机号或Iport账号)
            string strAccount = Request.Form["Account"];
            //密码
            string strPassword = Request.Form["Password"];

            ////账号(手机号或Iport账号)
            //string strAccount = Request.Params["Account"];
            ////密码
            //string strPassword = Request.Params["Password"];

            try
            {
                if (strAccount == null || strPassword == null)
                {
                    Json = JsonConvert.SerializeObject(new DicPackage(false, null, "参数错误,登陆失败!").DicInfo());
                    return;
                }

                //手机号登录&&Iport账号登录
                if (TokenTool.VerifyMobile(strAccount) == "ture")
                {
                    Json = GetInfoByMobileLogin(strAccount, strPassword);
                }//手机号登陆
                else
                {
                    Json = GetInfoByUserNameLogin(strAccount, strPassword);
                }//Iport账号登录
            }
            catch (Exception ex)
            {
                Json = JsonConvert.SerializeObject(new DicPackage(false, null, string.Format("{0}:用户登陆数据发生异常。{1}", ex.Source, ex.Message)).DicInfo());
            }
        }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //身份校验
            if (!InterfaceTool.IdentityVerify(Request))
            {
                Json = JsonConvert.SerializeObject(new DicPackage(false, null, "身份认证错误!").DicInfo());
                return;
            }

            //手机号
            string strMobile = Request.Params["Mobile"];

            //strMobile = "17710556243";
            //strMobile = "18036600293";

            AppLog log = new AppLog(Request);

            log.strAccount     = strMobile;
            log.strBehavior    = "获取手机验证码";
            log.strBehaviorURL = "/Entrance/GetMobileAuthCode.aspx";

            try
            {
                if (strMobile == null)
                {
                    Json = JsonConvert.SerializeObject(new DicPackage(false, null, "参数错误,获取验证码失败!").DicInfo());
                    return;
                }

                //手机号验证
                string strMessage = TokenTool.VerifyMobile(strMobile);
                if (strMessage != "ture")
                {
                    Json = JsonConvert.SerializeObject(new DicPackage(false, null, strMessage).DicInfo());
                    return;
                }

                //生成随机验证码
                string strSql =
                    string.Format("select round(dbms_random.value(100000,1000000)) as authcode from dual");
                var dt0 = new Leo.Oracle.DataAccess(RegistryKey.KeyPathHmw).ExecuteTable(strSql);
                //if (dt0.Rows.Count <= 0)
                //{
                //    Json = JsonConvert.SerializeObject(new DicPackage(false, null, "网络错误,请稍后再试!").DicInfo());
                //    return;
                //}

                //获取应用中文名称
                strSql =
                    string.Format(@"select fullname 
                                    from VW_APP_TOKEN 
                                    where appname='{0}'",
                                  Request.Params["AppName"]);
                var dt1 = new Leo.Oracle.DataAccess(RegistryKey.KeyPathMa).ExecuteTable(strSql);
                //if (dt.Rows.Count <= 0)
                //{
                //    Json = JsonConvert.SerializeObject(new DicPackage(false, null, "网络错误,请稍后再试!").DicInfo());
                //    return;
                //}

                string paramData = "{\"template\":\"SMS_63320388\"," +
                                   "\"recipients\":[\"" + strMobile + "\"]," +
                                   "\"prefix\":\"连云港港\"," +
                                   "\"parameters\":{\"AUTHCODE\":\"" + Convert.ToString(dt0.Rows[0]["authcode"]) + "\",\"APPNAME\":\"" + "(" + Convert.ToString(dt1.Rows[0]["fullname"]) + ")" + "\"}}";

                var result = ALiSmsSender.PostRequest(paramData);
                if (result.Item1 == true)
                {
                    //保存动态验证码(MobileCenter)
                    //string strDynamicIntervalTime = ConfigTool.GetWebConfigKey("DynamicIntervalTime");
                    //DateTime dynamicBeginTime = DateTime.Now;
                    //DateTime dynamicEndTime = dynamicBeginTime.AddSeconds(Convert.ToDouble(strDynamicIntervalTime));
                    strSql =
                        string.Format(@"insert into TB_APP_MOBILE_AUTHCODE (mobile,dynamic_authcode,dynamic_begintime,dynamic_endtime,un_dynamic_authcode) 
                                        values({0},'{1}',sysdate,sysdate+2/24/60,{2})",
                                      strMobile, Identity.RijndaelEncode(Convert.ToString(dt0.Rows[0]["authcode"])), Convert.ToString(dt0.Rows[0]["authcode"]));
                    new Leo.Oracle.DataAccess(RegistryKey.KeyPathMa).ExecuteNonQuery(strSql);
                    Json = JsonConvert.SerializeObject(new DicPackage(true, null, "已成功发送,请注意查看!").DicInfo());
                    log.LogCatalogSuccess();
                }
                else
                {
                    Json = JsonConvert.SerializeObject(new DicPackage(false, null, "线路问题,请重新发送").DicInfo());
                    log.LogCatalogFailure("线路问题,请重新发送1");
                }
            }
            catch (Exception ex)
            {
                Json = JsonConvert.SerializeObject(new DicPackage(false, null, string.Format("{0}:获取手机验证码数据发生异常。{1}", ex.Source, ex.Message)).DicInfo());
                log.LogCatalogFailure(string.Format("{0}:获取手机验证码数据发生异常。{1}", ex.Source, ex.Message));
            }
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var mobile    = Request.Params["Mobile"];
            var password1 = Request.Params["Password1"];
            var password2 = Request.Params["Password2"];

            Dictionary <string, string> info = new Dictionary <string, string>();

            try
            {
                if (mobile == null || password1 == null || password2 == null)
                {
                    info.Add("参数Mobile,Password1,Password2不能为空!举例", "http://218.92.115.55/M_Sph/Register.aspx?Mobile=18000000000&Password1=123456&Password2=123456");
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }

                //判断是否已注册
                string sql =
                    string.Format("select * from TB_SPH_USER  where account='{0}'", mobile);
                var dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathMa).ExecuteTable(sql);
                if (dt.Rows.Count != 0)
                {
                    info.Add("IsReg", "No");
                    info.Add("Message", "手机号已注册!");
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }

                //手机号码验证
                string message = TokenTool.VerifyMobile(mobile);
                if (message != "ture")
                {
                    info.Add("IsReg", "No");
                    info.Add("Message", message);
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }

                //判断密码是的合理
                if (password1 != password2)
                {
                    info.Add("IsReg", "No");
                    info.Add("Message", "密码不一致");
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }

                //App使用截止时间
                string   timeType     = "MONTH";
                int      timeInterval = 3;
                DateTime endTime;
                switch (timeType)
                {
                case "DAY":
                    endTime = DateTime.Now.AddDays(timeInterval);
                    break;

                case "MONTH":
                    endTime = DateTime.Now.AddMonths(timeInterval);
                    break;

                case "YEAR":
                    endTime = DateTime.Now.AddYears(timeInterval);
                    break;

                default:
                    throw new Exception("错误的对象索引");
                }

                //注册
                sql =
                    string.Format(@"insert into TB_SPH_USER (account, password, endtime) 
                                    values ('{0}', '{1}',  to_date('{2}','YYYY-MM-DD HH24:MI:SS'))"
                                  , mobile, password1, endTime);
                dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathWlxgx).ExecuteTable(sql);
                //检查是否已插入
                sql =
                    string.Format(@"select * 
                                    from TB_SPH_USER 
                                    where account='{0}' and password='******' and endtime=to_date('{2}','YYYY-MM-DD HH24:MI:SS')"
                                  , mobile, password1, endTime);
                dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathWlxgx).ExecuteTable(sql);
                if (dt.Rows.Count == 0)
                {
                    info.Add("IsReg", "No");
                    info.Add("Message", "网络错误,请稍后再试!");
                }
                else
                {
                    if (Convert.ToString(dt.Rows[0]["account"]) != mobile || Convert.ToString(dt.Rows[0]["password"]) != password1 || Convert.ToString(dt.Rows[0]["endtime"]) != endTime.ToString())
                    {
                        info.Add("IsReg", "No");
                        info.Add("Message", "网络错误,请稍后再试!");
                    }
                    else
                    {
                        info.Add("IsReg", "Yes");
                        info.Add("Message", "注册成功!");
                    }
                }

                Json = JsonConvert.SerializeObject(info);
            }
            catch (Exception ex)
            {
                info.Add("IsReg", "No");
                info.Add("Message", string.Format("{0}:提交数据发生异常。{1}", ex.Source, ex.Message));
                Json = JsonConvert.SerializeObject(info);
            }
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //用户编码
            var codeUser = Request.Params["CodeUser"];
            //始发地省,市,区县
            var SFDProvince = Request.Params["SFDProvince"];
            var SFDCity     = Request.Params["SFDCity"];
            var SFDCounty   = Request.Params["SFDCounty"];
            //目的地区省,市,区县
            var MDDProvince = Request.Params["MDDProvince"];
            var MDDCity     = Request.Params["MDDCity"];
            var MDDCounty   = Request.Params["MDDCounty"];
            //货物类型
            var goods = Request.Params["Goods"];
            //重量
            var weight = Request.Params["Weight"];
            //体积(方)
            var volume = Request.Params["Volume"];
            //车长
            var vehicleLen = Request.Params["VehicleLen"];
            //车型
            var vehicleType = Request.Params["VehicleType"];
            //手机
            var mobile = Request.Params["Mobile"];
            //电话
            var phone = Request.Params["Phone"];
            //联系人
            var contact = Request.Params["Contact"];
            //距离
            var distance = Request.Params["Distance"];

            Dictionary <string, string> info = new Dictionary <string, string>();

            try
            {
                if (codeUser == null || SFDProvince == null || SFDCity == null || SFDCounty == null || MDDProvince == null || MDDCity == null || MDDCounty == null || goods == null || weight == null || volume == null || vehicleLen == null || vehicleType == null || mobile == null || phone == null || contact == null || distance == null)
                {
                    info.Add("参数CodeUser,SFDProvince,SFDCity,SFDCounty,MDDProvince,MDDCity,MDDCounty,Goods,Weight,Volume,VehicleLen,VehicleType,Mobile,Phone,Contact,Distance不能为null!举例", "http://218.92.115.55/M_Sph/Goods/ReleaseGoods.aspx?CodeUser=1DA60DDD8025725AE053A864016A725A&SFDProvince=北京&SFDCity=&SFDCounty=&MDDProvince=江苏省&MDDCity=&MDDCounty=&Goods=煤炭&Weight=&Volume=&VehicleLen=&VehicleType=&Mobile=18000000000&Phone=&Contact=&Distance=");
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }
                //判断账号、始发省、目的省、货物类型、手机是否为空
                if (codeUser == "" || SFDProvince == "" || MDDProvince == "" || goods == "" || mobile == "")
                {
                    info.Add("参数CodeUser,SFDProvince,MDDProvince,Goods,Mobile必须填数据!举例", "CodeUser=1DA60DDD8025725AE053A864016A725A&SFDProvince=北京&MDDProvince=江苏省&Goods=煤炭&Mobile=18000000000");
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }

                //手机号码验证
                string message = TokenTool.VerifyMobile(mobile);
                if (message != "ture")
                {
                    info.Add("IsRelease", "No");
                    info.Add("Message", message);
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }

                //获取用户信息
                string sql =
                    string.Format(@"select a.usertype, a.code_company, a.iport_code_user, b.username, b.authstate 
                                    from tb_sph_user a, tb_sph_user_auth b 
                                    where a.code_user=b.code_user and a.code_user='******' and b.roletype='{1}'"
                                  , codeUser, "2");
                var dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql);
                if (dt.Rows.Count == 0 || Convert.ToString(dt.Rows[0]["authstate"]) != "1")
                {
                    info.Add("IsRelease", "No");
                    info.Add("Message", "用户未认证!");
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }
                //判断是否为Iport用户
                if ((Convert.ToString(dt.Rows[0]["usertype"]) == "1") && (Convert.ToString(dt.Rows[0]["code_company"]) != "null"))
                {
                    codeUser = Convert.ToString(dt.Rows[0]["iport_code_user"]);
                }

                //发布货源
                sql =
                    string.Format(@"insert into TB_DMT_CARGO (sfd_province,sfd_city,sfd_county,mdd_province,mdd_city,mdd_county,cargoname,weight,volume,vehicleLen,vehicleType,mobile,phone,diatance,code_user,code_client,opeartor,contact_man,style) 
                                    values ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}', '{17}', '{18}')"
                                  , SFDProvince, SFDCity, SFDCounty, MDDProvince, MDDCity, MDDCounty, goods, weight, volume, vehicleLen, vehicleType, mobile, phone, distance, codeUser, Convert.ToString(dt.Rows[0]["code_company"]), Convert.ToString(dt.Rows[0]["username"]), contact, "1");
                dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql);

                info.Add("IsRelease", "Yes");
                info.Add("Message", "发布成功!");
                Json = JsonConvert.SerializeObject(info);
            }
            catch (Exception ex)
            {
                info.Add("IsRelease", "No");
                info.Add("Message", string.Format("{0}:获取数据发生异常。{1}", ex.Source, ex.Message));
                Json = JsonConvert.SerializeObject(info);
            }
        }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //身份校验
            if (!InterfaceTool.IdentityVerify(Request))
            {
                Json = JsonConvert.SerializeObject(new DicPackage(false, null, "身份认证错误").DicInfo());
                return;
            }

            //账户
            string strAccount = Request.Params["Account"];
            //反馈类型
            string strFeedbackType = Request.Params["FeedbackType"];
            //反馈对象编码
            string strCodeFeedbackObject = Request.Params["CodeFeedbackObject"];
            //公司名称编码
            string strCodeCompany = Request.Params["CodeCompany"];
            //反馈标题
            string strFeedBackTitle = Request.Params["FeedBackTitle"];
            //反馈说明
            string strFeedBackExplain = Request.Params["FeedBackExplain"];
            //电话号码
            string strPhoneNum = Request.Params["PhoneNum"];
            //匿名标志
            string strAnonymous = Request.Params["Anonymous"];


            AppLog log = new AppLog(Request);

            log.strBehavior    = "提交投诉";
            log.strBehaviorURL = "/Service/Complain/SubmitComplain.aspx";
            log.strAccount     = strAccount;

            try
            {
                if (strAccount == null || strFeedbackType == null || strCodeFeedbackObject == null || strCodeCompany == null || strFeedBackTitle == null || strFeedBackExplain == null || strPhoneNum == null || strAnonymous == null)
                {
                    Json = JsonConvert.SerializeObject(new DicPackage(false, null, "参数错误,提交投诉失败").DicInfo());
                    return;
                }


                //手机号验证
                if (!TokenTool.VerifyMobile(strPhoneNum) && !string.IsNullOrWhiteSpace(strPhoneNum))
                {
                    Json = JsonConvert.SerializeObject(new DicPackage(false, null, "手机号错误").DicInfo());
                    log.LogCatalogFailure("手机号错误");
                    return;
                }

                //部门
                string strCodeDepartment = string.Empty;
                //车号
                string strVehicle = string.Empty;

                //匿名,手机号和车号加密
                if (strAnonymous.Equals("1"))
                {
                }

                //默认公司编码
                //公路港——2
                if (strCodeFeedbackObject.Equals("1"))
                {
                    strCodeCompany = "2";
                }
                //港区卡口——21
                if (strCodeFeedbackObject.Equals("3"))
                {
                    strCodeCompany = "21";
                }

                //提交投诉
                string strSql =
                    string.Format(@"insert into SER_COMPLAIN (type_mark,code_complain_org,code_company_org,vehicle,driverphone,anonymous_mark,title,detail,account) 
                                    values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')",
                                  strFeedbackType, strCodeFeedbackObject, strCodeCompany, strVehicle, strPhoneNum, strAnonymous, strFeedBackTitle, strFeedBackExplain, strAccount);

                new Leo.Oracle.DataAccess(RegistryKey.KeyPathCGate).ExecuteNonQuery(strSql);


                Json = JsonConvert.SerializeObject(new DicPackage(true, null, "提交成功").DicInfo());
                log.LogCatalogSuccess();
            }
            catch (Exception ex)
            {
                Json = JsonConvert.SerializeObject(new DicPackage(false, null, string.Format("{0}:提交投诉发生异常。{1}", ex.Source, ex.Message)).DicInfo());
                log.LogCatalogFailure(string.Format("{0}:提交投诉发生异常。{1}", ex.Source, ex.Message));
            }
        }
Esempio n. 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //手机号码
            var mobile = Request.Params["Mobile"];

            Dictionary <string, string> info = new Dictionary <string, string>();

            try
            {
                if (mobile == null)
                {
                    info.Add("IsAuth", "No");
                    info.Add("参数Mobile不能为null!", "举例:http://218.92.115.55/M_Sph/Auth/IdentityAuthForDriver.aspx?Mobile=18000000000");
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }

                //手机号码验证
                string message = TokenTool.VerifyMobile(mobile);
                if (message != "ture")
                {
                    info.Add("IsAuth", "No");
                    info.Add("Message", message);
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }

                string sql =
                    string.Format(@"select b.username,b.identity_card,b.vehiclenum,b.vehiclelen,b.vehicletype,b.tons,b.auditmark_identity,b.auditmark_driving,b.auditmark_vehicle,a.code_user 
                                    from IPORT.TB_SYS_USERINFO a, TB_SPH_USER_AUTH b  
                                    where a.code_user=b.code_user and b.roletype='1' and a.mobile='{0}' "
                                  , mobile);
                //验证此会员是否已认证
                var dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql);
                if (dt.Rows.Count == 0)
                {
                    info.Add("IsInfo", "No");
                    info.Add("Message", "用户未认证!");
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }



                info.Add("IsAuth", "Yes");
                info.Add("UserName", dt.Rows[0]["username"].ToString());
                info.Add("IdentityCard", TokenTool.HideIDCard(dt.Rows[0]["identity_card"].ToString()));
                info.Add("VehicleNum", dt.Rows[0]["vehiclenum"].ToString());
                info.Add("VehicleLen", dt.Rows[0]["vehiclelen"].ToString());
                info.Add("VehicleType", dt.Rows[0]["vehicletype"].ToString());
                info.Add("Tons", dt.Rows[0]["tons"].ToString());
                info.Add("AuditMarkIdentity", dt.Rows[0]["auditmark_identity"].ToString());
                info.Add("AuditMarkDriving", dt.Rows[0]["auditmark_driving"].ToString());
                info.Add("AuditMarkVehicle", dt.Rows[0]["auditmark_vehicle"].ToString());
                info.Add("CodeUser", dt.Rows[0]["code_user"].ToString());

                Json = JsonConvert.SerializeObject(info);
            }
            catch (Exception ex)
            {
                info.Add("IsInfo", "No");
                info.Add("Message", string.Format("{0}:获取数据发生异常。{1}", ex.Source, ex.Message));
                Json = JsonConvert.SerializeObject(info);
            }
        }
Esempio n. 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //ID
            var id = Request.Params["ID"];
            //始发地省,市,区县
            var SFDProvince = Request.Params["SFDProvince"];
            var SFDCity     = Request.Params["SFDCity"];
            var SFDCounty   = Request.Params["SFDCounty"];
            //目的地区省,市,区县
            var MDDProvince = Request.Params["MDDProvince"];
            var MDDCity     = Request.Params["MDDCity"];
            var MDDCounty   = Request.Params["MDDCounty"];
            //货物类型
            var goods = Request.Params["Goods"];
            //重量
            var weight = Request.Params["Weight"];
            //体积(方)
            var volume = Request.Params["Volume"];
            //车长
            var vehicleLen = Request.Params["VehicleLen"];
            //车型
            var vehicleType = Request.Params["VehicleType"];
            //手机
            var mobile = Request.Params["Mobile"];
            //电话
            var phone = Request.Params["Phone"];
            //联系人
            var contact = Request.Params["Contact"];
            //距离
            var distance = Request.Params["Distance"];

            Dictionary <string, string> info = new Dictionary <string, string>();

            try
            {
                if (id == null || SFDProvince == null || SFDCity == null || SFDCounty == null || MDDProvince == null || MDDCity == null || MDDCounty == null || goods == null || weight == null || volume == null || vehicleLen == null || vehicleType == null || mobile == null || phone == null)
                {
                    info.Add("参数ID,SFDProvince,SFDCity,SFDCounty,MDDProvince,MDDCity,MDDCounty,Goods,Weight,Volume,VehicleLen,VehicleType,Mobile,Phone,Contact,Distance不能为null!举例", "http://218.92.115.55/M_Sph/Goods/ModifyGoods.aspx?ID=1951A407932F9040E053A86401699040&SFDProvince=北京&SFDCity=&SFDCounty=&MDDProvince=江苏省&MDDCity=&MDDCounty=&Goods=煤炭&Weight=&Volume=&VehicleLen=&VehicleType=&Mobile=18000000000&Phone=&Contact=&Distance=");
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }
                //判断ID、始发省、目的省、货物类型、手机是否为空
                if (id == "" || SFDProvince == "" || MDDProvince == "" || goods == "" || mobile == "")
                {
                    info.Add("参数ID,SFDProvince,MDDProvince,Goods,Mobile必须填数据!举例", "ID=1951A407932F9040E053A86401699040&SFDProvince=北京&MDDProvince=江苏省&Goods=煤炭&Mobile=18000000000");
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }

                //手机号码验证
                string message = TokenTool.VerifyMobile(mobile);
                if (message != "ture")
                {
                    info.Add("IsReg", "No");
                    info.Add("Message", message);
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }

                //判断此货源是否存在
                string sql =
                    string.Format("select * from TB_DMT_CARGO where PKID='{0}'", id);
                var dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql);
                if (dt.Rows.Count == 0)
                {
                    info.Add("IsModify", "No");
                    info.Add("Message", "此货源不存在!");
                    Json = JsonConvert.SerializeObject(info);
                    return;
                }

                //更新货源
                sql =
                    string.Format(@"update TB_DMT_CARGO 
                                    set sfd_province='{0}',sfd_city='{1}',sfd_county='{2}',mdd_province='{3}',mdd_city='{4}',mdd_county='{5}',cargoname='{6}',weight='{7}',volume='{8}',vehicleLen='{9}',vehicleType='{10}',mobile='{11}',phone='{12}',opeartetime=to_date('{13}','YYYY-MM-DD HH24:MI:SS'),contact_man='{14}',diatance='{15}',style='{16}' where  pkid='{17}'"
                                  , SFDProvince, SFDCity, SFDCounty, MDDProvince, MDDCity, MDDCounty, goods, weight, volume, vehicleLen, vehicleType, mobile, phone, DateTime.Now, contact, distance, "1", id);
                dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql);

                info.Add("IsModify", "Yes");
                info.Add("Message", "发布成功!");
                Json = JsonConvert.SerializeObject(info);
            }
            catch (Exception ex)
            {
                info.Add("IsModify", "No");
                info.Add("Message", string.Format("{0}:获取数据发生异常。{1}", ex.Source, ex.Message));
                Json = JsonConvert.SerializeObject(info);
            }
        }
Esempio n. 12
0
        public Package <string> Register(string mobile, string password1, string password2, string appName)
        {
            try
            {
                //验证是否有权访问
                //if (!authHeader.ValideUser(authHeader.UserName, authHeader.PassWord))
                //{
                //    return new Package<string>(true, "没有访问权限!", null);
                //}

                //判断是否已注册
                string sql =
                    string.Format("select * from TB_SPH_USER  where account='{0}'", mobile);
                var dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql);
                if (dt.Rows.Count != 0)
                {
                    return(new Package <string>(false, "手机号已注册!", null));
                }

                //手机号码验证
                string message = TokenTool.VerifyMobile(mobile);
                if (message != "ture")
                {
                    return(new Package <string>(false, message, null));
                }

                //判断密码是的合理
                if (password1 != password2)
                {
                    return(new Package <string>(false, "密码不一致!", null));
                }

                //App使用截止时间
                string   timeType     = "MONTH";
                int      timeInterval = 3;
                DateTime endTime;
                switch (timeType)
                {
                case "DAY":
                    endTime = DateTime.Now.AddDays(timeInterval);
                    break;

                case "MONTH":
                    endTime = DateTime.Now.AddMonths(timeInterval);
                    break;

                case "YEAR":
                    endTime = DateTime.Now.AddYears(timeInterval);
                    break;

                default:
                    throw new Exception("错误的对象索引");
                }

                //注册
                sql =
                    string.Format(@"insert into TB_SPH_USER (account, password, endtime) 
                                    values ('{0}', '{1}',  to_date('{2}','YYYY-MM-DD HH24:MI:SS'))"
                                  , mobile, password1, endTime);
                dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql);
                //检查是否已插入
                sql =
                    string.Format(@"select * 
                                    from TB_SPH_USER 
                                    where account='{0}' and password='******' and endtime=to_date('{2}','YYYY-MM-DD HH24:MI:SS')"
                                  , mobile, password1, endTime);
                dt = new Leo.Oracle.DataAccess(Leo.RegistryKey.KeyPathWlxgx).ExecuteTable(sql);
                if (dt.Rows.Count == 0)
                {
                    return(new Package <string>(false, "网络错误,请稍后再试!", null));
                }
                else
                {
                    if (Convert.ToString(dt.Rows[0]["account"]) != mobile || Convert.ToString(dt.Rows[0]["password"]) != password1 || Convert.ToString(dt.Rows[0]["endtime"]) != endTime.ToString())
                    {
                        return(new Package <string>(false, "网络错误,请稍后再试!", null));
                    }
                    else
                    {
                        return(new Package <string>(true, "注册成功!", null));
                    }
                }
            }
            catch (Exception ex)
            {
                return(new Package <string>(false, string.Format("{0}:获取数据发生异常。{1}", ex.Source, ex.Message), null));
            }
        }