예제 #1
0
 public string Encrypt(string sValue, string type)
 {
     return(FormsAuthentication.HashPasswordForStoringInConfigFile(sValue, type));
 }
예제 #2
0
 public static string Sifrele(string str)
 {
     return(FormsAuthentication.HashPasswordForStoringInConfigFile(FormsAuthentication.HashPasswordForStoringInConfigFile(FormsAuthentication.HashPasswordForStoringInConfigFile(str + "-" + Class.Fonksiyonlar.Genel.ParametreAl("SistemAdres").ToString(), "sha1"), "md5"), "md5"));
 }
예제 #3
0
 private string criptografar(string texto)
 {
     return(FormsAuthentication.HashPasswordForStoringInConfigFile(texto, "md5"));
 }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //接收数据
                string serverUrl = Request.Form["serverUrl"];


                string merchantId    = Request.Form["merchantId"];
                string version       = Request.Form["version"];
                string language      = Request.Form["language"];
                string signType      = Request.Form["signType"];
                string payType       = Request.Form["payType"];
                string issuerId      = Request.Form["issuerId"];
                string mchtOrderId   = Request.Form["mchtOrderId"];
                string orderNo       = Request.Form["orderNo"];
                string orderDatetime = Request.Form["orderDatetime"];
                string orderAmount   = Request.Form["orderAmount"];
                string payDatetime   = Request.Form["payDatetime"];
                string payResult     = Request.Form["payResult"];
                string signMsg       = Request.Form["signMsg"];


                StringBuilder bufSignSrc = new StringBuilder();

                appendSignPara(bufSignSrc, "merchantId", merchantId);
                appendSignPara(bufSignSrc, "version", version);
                appendSignPara(bufSignSrc, "language", language);
                appendSignPara(bufSignSrc, "signType", signType);
                appendSignPara(bufSignSrc, "payType", payType);
                appendSignPara(bufSignSrc, "issuerId", issuerId);
                appendSignPara(bufSignSrc, "mchtOrderId", mchtOrderId);
                appendSignPara(bufSignSrc, "orderNo", orderNo);
                appendSignPara(bufSignSrc, "orderDatetime", orderDatetime);
                appendSignPara(bufSignSrc, "orderAmount", orderAmount);
                appendSignPara(bufSignSrc, "payDatetime", payDatetime);
                appendSignPara(bufSignSrc, "payResult", payResult);
                //appendSignPara(bufSignSrc, "signMsg", signMsg);
                appendLastSignPara(bufSignSrc, "key", "Z8589817qq");

                //appendLastSignPara(bufSignSrc, "key", key);

                string srcMsg     = bufSignSrc.ToString();
                string strsignMsg = FormsAuthentication.HashPasswordForStoringInConfigFile(srcMsg, "MD5");

                //签名原文
                //string content = billno + amount + mydate + succ + ipsbillno + currency_type;
                //签名是否正确
                Boolean verify = false;

                //验证方式:12-md5
                if (payResult == "1")
                {
                    ////Md5摘要(商户证书在商户后台可下载)
                    //string merchant_key = "MK3LaSgnNnb2qfZ6sDfP5wOZ3f6VsXm068Ieo3LNUps3qRfdMS2AMGLzW3rUwkUPaBVHwVrOSsUqeuJCa2j04BDQNsiLlQ1Ku23FWxGRBDI4L4vBKFUTb4vyXeUdM5Dc";
                    //string signature1 = FormsAuthentication.HashPasswordForStoringInConfigFile(content + merchant_key, "MD5").ToLower();
                    if (strsignMsg == signMsg)
                    {
                        verify = true;
                    }
                }

                //判断签名验证是否通过
                if (verify == true)
                {
                    //判断交易是否成功

                    if (!WE_Project.BLL.HKModel.tempList.Contains(orderNo))
                    {
                        WE_Project.BLL.HKModel.tempList.Add(orderNo);
                        try
                        {
                            if (WE_Project.BLL.Member.ManageMember.SHPayHB(orderNo))
                            {
                                Response.Write("success");
                                Response.End();
                            }
                            else
                            {
                                Response.Write("交易失败!");
                                Response.End();
                            }
                        }
                        finally
                        {
                            if (WE_Project.BLL.HKModel.tempList.Contains(orderNo))
                            {
                                WE_Project.BLL.HKModel.tempList.Remove(orderNo);
                            }
                        }
                    }
                    Response.Write("交易成功!");
                    Response.End();
                }
                else
                {
                    Response.Write("签名不正确!");
                }
            }
            catch (Exception ex)
            {
                WE_Project.BLL.Task.SendManage(WE_Project.BLL.Member.ManageMember.TModel, "", ex.Source);
            }
        }
예제 #5
0
 public static string MD5(string str)
 {
     return(FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToString());
 }
예제 #6
0
 /// <summary>
 /// 一个利用MD5加密字符串的方法
 /// </summary>
 /// <param name="Input">要加密的字符串</param>
 /// <returns>返回加密完的普通字符串</returns>
 public static string EncryptMD5(string M_Text)
 {
     return(FormsAuthentication.HashPasswordForStoringInConfigFile(M_Text, "MD5"));
 }
예제 #7
0
 public static string GetPwdMD5(string pwd)
 {
     return(FormsAuthentication.HashPasswordForStoringInConfigFile(pwd, "MD5"));
 }
예제 #8
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     if (this.IsValid)
     {
         string        strCnn = ConfigurationManager.ConnectionStrings["Student"].ConnectionString;
         SqlConnection cnn    = new SqlConnection(strCnn);
         SqlCommand    cmd    = new SqlCommand();
         cmd.Connection = cnn;
         string name     = tbUserName.Text.Trim();
         string password = tbPwd.Text.Trim();
         password        = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "md5");
         cmd.CommandText = "select * from UserInfo=@UserId and Password=@password";
         SqlParameter userIdparam = new SqlParameter();
         userIdparam.ParameterName = "@userId";
         userIdparam.SqlDbType     = SqlDbType.VarChar;
         userIdparam.Size          = 20;
         userIdparam.Direction     = ParameterDirection.Input;
         userIdparam.Value         = name;
         cmd.Parameters.Add(userIdparam);
         SqlParameter passwordparam = new SqlParameter();
         userIdparam.ParameterName = "@Password";
         userIdparam.SqlDbType     = SqlDbType.VarChar;
         userIdparam.Size          = 32;
         userIdparam.Direction     = ParameterDirection.Input;
         userIdparam.Value         = password;
         cmd.Parameters.Add(passwordparam);
         SqlDataReader UserReader = null;
         try
         {
             if (cnn.State == ConnectionState.Closed)
             {
                 cnn.Open();
             }
             UserReader = cmd.ExecuteReader();
             if (UserReader.Read())
             {
                 Session["UserId"] = name;
                 Response.Redirect("~/DataReaderDemo.aspx");
             }
             else
             {
                 Label1.Text = "用户名、密码不正确!";
             }
         }
         catch (Exception ex)
         {
             Response.Write("用户登录失败,错误原因:" + ex.Message);
         }
         finally
         {
             if (UserReader.IsClosed == false)
             {
                 UserReader.Close();
             }
             if (cnn.State == ConnectionState.Open)
             {
                 cnn.Close();
             }
         }
     }
 }
예제 #9
0
 /// <summary>
 /// MD5加密(32位小写)
 /// </summary>
 /// <param name="pass"></param>
 /// <returns></returns>
 public static string MD5Encrypt(string pass)
 {
     return(FormsAuthentication.HashPasswordForStoringInConfigFile(pass, "MD5").ToLower());
 }
예제 #10
0
        /// <summary>
        /// 快递鸟物流查看
        /// </summary>
        /// <param name="shipperCode">物流公司编码</param>
        /// <param name="logisticsCode">物流号</param>
        /// <returns></returns>
        private ExpressData GetExpressDataByKuai(string shipperCode, string logisticsCode)
        {
            var settting = ServiceProvider.Instance <ISiteSettingService> .Create.GetSiteSettings();

            //签名
            SortedDictionary <string, string> data = new SortedDictionary <string, string>();

            data.Add("app_key", settting.KuaidiApp_key);
            string timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            data.Add("logisticsCode", logisticsCode);
            data.Add("shipperCode", shipperCode);
            data.Add("timestamp", timestamp);

            string si   = string.Format("app_key{0}logisticsCode{1}shipperCode{2}timestamp{3}{4}", settting.KuaidiApp_key, logisticsCode, shipperCode, timestamp, settting.KuaidiAppSecret);
            string sign = FormsAuthentication.HashPasswordForStoringInConfigFile(si, "MD5");


            var            expressData = new ExpressData();                                                                                                                                                                                     //创建对象
            string         url         = string.Format("http://wuliu.kuaidiantong.cn/api/logistics?app_key={0}&timestamp={1}&shipperCode={2}&logisticsCode={3}&sign={4}", settting.KuaidiApp_key, timestamp, shipperCode, logisticsCode, sign); //快递查询地址
            HttpWebRequest request     = (HttpWebRequest)HttpWebRequest.Create(url);

            request.Timeout     = 8000;
            request.Method      = "GET";
            request.ContentType = "application/json;charset=UTF-8";
            request.UserAgent   = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36";
            CookieContainer cookie = new CookieContainer();

            request.CookieContainer = cookie;
            try
            {
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    Stream stream = response.GetResponseStream();
                    System.IO.StreamReader streamReader = new StreamReader(stream, System.Text.Encoding.GetEncoding("UTF-8"));
                    StringBuilder          content      = new StringBuilder(streamReader.ReadToEnd()); // 读取流字符串内容
                    content.Replace("&amp;", "").Replace("&nbsp;", "").Replace("&", "");               //去除不需要的字符

                    var test = new
                    {
                        shipperCode   = "",
                        logisticsCode = "",
                        success       = true,
                        state         = "",
                        traces        = new[]
                        {
                            new{
                                acceptTime    = "",
                                acceptStation = "",
                                remark        = ""
                            }
                        }
                    };
                    var m = Newtonsoft.Json.JsonConvert.DeserializeAnonymousType(content.ToString(), test);

                    var dataItems = new List <ExpressDataItem>();
                    if (m.success == true)
                    {
                        expressData.Success = true;
                        expressData.Message = "成功";
                        foreach (var t in m.traces)
                        {
                            dataItems.Add(new ExpressDataItem()
                            {
                                Time    = DateTime.Parse(t.acceptTime),
                                Content = t.acceptStation
                            });
                        }
                    }
                    else
                    {
                        expressData.Success = false;
                        expressData.Message = "暂无物流信息";
                    }
                    expressData.ExpressDataItems = dataItems;
                    return(expressData);
                }
                else
                {
                    //  expressData.Message = "网络错误";
                    expressData.Message = "网络错误";
                }
            }
            catch (Exception ex)
            {
                Core.Log.Error(string.Format("快递查询错误:{{kuaidi100Code:{0},shipOrderNumber:{1}}}", shipperCode, logisticsCode), ex);
                //  expressData.Message = "未知错误";
                expressData.Message = "暂无物流信息";
            }
            return(expressData);
        }
예제 #11
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            string validCode = Session["CheckCode"].ToString();

            if (txtValidCode.Text != validCode)
            {
                Response.Write("<script type='text/javascript'>alert('验证码输入错误');</script>");
                return;
            }

            string userName = txtUserName.Text;
            string password = txtPassword.Text;
            string email    = txtEmail.Text;

            SqlConnection sqlconn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["connStr"].ConnectionString);

            sqlconn.Open();
            // FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5")
            string     sqlText = string.Format("INSERT INTO tb_User(UserName,Password,Email)VALUES('{0}','{1}','{2}')", userName, FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5"), email);
            SqlCommand sqlcmd  = new SqlCommand(sqlText, sqlconn);
            int        result  = sqlcmd.ExecuteNonQuery();

            if (result > 0)
            {
                Response.Write("<script type='text/javascript'>alert('注册成功!');</script>");
            }
            sqlconn.Close();
            Response.Redirect("Default.aspx");
        }
예제 #12
0
 /// <summary>
 /// Concatenates the salt and password before returning the encypted value.
 /// </summary>
 /// <param name="Password">Password to get from..</param>
 /// <param name="Salt">Salt to get from.</param>
 /// <returns></returns>
 protected static string GetPassword(string Password, string Salt)
 {
     return(FormsAuthentication.HashPasswordForStoringInConfigFile(String.Concat(Password, Salt), "SHA1"));
 }
 public static string CriptografaSHA1(string str)
 {
     return FormsAuthentication.HashPasswordForStoringInConfigFile(str, "sha1");
 }
예제 #14
0
파일: Utility.cs 프로젝트: casualbill/DCSMS
 //加密密码 (MD5 Hash32位截取16)
 protected String getMD5HashCode(String sourceStr)
 {
     return(FormsAuthentication.HashPasswordForStoringInConfigFile(sourceStr, "MD5").ToLower().Substring(4, 16));
 }
예제 #15
0
        protected void OpenAccount_Click(object sender, EventArgs e)
        {
            CustomerServiceSettings masterSettings = CustomerServiceManager.GetMasterSettings(false);

            if (string.IsNullOrEmpty(this.txt_phone.Text))
            {
                this.ShowMsg("请输入手机号码!", false);
            }
            if (string.IsNullOrEmpty(this.txt_pwd.Text))
            {
                this.ShowMsg("请输入密码!", false);
            }
            string tokenValue = TokenApi.GetTokenValue(masterSettings.AppId, masterSettings.AppSecret);

            if (!string.IsNullOrEmpty(tokenValue))
            {
                SiteSettings settings2 = SettingsManager.GetMasterSettings(false, wid);
                string       str2      = string.Empty;
                if (!string.IsNullOrEmpty(settings2.DistributorLogoPic))
                {
                    str2 = Globals.DomainName + settings2.DistributorLogoPic;
                }
                string str3 = FormsAuthentication.HashPasswordForStoringInConfigFile(this.txt_pwd.Text, "MD5").ToLower();
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("unit", this.txt_phone.Text);
                parameters.Add("password", str3);
                parameters.Add("unitname", settings2.SiteName);
                parameters.Add("activated", "1");
                parameters.Add("logo", str2);
                parameters.Add("url", "");
                parameters.Add("tel", settings2.ShopTel);
                parameters.Add("contact", "");
                parameters.Add("location", "");
                string str4 = EnterpriseApi.CreateEnterprise(tokenValue, parameters);
                if (!string.IsNullOrWhiteSpace(str4))
                {
                    string jsonValue = Common.GetJsonValue(str4, "errcode");
                    string str6      = Common.GetJsonValue(str4, "errmsg");
                    if (jsonValue == "0")
                    {
                        string unitId = EnterpriseApi.GetUnitId(tokenValue, this.txt_phone.Text);
                        if (!string.IsNullOrEmpty(unitId))
                        {
                            masterSettings.unitid   = unitId;
                            masterSettings.unit     = this.txt_phone.Text;
                            masterSettings.password = this.txt_pwd.Text;
                            CustomerServiceManager.Save(masterSettings);
                            this.ShowMsg("开通主账号成功!", true);
                        }
                        else
                        {
                            this.ShowMsg("获取主账号Id失败!", false);
                        }
                    }
                    else
                    {
                        this.ShowMsg("开通主账号失败!(" + str6 + ")", false);
                    }
                }
                else
                {
                    this.ShowMsg("开通主账号失败!", false);
                }
                this.enable = settings2.EnableSaleService;
            }
            else
            {
                this.ShowMsg("获取access_token失败!", false);
            }
        }
예제 #16
0
    public string CreatePasswordHash(string dist)
    {
        string hashedPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(dist.ToString().Trim(), "MD5");

        return(hashedPwd);
    }
예제 #17
0
 public string PasswordEncrytion(string pass)
 {
     return(FormsAuthentication.HashPasswordForStoringInConfigFile(pass.Trim(), "MD5"));
 }
예제 #18
0
        ///   <summary>
        ///   给一个字符串进行MD5加密
        ///   </summary>
        ///   <param   name="strText">待加密字符串</param>
        ///   <returns>加密后的字符串</returns>
        public static string encrypt(string strText)
        {
            string md5EncryptStr = FormsAuthentication.HashPasswordForStoringInConfigFile(strText, "MD5").ToLower();

            return(md5EncryptStr);
        }
예제 #19
0
    /// <summary>
    /// 在线支付
    /// </summary>
    /// <param name="orderid">订单号</param>
    /// <param name="callBackurl">返回地址</param>
    private void Eka365pay(String orderid, String callBackurl)
    {
        //商户信息
        String shop_id = ConfigurationManager.AppSettings["ekaid"];  //商户ID
        String key     = ConfigurationManager.AppSettings["ekakey"]; //商户密钥


        //组织接口发送。
        if (String.IsNullOrEmpty(Request.Form["card"]))
        {
            //银行提交获取信息
            String bank_Type        = Request.Form["rtype"];       //银行类型
            String bank_gameAccount = Request.Form["txtUserName"]; //充值账号
            String bank_payMoney    = Request.Form["PayMoney"];    //充值金额
            //银行卡支付
            String param   = String.Format("parter={0}&type={1}&value={2}&orderid={3}&callbackurl={4}", shop_id, bank_Type, bank_payMoney, orderid, callBackurl);
            String PostUrl = String.Format("http://pay.gwwub.com/paybank.aspx?{0}&sign={1}", param, FormsAuthentication.HashPasswordForStoringInConfigFile(param + key, "MD5").ToLower());
            Response.Redirect(PostUrl);//转发URL地址
        }
        else
        {
            //获取卡类提交信息
            String card_No       = Request.Form["cardNo"];                 //卡号
            String card_pwd      = Request.Form["cardPwd"];                //卡密
            String card_account  = Request.Form["txtUserNameCard"];        //充值账号
            String card_type     = Request.Form["sel_card"].Split(',')[0]; //卡类型
            String card_payMoney = Request.Form["sel_price"];              //充值金额
            String restrict      = "0";                                    //使用范围
            String attach        = "test";                                 //附加内容,下行原样返回
            if (Request.Form["sel_card"].Split(',').Length > 1)
            {
                restrict = Request.Form["sel_card"].Split(',')[1];
            }
            //卡类支付
            String param   = String.Format("type={0}&parter={1}&cardno={2}&cardpwd={3}&value={4}&restrict={5}&orderid={6}&callbackurl={7}", card_type, shop_id, card_No, card_pwd, card_payMoney, restrict, orderid, callBackurl);
            String PostUrl = String.Format("http://vip.gwwub.com/payHQ.aspx?{0}&attach={1}&sign={2}", param, attach, FormsAuthentication.HashPasswordForStoringInConfigFile(param + key, "MD5").ToLower());

            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(PostUrl);
            //获取响应结果 此过程大概需要5秒
            HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            //获取响应流
            Stream stream = httpWebResponse.GetResponseStream();
            //用指定的字符编码为指定的流初始化 StreamReader 类的一个新实例。
            using (StreamReader streamReader = new StreamReader(stream, Encoding.UTF8))
            {
                string useResult = streamReader.ReadToEnd();

                streamReader.Dispose();
                streamReader.Close();
                httpWebResponse.Close();

                if (useResult.Trim() == "opstate=0")
                {
                    //同步返回opstate=0不表示充值成功,他只是表示点卡符合要求并提交成功了,一定异步返回opstate=0才表示充值成功
                    Response.Write("提交成功,请稍后查看下充值情况.");
                }
                if (useResult.Trim() == "opstate=-1")
                {
                    Response.Write("提交参数错误.");
                }
                if (useResult.Trim() == "opstate=-2")
                {
                    Response.Write("签名错误。");
                }
                if (useResult.Trim() == "opstate=-3")
                {
                    Response.Write("卡密为重复提交");
                }
                if (useResult.Trim() == "opstate=-4")
                {
                    Response.Write("卡密不符合定义的卡号密码面值规则");
                }
                if (useResult.Trim() == "opstate=-999")
                {
                    Response.Write("接口在维护.");
                }
                if (useResult.Trim() == "opstate=2")
                {
                    Response.Write("不支持该类卡或者该面值的卡");
                }
                if (useResult.Trim() == "opstate=3")
                {
                    Response.Write("验证签名失败");
                }
                if (useResult.Trim() == "opstate=4")
                {
                    Response.Write("订单内容重复");
                }
                if (useResult.Trim() == "opstate=5")
                {
                    Response.Write("该卡密已经有被使用的记录");
                }
                if (useResult.Trim() == "opstate=6")
                {
                    Response.Write("订单号已经存在");
                }
                if (useResult.Trim() == "opstate=7")
                {
                    Response.Write("数据非法");
                }
                if (useResult.Trim() == "opstate=8")
                {
                    Response.Write("非法用户");
                }
                if (useResult.Trim() == "opstate=9")
                {
                    Response.Write("暂时停止该类卡或者该面值的卡交易");
                }
                if (useResult.Trim() == "opstate=10")
                {
                    Response.Write("充值卡无效");
                }
                if (useResult.Trim() == "opstate=11")
                {
                    Response.Write("支付成功,实际面值与订单金额不符");
                }
                if (useResult.Trim() == "opstate=12")
                {
                    Response.Write("处理失败,卡密未使用");
                }
                if (useResult.Trim() == "opstate=13")
                {
                    Response.Write("系统繁忙");
                }
                if (useResult.Trim() == "opstate=14")
                {
                    Response.Write("不存在该笔订单");
                }
                if (useResult.Trim() == "opstate=15")
                {
                    Response.Write("未知请求");
                }
                if (useResult.Trim() == "opstate=16")
                {
                    Response.Write("密码错误");
                }
                if (useResult.Trim() == "opstate=17")
                {
                    Response.Write("匹配订单失败");
                }
                if (useResult.Trim() == "opstate=18")
                {
                    Response.Write("余额不足");
                }
                if (useResult.Trim() == "opstate=19")
                {
                    Response.Write("运营商维护");
                }
                if (useResult.Trim() == "opstate=20")
                {
                    Response.Write("提交次数过多");
                }
                if (useResult.Trim() == "opstate=99")
                {
                    Response.Write("充值失败,请重试");
                }
                if (useResult.Trim() == "opstate=333")
                {
                    Response.Write("提交失败,原因未知");
                }
            }
        }
    }
예제 #20
0
 public static string ToMD5(this string s)
 {
     return(FormsAuthentication.HashPasswordForStoringInConfigFile(s, "MD5"));
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //Setting UserID

            HF_UaerID.Value = Crypto.DeCrypto(Request.QueryString["key"]);

            if (HF_UaerID.Value == null)
            {
                Response.Redirect("../Extras/ErrorReport.aspx?id=WrongKey");
            }


            //Getting Connection String

            //Connect To database

            //load all the DDLs

            //Loading IndexMotherTongue

            DDL_MotherTongue.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.MotherTongue);
            DDL_MotherTongue.DataTextField  = "Item";
            DDL_MotherTongue.DataValueField = "Value";
            DDL_MotherTongue.DataBind();

            // Loading Religion

            DDL_Religion.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Religion);
            DDL_Religion.DataTextField  = "Item";
            DDL_Religion.DataValueField = "Value";
            DDL_Religion.DataBind();


            // Loading Cast
            DDL_Cast.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Cast);
            DDL_Cast.DataTextField  = "Item";
            DDL_Cast.DataValueField = "Value";
            DDL_Cast.DataBind();


            // Loading Profile Created by
            DDL_ProfieCreated.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.ProfileCreatedBy);
            DDL_ProfieCreated.DataTextField  = "Item";
            DDL_ProfieCreated.DataValueField = "Value";
            DDL_ProfieCreated.DataBind();


            // Loading Reference by

            DDL_Reference.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.ReferenceBy);
            DDL_Reference.DataTextField  = "Item";
            DDL_Reference.DataValueField = "Value";
            DDL_Reference.DataBind();


            // Loading Star

            DDL_Star.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Star);
            DDL_Star.DataTextField  = "Item";
            DDL_Star.DataValueField = "Value";
            DDL_Star.DataBind();


            // Loading MoonSign

            DDL_Moon.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.MoonSign);
            DDL_Moon.DataTextField  = "Item";
            DDL_Moon.DataValueField = "Value";
            DDL_Moon.DataBind();

            DDL_SEqt.DataSource     = ControlDataLoader.DataForLoadingControls(ControlDataLoader.ControlType.Sequrity);
            DDL_SEqt.DataTextField  = "SequrityQuestion";
            DDL_SEqt.DataValueField = "Value";
            DDL_SEqt.DataBind();


            int intThisYear = DateTime.Now.Year - 18;
            for (int i = 0; i <= 32; ++i)
            {
                DDL_dobYear.Items.Add((intThisYear - i).ToString());
            }
        }
        else
        {
            if (CB_Accept.Checked)
            {
                //save details into data base

                sbyte sbyteFlag = 0;

                //Inserting AccountInformations
                strApplicationID = MatrimonialMemberShip.InsertAccountInfo(HF_UaerID.Value,
                                                                           FormsAuthentication.HashPasswordForStoringInConfigFile(TB_Password.Text, "MD5"), (sbyte)DDL_SEqt.SelectedIndex, TB_Answer.Text);
                //If Inserted
                Response.Write(strApplicationID);
                if (strApplicationID != null)
                {
                    // Basic member Informations
                    DateTime dtDOB;
                    sbyte    sbyteMaritalStatus = 0;
                    string   strPhysicalStatus;
                    string   strChildrenLivingStatus;


                    // Setting Date of birth
                    dtDOB = DateTime.Parse(DDL_dobMonth.SelectedIndex + " " + DDL_dobYear.SelectedIndex + "," + DDL_dobDay.SelectedIndex);


                    // Setting   MaritalStatus
                    if (RB_MS_UM.Checked)
                    {
                        sbyteMaritalStatus = 1;
                    }
                    else if (RB_MS_Div.Checked)
                    {
                        sbyteMaritalStatus = 2;
                    }
                    else if (RB_MS_Sep.Checked)
                    {
                        sbyteMaritalStatus = 3;
                    }
                    else if (RB_MS_WW.Checked)
                    {
                        sbyteMaritalStatus = 4;
                    }

                    //Setting NoOfChildren

                    if (RB_phy_nor.Checked)
                    {
                        strPhysicalStatus = true.ToString();
                    }
                    else if (RB_phy_Dis.Checked)
                    {
                        strPhysicalStatus = false.ToString();
                    }
                    else
                    {
                        strPhysicalStatus = null;
                    }

                    // setting Children Living With

                    if (RB_CH_LWM.Checked)
                    {
                        strChildrenLivingStatus = true.ToString();
                    }
                    else if (RB_CH_NWM.Checked)
                    {
                        strChildrenLivingStatus = false.ToString();
                    }
                    else
                    {
                        strChildrenLivingStatus = null;
                    }

                    //Inserting Basic Informations
                    sbyteFlag = MatrimonialProfileManager.InsertBasicInfo(strApplicationID,
                                                                          TB_Name.Text, RB_Male.Checked, dtDOB,
                                                                          (sbyte)DDL_MotherTongue.SelectedIndex,
                                                                          (sbyte)DDL_ProfieCreated.SelectedIndex,
                                                                          (sbyte)DDL_Cast.SelectedIndex, sbyteMaritalStatus,
                                                                          (sbyte)DDL_Religion.SelectedIndex,
                                                                          (sbyte)DDL_NoOfChildren.SelectedIndex,
                                                                          strPhysicalStatus, strChildrenLivingStatus,
                                                                          TB_SubCast.Text);

                    // SociaReligious member Informations

                    sbyte  sbyteHoroscopeMatch = 0;
                    string strTimeOfBirth      = null;
                    sbyte  sbyteManglik        = 0;

                    if (RB_Horoscope_NO.Checked)
                    {
                        sbyteHoroscopeMatch = 1;
                    }
                    else if (RB_Horoscope_Yes.Checked)
                    {
                        sbyteHoroscopeMatch = 2;
                    }
                    else if (RB_Horoscope_NoMatters.Checked)
                    {
                        sbyteHoroscopeMatch = 3;
                    }


                    if (RB_Manglik_No.Checked)
                    {
                        sbyteManglik = 1;
                    }
                    else if (RB_Manglik_Yes.Checked)
                    {
                        sbyteManglik = 2;
                    }
                    else if (RB_Manglik_DKnow.Checked)
                    {
                        sbyteManglik = 3;
                    }
                    else if (RB_Manglik_NA.Checked)
                    {
                        sbyteManglik = 4;
                    }

                    if ((TB_Time_H.Text != null) && (TB_Time_M.Text != null))
                    {
                        strTimeOfBirth = TB_Time_H.Text + ":" + TB_Time_M.Text + " " + DDL_Time.SelectedValue;
                    }

                    //Inserting SociaReligious Informations
                    sbyteFlag += MatrimonialProfileManager.InsertSocioReligiousInfo(strApplicationID, (sbyte)DDL_Star.SelectedIndex,
                                                                                    (sbyte)DDL_Moon.SelectedIndex, sbyteHoroscopeMatch, TB_POB.Text, strTimeOfBirth, sbyteManglik);

                    sbyteFlag += MatrimonialMessanger.SetMailingSettings(HF_UaerID.Value);
                }
                else
                {
                    Response.Redirect("../Extras/ErrorReport.aspx");
                }

                if (sbyteFlag == 3)
                {
                    MatrimonialMemberShip.UpdateIndex(strApplicationID);
                    HttpCookie objHttpCookie = new HttpCookie("MatRegInfo");
                    objHttpCookie.Values["ApplicationID"] = Crypto.EnCrypto(strApplicationID);
                    objHttpCookie.Expires = DateTime.MaxValue; //<<<<<<<<<<<<<< ForTesting >>>>>>>>>>>
                    Response.Cookies.Add(objHttpCookie);

                    Server.Transfer("RegistrationStep2.aspx");
                }
                else
                {
                    Response.Write(strApplicationID);
                    //Response.Redirect("../Extras/ErrorReport.aspx");<< ForTesting >>
                }
            }
            else
            {
                LabelDisplay.Visible = true;
                LabelDisplay.Text    = "You Need to accept terms and conditions";
            }
        }
    }
예제 #22
0
파일: LoginHelper.cs 프로젝트: radtek/Shop
        /// <summary>
        /// 为物流速递用户创建登录Session
        /// </summary>
        private static void CreateSFExpressUserSession()
        {
            // 物流速递传递过来的参数不为空
            if (System.Web.HttpContext.Current.Request["unionid"] != null &&
                System.Web.HttpContext.Current.Request["tokenId"] != null &&
                System.Web.HttpContext.Current.Request["sourcetype"] != null)
            {
                if (System.Web.HttpContext.Current.Session == null ||
                    System.Web.HttpContext.Current.Session[ConstClass.SessionKeyMLoginUser] == null)
                {
                    // 传递参数
                    string UnionId  = System.Web.HttpContext.Current.Request["unionid"].ToString();
                    string SFId     = System.Web.HttpContext.Current.Request["sfid"] != null ? System.Web.HttpContext.Current.Request["sfid"].ToString() : string.Empty;
                    string TokenId  = System.Web.HttpContext.Current.Request["tokenId"].ToString();
                    string Password = TokenId;

                    // 获取SourceType值
                    int SourceType = GetSourceType(System.Web.HttpContext.Current.Request["sourcetype"].ToString());
                    if (SourceType == -1)
                    {
                        return;
                    }

                    // 参数MD5与TokenId比较
                    StringBuilder strBuilder = new StringBuilder();
                    strBuilder.Append(UnionId).Append(SourceType).Append(SFExpressKey);
                    string MD5Encoding = FormsAuthentication.HashPasswordForStoringInConfigFile(strBuilder.ToString(), "MD5");
                    //if (!MD5Encoding.Equals(TokenId))
                    //{
                    //    System.Web.HttpContext.Current.Session[ConstClass.SessionKeyMLoginUser] = null;
                    //    System.Web.HttpContext.Current.Session.Clear();
                    //    return;
                    //}

                    CustomerEntity CustomerEntity = new CustomerEntity();
                    CustomerEntity.Password   = Password;
                    CustomerEntity.SourceType = SourceType;
                    CustomerEntity.SFId       = SFId;
                    CustomerEntity.UnionId    = UnionId;

                    // 获取用户信息是否为空
                    bool IsNullFlag = accountBll.GetUserInfoIsNull(UnionId);

                    int            ReturnUserId         = 1;
                    CustomerEntity ReturnCustomerEntity = null;

                    // 用户信息为空
                    if (IsNullFlag)
                    {
                        // 插入用户信息
                        ReturnCustomerEntity = accountBll.CreateSFExpressUser(CustomerEntity);
                    }
                    else
                    {
                        // 获取用户信息
                        ReturnCustomerEntity = accountBll.GetSFExpressUser(UnionId);
                    }

                    if (ReturnCustomerEntity != null)
                    {
                        ReturnUserId            = ReturnCustomerEntity.ID;
                        CustomerEntity.ID       = ReturnCustomerEntity.ID;
                        CustomerEntity.UserName = ReturnCustomerEntity.UserName;
                        CustomerEntity.Status   = ReturnCustomerEntity.Status;
                    }
                    else
                    {
                        ReturnUserId = 0;
                    }

                    // 给用户登录状态
                    if (ReturnUserId > 0)
                    {
                        //Session记录登录状态
                        LoginHelper.SetLoginUserSession(CustomerEntity.AsLoginUserModel());
                    }
                }
            }
        }
예제 #23
0
    // Admin Login
    //protected void ValidateCaptcha(object sender, ServerValidateEventArgs e)
    //{
    //    Captcha1.ValidateCaptcha(txt_Captcha.Text.Trim());
    //    e.IsValid = Captcha1.UserValidated;
    //    if (e.IsValid)
    //    {
    //        captcha = e.IsValid.ToString();
    //    }
    //}
    protected void btn_AdminLogin_Click(object sender, EventArgs e)
    {
        try
        {
            if (txt_UserID.Text != "" && txt_Password.Text != "")
            {
                if (Session["captcha"].ToString() == txt_Captcha.Text)
                {
                    if (SqInjection.checkForSQLInjection(txt_UserID.Text.Trim()))
                    {
                        return;
                    }
                    else
                    {
                        name            = Encrypt(txt_UserID.Text.Trim());
                        objPRReq.UserID = HttpUtility.UrlEncode(txt_UserID.Text.Trim());
                        objPRReq.SGNO   = txt_UserID.Text.Trim();
                    }
                    if (SqInjection.checkForSQLInjection(txt_UserID.Text.Trim()))
                    {
                        Response.Redirect(string.Format("~/Error.aspx"), false);
                    }
                    else
                    {
                        objPRReq.Email = txt_UserID.Text.Trim();
                    }
                    if (SqInjection.checkForSQLInjection(txt_Password.Text.Trim()))
                    {
                        Response.Redirect(string.Format("~/Error.aspx"), false);
                    }
                    else
                    {
                        objPRReq.Password = HttpUtility.UrlEncode(txt_Password.Text.Trim());
                    }
                    objPRReq.Status = "Active";
                    PRResp    r  = objPRIBC.AdminLogin(objPRReq);
                    DataTable dt = r.GetTable;
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            string myval    = FormsAuthentication.HashPasswordForStoringInConfigFile(ViewState["KeyGenerator"].ToString(), "SHA1");
                            string password = dr["Password"].ToString();
                            string value    = FormsAuthentication.HashPasswordForStoringInConfigFile(password.ToLower() + myval.ToLower(), "SHA1");

                            //Application Admin

                            if (dr["Status"].ToString() == "Active" && dr["Role"].ToString() == "0" && txtPwdHash.Value == value.ToLower())
                            {
                                Session["UserID"] = dr["UID"];
                                Response.Redirect(string.Format("Admin/{0}?st={0}", name), false);
                            }
                            else
                            // DG
                            if (dr["Status"].ToString() == "Active" && dr["Role"].ToString() == "1" && txtPwdHash.Value == value.ToLower())
                            {
                                Session["UserID"] = dr["UID"];
                                Response.Redirect(string.Format("~/DG/DGHome.aspx?st={0}", name), false);
                            }
                            else
                            //Project Staff Payroll
                            if (dr["Status"].ToString() == "Active" && dr["Role"].ToString() == "10" && txtPwdHash.Value == value.ToLower())
                            {
                                Session["UserID"] = dr["UID"];
                                Response.Redirect(string.Format("~/PSPayrolls/PSHome.aspx?st={0}", name), false);
                            }
                            else
                            // Payroll Users
                            if (dr["Status"].ToString() == "Active" && dr["Role"].ToString() == "2" && txtPwdHash.Value == value.ToLower())
                            {
                                Session["UserID"] = dr["UID"];
                                Response.Redirect(string.Format("~/ACCPayrolls/PayrollHome.aspx?st={0}", name), false);
                            }
                            else
                            // Vehicle Admin
                            if (dr["Status"].ToString() == "Active" && dr["Role"].ToString() == "3" && txtPwdHash.Value == value.ToLower())
                            {
                                Session["UserID"] = dr["UID"];
                                Response.Redirect(string.Format("~/Vehicle/VehicleHome.aspx?st={0}", name), false);
                            }

                            else
                            //E Admin
                            if (dr["Status"].ToString() == "Active" && dr["Role"].ToString() == "4" && txtPwdHash.Value == value.ToLower())
                            {
                                Session["UserID"] = dr["UID"];
                                Response.Redirect(string.Format("~/EAdmin/eAdmnHome.aspx?st={0}", name), false);
                            }
                            else
                            // Security

                            if (dr["Status"].ToString() == "Active" && dr["Role"].ToString() == "5" && txtPwdHash.Value == value.ToLower())
                            {
                                Session["UserID"] = dr["UID"];
                                Response.Redirect(string.Format("~/SecurityOfficer/SOHome.aspx?st={0}", name), false);
                            }
                            else
                            // ART
                            if (dr["Status"].ToString() == "Active" && dr["Role"].ToString() == "6" && txtPwdHash.Value == value.ToLower())
                            {
                                Session["UserID"] = dr["UID"];
                                Response.Redirect(string.Format("~/AR_T/ARTHome.aspx?st={0}", name), false);
                            }
                            else //ARE
                            if (dr["Status"].ToString() == "Active" && dr["Role"].ToString() == "7" && txtPwdHash.Value == value.ToLower())
                            {
                                Session["UserID"] = dr["UID"];
                                Response.Redirect(string.Format("~/AR_E/AREHome.aspx?st={0}", name), false);
                            }
                            else //GuestHouse
                            if (dr["Status"].ToString() == "Active" && dr["Role"].ToString() == "8" && txtPwdHash.Value == value.ToLower())
                            {
                                Session["UserID"] = dr["UID"];
                                Response.Redirect(string.Format("~/GuestHouse/GHHome.aspx?st={0}", name), false);
                            }
                            else // CIT Inventory
                            if (dr["Status"].ToString() == "Active" && dr["Role"].ToString() == "9" && txtPwdHash.Value == value.ToLower())
                            {
                                Session["UserID"] = dr["UID"];
                                Response.Redirect(string.Format("~/CICTInventory/InventoryHome.aspx?st={0}", name), false);
                            }
                            else // CIT Inventory
                            if (dr["Status"].ToString() == "Active" && dr["Role"].ToString() == "11" && txtPwdHash.Value == value.ToLower())
                            {
                                Session["UserID"] = dr["UID"];
                                Response.Redirect(string.Format("~/eLeave/eLeaveAdminHome.aspx?st={0}", name), false);
                            }
                            else // Finance
                            if (dr["Status"].ToString() == "Active" && dr["Role"].ToString() == "12" && txtPwdHash.Value == value.ToLower())
                            {
                                Session["UserID"] = dr["UID"];
                                Response.Redirect(string.Format("~/Finance/FinanceHome.aspx?st={0}", name), false);
                            }
                            else // CMU Ticketing
                            if (dr["Status"].ToString() == "Active" && dr["Role"].ToString() == "14" && txtPwdHash.Value == value.ToLower())
                            {
                                Session["UserID"] = dr["UID"];
                                Response.Redirect(string.Format("~/CMU_Ticketing/CMUTicketingHome.aspx?st={0}", name), false);
                            }
                            else
                            {
                                string msg = " Invalid User Login Credintials";
                                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Alert...!!!", "alert('" + msg + "');", true);
                            }
                        }
                    }
                    else
                    {
                        objPRReq.Status = "Active";
                        PRResp    ru  = objPRIBC.StoreUserLogin(objPRReq);
                        DataTable dtu = ru.GetTable;
                        if (dtu.Rows.Count > 0)
                        {
                            foreach (DataRow dru in dtu.Rows)
                            {
                                string myval    = FormsAuthentication.HashPasswordForStoringInConfigFile(ViewState["KeyGenerator"].ToString(), "SHA1");
                                string password = dru["Password"].ToString();
                                string value    = FormsAuthentication.HashPasswordForStoringInConfigFile(password.ToLower() + myval.ToLower(), "SHA1");

                                if (dru["Status"].ToString() == "Active" && dru["Role"].ToString() == "10" && txtPwdHash.Value == value.ToLower())
                                {
                                    Session["UserID"] = dru["SUID"];
                                    Response.Redirect(string.Format("~/NIRDStores/StoreUser/StoreUserHome.aspx?st={0}", name), false);
                                }
                                else
                                {
                                    string msg = "Invalid User Login Credientials";
                                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Alert...!!!", "alert('" + msg + "');", true);
                                }
                            }
                        }
                        else
                        {
                            objPRReq.Status = "Active";
                            if (Microsoft.VisualBasic.Information.IsNumeric(txt_UserID.Text))
                            {
                                objPRReq.EmpID = int.Parse(txt_UserID.Text.Trim());
                            }
                            PRResp    remp  = objPRIBC.EmpLogin(objPRReq);
                            DataTable dtemp = remp.GetTable;
                            if (dtemp.Rows.Count > 0)
                            {
                                foreach (DataRow dremp in dtemp.Rows)
                                {
                                    string myval    = FormsAuthentication.HashPasswordForStoringInConfigFile(ViewState["KeyGenerator"].ToString(), "SHA1");
                                    string password = dremp["Password"].ToString();
                                    string value    = FormsAuthentication.HashPasswordForStoringInConfigFile(password.ToLower() + myval.ToLower(), "SHA1");
                                    if (dremp["Status"].ToString() == "Active" && dremp["Role"].ToString() == "5" && txtPwdHash.Value == value.ToLower())
                                    {
                                        Session["UserID"] = dremp["EmpID"];
                                        Response.Redirect(string.Format("~/HOC/HOC_MainHome.aspx?st={0}", name), false);
                                    }
                                    //else
                                    //    if (dremp["Status"].ToString() == "Active" && dremp["Role"].ToString() == "5" && txtPwdHash.Value == value.ToLower())
                                    //    {
                                    //        Session["UserID"] = dremp["EmpID"];
                                    //        Response.Redirect(string.Format("~/Emp/Circulars.aspx?st={0}", name), false);
                                    //    }
                                    else
                                    {
                                        string msg = "Invalid User Login Credientials";
                                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Alert...!!!", "alert('" + msg + "');", true);
                                    }
                                }
                            }
                            else
                            {
                                PRResp    rps = objPRIBC.ProjStaffLogin(objPRReq);
                                DataTable dps = rps.GetTable;
                                if (dps.Rows.Count > 0)
                                {
                                    foreach (DataRow drps in dps.Rows)
                                    {
                                        string myval    = FormsAuthentication.HashPasswordForStoringInConfigFile(ViewState["KeyGenerator"].ToString(), "SHA1");
                                        string password = drps["Password"].ToString();
                                        string value    = FormsAuthentication.HashPasswordForStoringInConfigFile(password.ToLower() + myval.ToLower(), "SHA1");
                                        if (drps["Status"].ToString() == "Active" && drps["Role"].ToString() == "12" && txtPwdHash.Value == value.ToLower().Trim() && (drps["Flag1"].ToString() != "1" || drps["Flag1"].ToString() == ""))
                                        {
                                            Session["UserID"] = drps["EmpID"];
                                            Response.Redirect(string.Format("~/ProjectStaff/PSHome.aspx?st={0}", name), false);
                                        }
                                        else if (drps["Status"].ToString() == "Active" && drps["Role"].ToString() == "12" && txtPwdHash.Value == value.ToLower().Trim())
                                        {
                                            Session["UserID"] = drps["EmpID"];
                                            Response.Redirect(string.Format("~/ProjectStaff/PS_MainHome.aspx?st={0}", name), false);
                                        }
                                        else
                                        {
                                            string msg = "Invalid User Login Credientials";
                                            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Alert...!!!", "alert('" + msg + "');", true);
                                        }
                                    }
                                }
                                else
                                {
                                    // Security Guard
                                    objPRReq.Status = "Active";
                                    objPRReq.SGNO   = txt_UserID.Text.Trim();
                                    PRResp    rsg = objPRIBC.SGLogin(objPRReq);
                                    DataTable dsg = rsg.GetTable;
                                    if (dsg.Rows.Count > 0)
                                    {
                                        foreach (DataRow drg in dsg.Rows)
                                        {
                                            string myval    = FormsAuthentication.HashPasswordForStoringInConfigFile(ViewState["KeyGenerator"].ToString(), "SHA1");
                                            string password = drg["Password"].ToString();
                                            string value    = FormsAuthentication.HashPasswordForStoringInConfigFile(password.ToLower() + myval.ToLower(), "SHA1");
                                            if (drg["Status"].ToString() == "Active" && drg["Role"].ToString() == "100" && txtPwdHash.Value == value.ToLower())
                                            {
                                                Session["UserID"] = drg["SGID"];
                                                Response.Redirect(string.Format("~/Security/SecurityHomepage.aspx?st={0}", name), false);
                                            }
                                            else
                                            {
                                                string msg = "Invalid User Login Credientials";
                                                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Alert...!!!", "alert('" + msg + "');", true);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        objPRReq.Status = "Active";
                                        objPRReq.Email  = txt_UserID.Text.Trim();
                                        PRResp    rcit = objPRIBC.CITSSLogin(objPRReq);
                                        DataTable dcit = rcit.GetTable;
                                        if (dcit.Rows.Count > 0)
                                        {
                                            foreach (DataRow dts in dcit.Rows)
                                            {
                                                string myval    = FormsAuthentication.HashPasswordForStoringInConfigFile(ViewState["KeyGenerator"].ToString(), "SHA1");
                                                string password = dts["Password"].ToString();
                                                string value    = FormsAuthentication.HashPasswordForStoringInConfigFile(password.ToLower() + myval.ToLower(), "SHA1");
                                                if (dts["Status"].ToString() == "Active" && dts["Role"].ToString() == "11" && txtPwdHash.Value == value.ToLower())
                                                {
                                                    Session["UserID"] = dts["CSID"];
                                                    Response.Redirect(string.Format("~/CITStaff/CITSSHome.aspx?st={0}", name), false);
                                                }
                                                else
                                                {
                                                    string msg = "Invalid User Login Credientials";
                                                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Alert...!!!", "alert('" + msg + "');", true);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            objPRReq.Status = "Active";
                                            objPRReq.UserID = txt_UserID.Text.Trim();
                                            PRResp    rcelDA = objPRIBC.eLDALogin(objPRReq);
                                            DataTable dcelDA = rcelDA.GetTable;
                                            if (dcelDA.Rows.Count > 0)
                                            {
                                                foreach (DataRow dtelda in dcelDA.Rows)
                                                {
                                                    string myval    = FormsAuthentication.HashPasswordForStoringInConfigFile(ViewState["KeyGenerator"].ToString(), "SHA1");
                                                    string password = dtelda["Password"].ToString();
                                                    string value    = FormsAuthentication.HashPasswordForStoringInConfigFile(password.ToLower() + myval.ToLower(), "SHA1");
                                                    if (dtelda["Status"].ToString() == "Active" && dtelda["Role"].ToString() == "12" && txtPwdHash.Value == value.ToLower())
                                                    {
                                                        Session["UserID"] = dtelda["UserID"];
                                                        Response.Redirect(string.Format("~/eLeaveDA/EmployeeStatus.aspx?st={0}", name), false);
                                                    }
                                                    else
                                                    if (dtelda["Status"].ToString() == "Active" && dtelda["Role"].ToString() == "13" && txtPwdHash.Value == value.ToLower())
                                                    {
                                                        Session["UserID"] = dtelda["UserID"];
                                                        Response.Redirect(string.Format("~/HCMS/hcmsHome.aspx?st={0}", name), false);
                                                    }
                                                    else
                                                    {
                                                        string msg = "Invalid User Login Credientials";
                                                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Alert...!!!", "alert('" + msg + "');", true);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                string msg = " Enter User Login Credientials";
                                                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Alert...!!!", "alert('" + msg + "');", true);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    string msg = " Enter Valid Cpatch..";
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Alert...!!!", "alert('" + msg + "');", true);
                }
            }
            else
            {
                string msg = " Enter User Login Credientials";
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Alert...!!!", "alert('" + msg + "');", true);
            }
        }
        catch (Exception ex)
        {
            string msg = ex.Message.Replace("'", ""); Response.Redirect(string.Format("~/Error.aspx?st=" + msg.ToString()), false);
        }
    }
예제 #24
0
    private void ChargeBank(string orderid)
    {
        //商户信息
        string bankgate    = ConfigurationManager.AppSettings["bankgate"]; //
        string callbackurl = "http://" + Request.Url.Host + ":" + Request.Url.Port + "/pay/CallBack.aspx";
        string hrefbackurl = "http://" + Request.Url.Host + ":" + Request.Url.Port + "/pay/HrefBack.aspx";
        string attach      = "";
        //银行提交获取信息
        string bank_Type     = Request.Form["bankCode"];    //银行类型
        string bank_payMoney = Request.Form["totalAmount"]; //充值金额
        string param         = string.Format("value={0}&parter={1}&type={2}&orderid={3}&callbackurl={4}", bank_payMoney, shop_id, bank_Type, orderid, callbackurl);
        string PostUrl       = string.Format(bankgate + "?{0}&sign={1}&hrefbackurl={2}&attach={3}", param, FormsAuthentication.HashPasswordForStoringInConfigFile(param + key, "MD5").ToLower(), hrefbackurl, attach);

        Response.Redirect(PostUrl, true);//转发URL地址
        //Response.Write(PostUrl);
    }
예제 #25
0
        public IHttpActionResult CheckUpgrade(UpgradeModel model)
        {
            if (!ModelState.IsValid)
            {
                throw new HttpResponseException(Request.CreateValidationErrorResponse(ModelState));
            }

            int revision;

            int.TryParse(model.VersionComment, out revision);
            var version = new System.Version(model.VersionMajor, model.VersionMinor, model.VersionPatch, revision);

            var latestVersion = GetLatestVersionFromMajor(model.VersionMajor);

            if (latestVersion == null)
            {
                return(Json(new UpgradeResult(UpgradeType.None, "", "")));
            }

            // Persist the update check for our statistics, don't remove!
            var caller = HttpContext.Current.Request.UserHostName + "_" +
                         HttpContext.Current.Request.UserHostAddress;
            var callerHashed = FormsAuthentication.HashPasswordForStoringInConfigFile(caller, "sha1");

            PersistUpdateCheck(callerHashed, model.VersionMajor, model.VersionMinor, model.VersionPatch,
                               model.VersionComment);
            // End of persisting the update check for our statistics, don't remove!

            // Special case for 4.0.4.2, apperently we never recommended them to upgrade
            if (version == new System.Version(4, 0, 4, 2) || version == latestVersion)
            {
                return(Json(new UpgradeResult(UpgradeType.None, "", "")));
            }

            if (version.Major == 4)
            {
                // We had some special cases in the old updatechecker so I left them here
                if (version == new System.Version(4, 0, 4, 1))
                {
                    return(Json(new UpgradeResult(UpgradeType.Minor, "4.0.4.2 is out with fixes for load-balanced sites.", "http://our.umbraco.org/download")));
                }

                if (version == new System.Version(4, 0, 4, 0))
                {
                    return(Json(new UpgradeResult(UpgradeType.Critical, "4.0.4.1 is out fixing a serious macro bug. Please upgrade!", "http://our.umbraco.org/download")));
                }


                if (version == new System.Version(4, 7, 0, 0))
                {
                    return(Json(new UpgradeResult(UpgradeType.Critical, "This Umbraco installation needs to be upgraded. It may contain a potential security issue!", "http://our.umbraco.org/download")));
                }


                if (version >= new System.Version(4, 10, 0, 0) && version < latestVersion)
                {
                    return(Json(new UpgradeResult(UpgradeType.Major, $"{latestVersion} is released. Upgrade today - it's free!", "http://our.umbraco.org/download")));
                }
            }

            if (version.Major == 6)
            {
                if ((version < latestVersion))
                {
                    return(Json(new UpgradeResult(UpgradeType.Major, $"{latestVersion} is released. Upgrade today - it's free!", "http://our.umbraco.org/download")));
                }
            }

            if (version.Major == 7 || version.Major == 8 || version.Major > 8)
            {
                if (version < latestVersion)
                {
                    return(Json(new UpgradeResult(UpgradeType.Minor, $"{latestVersion} is released. Upgrade today - it's free!", $"http://our.umbraco.org/contribute/releases/{latestVersion.Major}{latestVersion.Minor}{latestVersion.Build}")));
                }
            }

            // If nothing matches then it's probably a nightly or a very old version, no need to send upgrade message
            return(Json(new UpgradeResult(UpgradeType.None, "", "")));
        }
예제 #26
0
    private void CardReceive(string orderid)
    {
        //商户信息
        string cardgate    = ConfigurationManager.AppSettings["cardgate"]; //
        string callbackurl = "http://" + Request.Url.Host + ":" + Request.Url.Port + "/pay/CallBack.aspx";
        string hrefbackurl = "http://" + Request.Url.Host + ":" + Request.Url.Port + "/pay/HrefBack.aspx";
        //获取卡类提交信息
        string card_No  = Request.Form["cardNo"];                      //卡号
        string card_pwd = Request.Form["cardPwd"];                     //卡密
        //string card_account = Request.Form["txtUserNameCard"];//充值账号
        string card_type     = Request.Form["bankCode"].Split(',')[0]; //卡类型
        string card_payMoney = Request.Form["totalAmount"];            //充值金额
        string restrict      = "0";                                    //使用范围
        string attach        = "test";                                 //附加内容,下行原样返回

        //卡类支付
        string param   = "parter=" + shop_id + "&cardtype=" + card_type + "&cardno=" + card_No + "&cardpwd=" + card_pwd + "&orderid=" + orderid + "&callbackurl=" + callbackurl + "&restrict=" + restrict + "&price=" + card_payMoney;
        string PostUrl = string.Format(cardgate + "?{0}&attach={1}&sign={2}", param, attach, FormsAuthentication.HashPasswordForStoringInConfigFile(param + key, "MD5").ToLower());

        HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(PostUrl);
        //获取响应结果 此过程大概需要5秒
        HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
        //获取响应流
        Stream stream = httpWebResponse.GetResponseStream();

        //用指定的字符编码为指定的流初始化 StreamReader 类的一个新实例。
        using (StreamReader streamReader = new StreamReader(stream, Encoding.UTF8))
        {
            string useResult = streamReader.ReadToEnd();
            streamReader.Dispose();
            streamReader.Close();
            httpWebResponse.Close();

            if (useResult.Trim() == "0")
            {
                Response.Write("支付成功.");
            }
            else
            {
                Response.Write(useResult.Trim());
            }
        }
    }
예제 #27
0
 /// <summary>Retorna a hash de uma pass para guardar na BD</summary>
 public string hashPassword(string text)
 {
     return(FormsAuthentication.HashPasswordForStoringInConfigFile(text, "sha1"));
 }
예제 #28
0
        protected void bt_zaloguj_Click(object sender, EventArgs e)
        {
            String redir = Request.QueryString["re"];

            this.Zaloguj(this.tb_login.Text, FormsAuthentication.HashPasswordForStoringInConfigFile(this.tb_haslo.Text, "SHA1"), redir);
        }
예제 #29
0
 public string GetPasswordHash(string password)
 {
     return(FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5"));
 }
예제 #30
0
 public string Encrypt_MD5(string sValue)
 {
     return(FormsAuthentication.HashPasswordForStoringInConfigFile(sValue, "MD5"));
 }