private void BtnGuardar_Click(object sender, EventArgs e)
        {
            using (db_gasolineraEntities1 db = new db_gasolineraEntities1())
            {
                if (id == null)
                {
                    oprovedor = new tbl_login();
                }
                oprovedor.lg_nombre  = txtNombre.Text;
                oprovedor.lg_usuario = txtUsuario.Text;
                oprovedor.lg_contra  = txtContra.Text;

                if (id == null)
                {
                    db.tbl_login.Add(oprovedor);
                }
                else
                {
                    db.Entry(oprovedor).State = System.Data.Entity.EntityState.Modified;
                }
                db.SaveChanges();

                this.Close();
            }
        }
Exemplo n.º 2
0
    protected void btn_reg_Click(object sender, EventArgs e)
    {
        tbl_register reg = new tbl_register();

        reg.stud_name     = txt_name.Text;
        reg.stud_class    = ddl_class.SelectedValue;
        reg.stud_email    = txt_email.Text;
        reg.stud_password = txt_conPass.Text;
        if (FileUpload1.HasFile)
        {
            FileUpload1.SaveAs(Server.MapPath("~/master1/images/" + FileUpload1.FileName));
        }
        reg.stud_pic  = "~/master1/images/" + FileUpload1.FileName;
        reg.user_type = "user";
        db.tbl_registers.InsertOnSubmit(reg);

        tbl_login log = new tbl_login();

        log.log_email    = txt_email.Text;
        log.log_password = txt_conPass.Text;
        log.user_type    = "user";
        db.tbl_logins.InsertOnSubmit(log);

        db.SubmitChanges();

        Response.Write("<script> alert('Now, You Are Registered User Please Login Here...') </script>");
    }
Exemplo n.º 3
0
 public ActionResult Signin(Model_login obj)
 {
     if (db.tbl_logins.Where(x => x.email == obj.email && x.password == obj.password).Count() > 0)
     {
         if (db.tbl_logins.Where(x => x.email == obj.email && x.password == obj.password && x.log_status == "Active").Count() > 0)
         {
             tbl_login        tbl = db.tbl_logins.Where(x => x.email == obj.email && x.password == obj.password).Single <tbl_login>();
             tbl_registration tb  = db.tbl_registrations.Where(x => x.login_id == tbl.login_id).Single <tbl_registration>();
             SessionData.fname  = tb.reg_fname;
             SessionData.UserId = tbl.login_id;
             SessionData.photo  = tb.reg_photo;
             SessionData.RegId  = tb.reg_id;
             if (db.tbl_subscriptions.Where(x => x.sub_end_date > DateTime.Now && x.login_id == tbl.login_id).Count() > 0)
             {
                 SessionData.ustatus = "Paid";
             }
             return(Redirect(SessionData.currenturl));
         }
         else
         {
             ModelState.AddModelError("error", "Error! Please check your Email to Activate Your Account");
             return(View());
         }
     }
     else
     {
         ModelState.AddModelError("error", "Error! Please check your Username And/or Password");
         return(View());
     }
 }
        public ActionResult Create(Model_Login_Register obj)
        {
            if (db.tbl_logins.Where(x => x.email == obj.mdlogin.email).Count() == 0)
            {
                string host    = Request.Url.Authority;
                string key     = GetUniqueKey(64);
                string sendurl = "http://" + host + "/login/Activate/" + key;
                SendMail(obj.mdlogin.email, obj.mdregister.reg_fname, "Confirm Registration Email", sendurl);

                HttpPostedFileBase file = Request.Files["file1"];
                tbl_login          tbl  = new tbl_login();
                tbl.email      = obj.mdlogin.email;
                tbl.password   = obj.mdlogin.password;
                tbl.log_status = key;
                tbl.log_date   = DateTime.Today;
                db.tbl_logins.InsertOnSubmit(tbl);
                db.SubmitChanges();


                tbl_registration tb = new tbl_registration();

                if (file.FileName != "")
                {
                    var filename = Path.GetFileName(file.FileName);
                    var path     = Path.Combine(Server.MapPath("~/fileupload"), filename);
                    file.SaveAs(path);
                    S3Class s3obj = new S3Class();
                    string  str   = s3obj.putObject("all.input.video.streaming", path, file.FileName.Replace(' ', '_'));
                    tb.reg_photo = str;
                }

                tb.reg_fname   = obj.mdregister.reg_fname;
                tb.reg_lname   = obj.mdregister.reg_lname;
                tb.reg_gender  = obj.mdregister.reg_gender;
                tb.reg_address = obj.mdregister.reg_address;
                tb.country_id  = obj.mdregister.country_id;
                tb.state_id    = obj.mdregister.state_id;
                tb.city_id     = obj.mdregister.city_id;
                tb.reg_phno    = obj.mdregister.reg_phno;
                tb.login_id    = tbl.login_id;
                db.tbl_registrations.InsertOnSubmit(tb);
                db.SubmitChanges();

                //string host = Request.Url.Authority;
                //host = host + GetUniqueKey(64);
                //string sendurl = "http://" + host;
                //SendMail(obj.mdlogin.email, "Confirm Email", sendurl);
                return(RedirectToAction("Confirm"));
            }
            else
            {
                ModelState.AddModelError("error", "Error! Your email is already registered with us");

                ViewBag.genderid  = new SelectList(db.tbl_genders.ToList(), "gen_id", "gen_name");
                ViewBag.countryid = new SelectList(db.tbl_countries.ToList(), "country_id", "country_name");
                ViewBag.stateid   = new SelectList(db.tbl_states.ToList(), "state_id", "state_name");
                ViewBag.cityid    = new SelectList(db.tbl_cities.ToList(), "city_id", "city_name");
                return(View("SignUp"));
            }
        }
        public ActionResult Resend(Model_login obj)
        {
            if (db.tbl_logins.Where(x => x.email == obj.email && x.log_status == "Active").Count() > 0)
            {
                ModelState.AddModelError("error", "Your Email ID is already Activated Please Sign In");
                return(View());
            }
            else if (db.tbl_logins.Where(x => x.email == obj.email).Count() > 0)
            {
                tbl_login        tbl  = db.tbl_logins.Where(x => x.email == obj.email).Single <tbl_login>();
                tbl_registration tbl2 = db.tbl_registrations.Where(x => x.login_id == tbl.login_id).Single <tbl_registration>();

                string host    = Request.Url.Authority;
                string key     = GetUniqueKey(64);
                string sendurl = "http://" + host + "/login/Activate/" + key;
                SendMail(obj.email, tbl2.reg_fname, "Confirm Registration Email", sendurl);
                tbl.log_status = key;
                db.SubmitChanges();
                ModelState.AddModelError("error", "Activation Email Sent");
                return(View());
            }
            else
            {
                ModelState.AddModelError("error", "Email ID not registered Plz register First");

                return(View());
            }
        }
Exemplo n.º 6
0
    protected void btn_login_Click(object sender, EventArgs e)
    {
        var rr = from p in db.tbl_logins
                 where p.log_email == txt_username.Text && p.log_password == txt_password.Text
                 select p;

        tbl_login log = new tbl_login();

        if (rr.Count() != 0)
        {
            if (rr.First().user_type == "user")
            {
                Session["user"] = txt_username.Text;

                Response.Redirect("register_user.aspx");
            }

            else if (rr.First().user_type == "admin")
            {
                Session["user"] = txt_username.Text;
                Response.Redirect("~/master1/master2/admin_schedule.aspx");
            }
            else
            {
                Response.Write("Invalid User");
            }
        }
    }
        public ActionResult Edit(Model_Login_Register obj)
        {
            HttpPostedFileBase file = Request.Files["file1"];
            tbl_login          tbl  = db.tbl_logins.Where(x => x.login_id == obj.mdlogin.login_id).Single <tbl_login>();

            tbl.email    = obj.mdlogin.email;
            tbl.password = obj.mdlogin.password;
            db.SubmitChanges();

            tbl_registration tb = db.tbl_registrations.Where(x => x.reg_id == obj.mdregister.reg_id).Single <tbl_registration>();

            if (file.FileName != "")
            {
                var filename = Path.GetFileName(file.FileName);
                var path     = Path.Combine(Server.MapPath("~/fileupload"), filename);
                file.SaveAs(path);
                S3Class s3obj = new S3Class();
                string  str   = s3obj.putObject("all.input.video.streaming", path, file.FileName.Replace(' ', '_'));
                tb.reg_photo      = str;
                SessionData.photo = str;
            }

            tb.reg_fname   = obj.mdregister.reg_fname;
            tb.reg_lname   = obj.mdregister.reg_lname;
            tb.reg_address = obj.mdregister.reg_address;
            tb.country_id  = obj.mdregister.country_id;
            tb.state_id    = obj.mdregister.state_id;
            tb.city_id     = obj.mdregister.city_id;
            tb.reg_phno    = obj.mdregister.reg_phno;
            tb.login_id    = tbl.login_id;
            db.SubmitChanges();
            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            tbl_login tbl_login = db.tbl_login.Find(id);

            db.tbl_login.Remove(tbl_login);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 9
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string userName = txtUserName.Value.Trim();
        string userPwd  = txtPassword.Value.Trim();

        //判断登录信息
        userPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(userPwd, "MD5");
        //Response.Write(userPwd);
        //Response.End();
        if (tbl_admin.Exists(userName, userPwd))
        {
            tbl_admin myuser       = new tbl_admin();
            string    sqlGetUserID = "select  id  from [tbl_admin] where huiyuan_bianhao='" + userName + "'";
            int       userid       = Convert.ToInt16(DbHelperSQL.GetSingle(sqlGetUserID));
            myuser.GetModel(userid);

            //判断账号是否被禁用
            if (Convert.ToInt32(myuser.is_lock) == 1)
            {
                MessageBox.errorShow(this.Page, "您的账号被禁用,请联系客服!");
                return;
            }

            //写入登录日志
            tbl_login login_log = new tbl_login();
            login_log.huiyuan_bianhao = userName;
            login_log.huiyuan_name    = myuser.huiyuan_name;
            login_log.login_date      = DateTime.Now;
            login_log.login_flag      = 1;
            login_log.huiyuan_ip      = AXRequest.GetIP();
            login_log.Add();


            //写入Cookies
            Utils.WriteCookie("hy_id", myuser.huiyuan_id, 14400);
            Utils.WriteCookie("hy_bianhao", userName, 14400);
            Utils.WriteCookie("hy_name", myuser.huiyuan_name, 14400);
            Utils.WriteCookie("RoleID", myuser.role_id.ToString(), 14400);


            //写入Session
            Session["hy_id"]      = myuser.huiyuan_id;
            Session["hy_bianhao"] = userName;
            Session["hy_name"]    = myuser.huiyuan_name;
            Session["RoleID"]     = myuser.role_id.ToString();


            Session.Timeout = 45;

            Response.Redirect("index.aspx");
            return;
        }
        else
        {
            MessageBox.errorShow(this.Page, "账号或密码有误,请重试!");
            return;
        }
    }
Exemplo n.º 10
0
        public ActionResult Edit(tbl_login std)
        {
            db.Entry(std).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("login"));


            return(View());
        }
        public ActionResult Delete(Int32 id)
        {
            tbl_registration tb  = db.tbl_registrations.Where(x => x.reg_id == id).Single <tbl_registration>();
            tbl_login        tbl = db.tbl_logins.Where(x => x.login_id == tb.login_id).Single <tbl_login>();

            db.tbl_logins.DeleteOnSubmit(tbl);
            db.tbl_registrations.DeleteOnSubmit(tb);
            db.SubmitChanges();
            return(RedirectToAction("Index"));
        }
 private void cargar()
 {
     using (db_gasolineraEntities1 db = new db_gasolineraEntities1())
     {
         oprovedor       = db.tbl_login.Find(id);
         txtNombre.Text  = oprovedor.lg_nombre;
         txtUsuario.Text = oprovedor.lg_usuario;
         txtContra.Text  = oprovedor.lg_contra;
     }
 }
Exemplo n.º 13
0
 public ActionResult Edit([Bind(Include = "IdLogin,Username,Pass,Rol")] tbl_login tbl_login)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tbl_login).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Rol = new SelectList(db.tbl_roles, "IdRol", "Tipo", tbl_login.Rol);
     return(View(tbl_login));
 }
Exemplo n.º 14
0
    protected void grid1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("canceled"))
        {
            int            index   = int.Parse(e.CommandArgument.ToString());
            GridViewRow    gr      = (GridViewRow)((Button)e.CommandSource).NamingContainer;
            int            user_id = int.Parse(((HiddenField)gr.FindControl("user_id")).Value.ToString());
            bus_dbEntities db      = new bus_dbEntities();
            tbl_login      login   = (from x in db.tbl_login where x.fk_user == user_id select x).ToList()[0];
            db.tbl_login.Remove(login);
            //Save to database
            db.SaveChanges();
            var original = db.tbl_user.Find(user_id);

            if (original != null)
            {
                db.Entry(original).State = EntityState.Modified;
                original.user_status     = "not verified";
                db.SaveChanges();
            }

            var lgs = (from x in db.tbl_user select x).ToList();
            grid1.DataSource = lgs;
            grid1.DataBind();
        }
        else if (e.CommandName.Equals("verify"))
        {
            int            index    = int.Parse(e.CommandArgument.ToString());
            GridViewRow    gr       = (GridViewRow)((Button)e.CommandSource).NamingContainer;
            int            user_id  = int.Parse(((HiddenField)gr.FindControl("user_id")).Value.ToString());
            String         username = gr.Cells[8].Text.ToString();
            String         password = gr.Cells[9].Text.ToString();
            bus_dbEntities db       = new bus_dbEntities();
            tbl_login      login    = new tbl_login();
            login.login_password = password;
            login.login_user     = username;
            login.fk_user        = user_id;
            db.tbl_login.Add(login);
            db.SaveChanges();

            var original = db.tbl_user.Find(user_id);

            if (original != null)
            {
                db.Entry(original).State = EntityState.Modified;
                original.user_status     = "verified";
                db.SaveChanges();
            }

            var lgs = (from x in db.tbl_user select x).ToList();
            grid1.DataSource = lgs;
            grid1.DataBind();
        }
    }
Exemplo n.º 15
0
        // GET: tbl_login/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_login tbl_login = db.tbl_login.Find(id);

            if (tbl_login == null)
            {
                return(HttpNotFound());
            }
            return(View(tbl_login));
        }
Exemplo n.º 16
0
        // GET: tbl_login/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_login tbl_login = db.tbl_login.Find(id);

            if (tbl_login == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Rol = new SelectList(db.tbl_roles, "IdRol", "Tipo", tbl_login.Rol);
            return(View(tbl_login));
        }
Exemplo n.º 17
0
        //login
        public ActionResult login(loginivewmodel lg)
        {
            tbl_login t = db.tbl_login.Where(x => x.R_email == lg.R_email && x.R_password == lg.R_password).SingleOrDefault();

            if (t == null)
            {
                return(RedirectToAction("login"));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }

            return(View());
        }
Exemplo n.º 18
0
 public ActionResult Forgot(Model_login obj)
 {
     if (db.tbl_logins.Where(x => x.email == obj.email).Count() > 0)
     {
         tbl_login        tbl  = db.tbl_logins.Where(x => x.email == obj.email).Single <tbl_login>();
         tbl_registration tbl2 = db.tbl_registrations.Where(x => x.login_id == tbl.login_id).Single <tbl_registration>();
         //SendMail(obj.email, "Forgot Password,"+ tbl2.reg_fname + ",Your password : "******"Forgot Password", "Your password : "******"sucess", "Email Sucessfully sent, check your Email address");
         return(View());
     }
     else
     {
         ModelState.AddModelError("error", "Error! Please check your Email address");
         return(View());
     }
 }
Exemplo n.º 19
0
        public ActionResult forgetpassword(loginivewmodel obj)
        {
            tbl_login t = db.tbl_login.Where(x => x.R_email == obj.R_email).SingleOrDefault();

            if (t == null)
            {
                TempData["Data"] = "Please Enter a Email First";
                return(RedirectToAction("forgetpassword"));
            }
            else
            {
                Session["User_id"] = t.R_id;
                return(RedirectToAction("Edit"));
            }



            return(View());
        }
Exemplo n.º 20
0
    /// <summary>
    /// 写入管理日志
    /// </summary>
    /// <param name="action_type"></param>
    /// <param name="remark"></param>
    /// <returns></returns>
    public bool AddAdminLog(string action_type, string remark)
    {
        //写入日志
        tbl_login mylog = new tbl_login();

        mylog.huiyuan_bianhao = Session["hy_bianhao"].ToString();
        mylog.huiyuan_name    = Session["hy_name"].ToString();
        mylog.login_date      = DateTime.Now;
        mylog.login_flag      = 1;
        mylog.huiyuan_ip      = AXRequest.GetIP();
        int newId = mylog.Add();

        if (newId > 0)
        {
            return(true);
        }

        return(false);
    }
        private void BtnEliminar_Click(object sender, EventArgs e)
        {
            int?id = getid();

            if (id == null)
            {
                DisplayErrorSeleccion();
                return;
            }


            using (db_gasolineraEntities1 db = new db_gasolineraEntities1())
            {
                tbl_login oproveedor = db.tbl_login.Find(id);
                db.tbl_login.Remove(oproveedor);

                db.SaveChanges();
            }
            refrescar();
        }
Exemplo n.º 22
0
 public ActionResult login(tbl_login tbllogin)
 {
     try
     {
         tbl_login lg = db.tbl_login.SingleOrDefault(p => p.id == tbllogin.id & p.password == tbllogin.password);
         if (lg != null)
         {
             Session["loginid"] = lg.id;
             return(RedirectToAction("../Admin/AdminIndex"));
         }
         else
         {
             ViewBag.msg = "Invalid Username Or Password";
         }
     }
     catch (Exception c)
     {
         ViewBag.msg = "something went wrong";
     }
     return(View());
 }
Exemplo n.º 23
0
        public ActionResult Edit(int?id)
        {
            int user_id = Convert.ToInt32(Session["User_id"]);

            id = user_id;

            if (id == null)
            {
                return(RedirectToAction("forgetpassword"));
            }

            tbl_login t = db.tbl_login.Where(x => x.R_id == id).SingleOrDefault();


            if (t == null)
            {
                return(HttpNotFound());
            }

            return(View(t));
        }
Exemplo n.º 24
0
 public ActionResult LoginPage(tbl_login C)
 {
     if (ModelState.IsValid)
     {
         string uname = Request.Form["username"];
         string pwd   = Request.Form["password"];
         if (DBOperations.GetDetails(uname, pwd))
         {
             return(RedirectToAction("Index"));
         }
         else
         {
             ViewBag.L = "Invalid Details";
             return(View("Login"));
         }
     }
     else
     {
         return(View("Login"));
     }
 }
Exemplo n.º 25
0
        public ActionResult Activate(Model_login obj)
        {
            if (db.tbl_logins.Where(x => x.login_id == obj.login_id && x.log_status == "Active").Count() > 0)
            {
                ModelState.AddModelError("error", "Your email is already activated");
                return(RedirectToAction("Signin"));
            }
            else
            {
                if (obj.login_id != 0)
                {
                    tbl_login tbl = db.tbl_logins.Where(x => x.login_id == obj.login_id).Single <tbl_login>();
                    tbl.log_status = "Active";
                    db.SubmitChanges();
                    return(RedirectToAction("SignIn"));
                }
                ModelState.AddModelError("error", "Invalid activation url");

                return(View());
            }
        }
Exemplo n.º 26
0
        public JObject AddUser(JObject inputJson)
        {
            JObject returnObject = new JObject();

            try
            {
                UserDataContext d = new UserDataContext();

                tbl_User user = new tbl_User();

                user.Name     = inputJson["name"].ToString();
                user.Email    = inputJson["email"].ToString();
                user.Address  = inputJson["address"].ToString();
                user.MobileNo = inputJson["mobile"].ToString();
                user.city     = inputJson["city"].ToString();
                user.isActive = 1;

                d.tbl_Users.InsertOnSubmit(user);
                d.SubmitChanges();

                tbl_login login = new tbl_login();

                login.id       = user.id;
                login.username = inputJson["email"].ToString();
                login.password = inputJson["password"].ToString();

                d.tbl_logins.InsertOnSubmit(login);
                d.SubmitChanges();

                returnObject.Add("Status", "Successful");
            }
            catch (Exception ex)
            {
                returnObject.Add("Status", "un Successful");
                returnObject.Add("Error", ex.Message);
            }
            return(returnObject);
        }
Exemplo n.º 27
0
    private void ShowInfo()
    {
        count             = DbHelperSQL.GetDataRow("select aa=count(*) from tbl_huiyuan where huiyuan_id<>'A00000000' and net_hege=1 and datediff(day,huiyuan_add_time,getdate())=0")["aa"].ToString();
        shouru_z          = DbHelperSQL.GetDataRow("select aa=isnull(sum(xiaofei_money),0) from tbl_xiaofei where zhuce_flag=1 and datediff(day,xiaofei_qr_date,getdate())=0")["aa"].ToString();
        Litreal_name.Text = Session["hy_bianhao"].ToString();
        tbl_login model = new tbl_login();

        model.GetModel_last(Session["hy_bianhao"].ToString());
        Literal_time.Text = model.login_date.ToString();
        tbl_liuyan liuyan = new tbl_liuyan();

        Literal1.Text = "<font color=red>" + liuyan.GetTitleSum(" kan_flag=0 and liuyan_to='A00000000'") + "</font>";

        string  sql  = " SELECT ISNULL(SUM(jiesuan_jiangjin), 0) AS jiangjin FROM tbl_bochu";
        DataSet ds   = DbHelperSQL.Query(sql);
        double  sa   = double.Parse(ds.Tables[0].Rows[0]["jiangjin"].ToString());
        string  sql2 = " SELECT ISNULL(SUM(jiesuan_yeji), 0) AS yeji FROM tbl_bochu";
        DataSet ds2  = DbHelperSQL.Query(sql2);
        double  sb   = double.Parse(ds2.Tables[0].Rows[0]["yeji"].ToString());
        double  c    = sa / sb;

        if (c > 0)
        {
            //Literal2.Text = (decimal.Parse(c.ToString()) * 100m).ToString("0.00");
        }
        string  jsql  = "SELECT ISNULL(SUM(jiesuan_jiangjin), 0) AS jiangjin, CONVERT(char(11), jiesuan_date, 120) AS date FROM tbl_bochu       GROUP BY CONVERT(char(11), jiesuan_date, 120) ORDER BY CONVERT(char(11), jiesuan_date, 120) DESC";
        DataSet jds   = DbHelperSQL.Query(jsql);
        double  jsa   = double.Parse(ds.Tables[0].Rows[0]["jiangjin"].ToString());
        string  jsql2 = " SELECT ISNULL(SUM(jiesuan_yeji), 0) AS yeji, CONVERT(char(11), jiesuan_date, 120) AS date FROM tbl_bochu       GROUP BY CONVERT(char(11), jiesuan_date, 120) ORDER BY CONVERT(char(11), jiesuan_date, 120) DESC";
        DataSet jds2  = DbHelperSQL.Query(jsql2);
        double  jsb   = double.Parse(ds2.Tables[0].Rows[0]["yeji"].ToString());
        double  d     = jsa / jsb;

        if (d > 0)
        {
            //Literal3.Text = (decimal.Parse(d.ToString()) * 100m).ToString("0.00");
        }
    }
Exemplo n.º 28
0
    protected void ibtnLogin_Click(object sender, EventArgs e)
    {
        TextBox txtname = (TextBox)((MasterPage)Master).FindControl("txtUserName");
        TextBox txtpwd  = (TextBox)((MasterPage)Master).FindControl("txtPassword");
        TextBox Txtcode = (TextBox)((MasterPage)Master).FindControl("Txtcode");

        if (Txtcode.Text == "")
        {
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "alert('您未输入验证码。');", true);
            //lblTip.Text = "您输入的验证码不正确,请重新输入。";
            return;
        }

        if (Session["serverCode"] == null)
        {
            Response.Write("<script language=javascript>alert('验证码失效,刷新页面!');location.href='index.aspx';</script>");
            Response.End();
        }
        string sVCode = Session["serverCode"].ToString();

        if (txtname.Text == "")
        {
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "alert('请输入用户名。');", true);
            //lblTip.Text = "您输入的验证码不正确,请重新输入。";
            return;
        }
        if (txtpwd.Text == "")
        {
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "alert('请输入密码。');", true);
            //lblTip.Text = "您输入的验证码不正确,请重新输入。";
            return;
        }
        if (Txtcode.Text != sVCode)
        {
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "alert('您输入的验证码不正确,请重新输入。');", true);
            //lblTip.Text = "您输入的验证码不正确,请重新输入。";
            return;
        }

        string sUserName = Utils.Filter(txtname.Text.Trim());

        string sPassWord = Utils.Filter(txtpwd.Text.Trim());

        if (tbl_huiyuan.Existshui(sUserName, sPassWord) || tbl_huiyuan.Exists(sUserName, sPassWord))
        {
            if (tbl_huiyuan.Existshui(sUserName, sPassWord))
            {
                tbl_huiyuan model1 = new tbl_huiyuan();
                model1.GetModel_hui_mob(sUserName);
                Session["hy_id1"]      = model1.huiyuan_id;
                Session["hy_bianhao1"] = model1.huiyuan_bianhao;
                Session["hy_name1"]    = model1.huiyuan_name;
                Session["hy_zm1"]      = model1.huiyuan_zhuanmai;
                Session["hy_jiebie1"]  = model1.huiyuan_jiebie;
                //Session["zhongyao1"] = 1;

                //写入登录日志
                tbl_login login_log = new tbl_login();
                login_log.huiyuan_bianhao = sUserName;
                login_log.huiyuan_name    = model1.huiyuan_name;
                login_log.login_date      = DateTime.Now;
                login_log.login_flag      = 2;
                login_log.huiyuan_ip      = AXRequest.GetIP();
                login_log.Add();
            }

            if (tbl_huiyuan.Exists(sUserName, sPassWord))
            {
                tbl_huiyuan model1 = new tbl_huiyuan();
                model1.GetModel_hui_bianhao(sUserName);
                Session["hy_id1"]      = model1.huiyuan_id;
                Session["hy_bianhao1"] = model1.huiyuan_bianhao;
                Session["hy_name1"]    = model1.huiyuan_name;
                Session["hy_zm1"]      = model1.huiyuan_zhuanmai;
                Session["hy_jiebie1"]  = model1.huiyuan_jiebie;
                //Session["zhongyao1"] = 1;

                //写入登录日志
                tbl_login login_log = new tbl_login();
                login_log.huiyuan_bianhao = sUserName;
                login_log.huiyuan_name    = model1.huiyuan_name;
                login_log.login_date      = DateTime.Now;
                login_log.login_flag      = 2;
                login_log.huiyuan_ip      = AXRequest.GetIP();
                login_log.Add();
            }



            Utils.WriteCookie("ps_cookie_shopping_cart", "AoXiang", -14400);
            Response.Redirect("huiyuan/index.aspx");
            return;
        }
        else
        {
            Response.Write("<script language=javascript>alert('账号或密码有误或被冻结,请重试!');location.href='login.aspx';</script>");
            Response.End();
        }
    }
Exemplo n.º 29
0
 partial void Updatetbl_login(tbl_login instance);
Exemplo n.º 30
0
 partial void Deletetbl_login(tbl_login instance);