Esempio n. 1
0
        public LoginInfo CheckLogin()
        {
            LoginInfo li = new LoginInfo();

            string sql = "";
            List <SqlParameter> sPar = new List <SqlParameter>();

            using (DataManager dMan = new DataManager())
            {
                sql = "SELECT * FROM USR WHERE USRNM=@USRNM And PWD=@PWD";
                sPar.Add(new SqlParameter("USRNM", _userId));
                //sPar.Add(new SqlParameter("UserPwd", _userPwd));
                sPar.Add(new SqlParameter("PWD", CryptionHelper.Encrypt(_userPwd, "tb")));
                DataTable dt = dMan.ExecuteDataTable(sql, sPar);
                if (dt.Rows.Count == 0)
                {
                    //Kullanıcı Yok Demek
                    return(null);
                }

                li.UserId    = dt.Rows[0]["ID"].ToString();
                li.UserName  = dt.Rows[0]["USRNM"].ToString();
                li.UserEmail = dt.Rows[0]["EMAIL"].ToString();
            }

            return(li);
        }
        public ActionResult UserAdd(string txtUSRNM, string txtFULNM, string txtPWD, string txtEMAIL, string txtCARDNO, string txtCVC, string txtSTKDAY, string txtSTKMONTH, HttpPostedFileBase file)
        {
            string filefo = "";

            using (DataVw dMan = new DataVw())
            {
                dsUser = dMan.ExecuteView_S("USR", "*", "", "", "");
            }

            if (txtUSRNM.ToString() == "" || txtFULNM.ToString() == "" || txtPWD.ToString() == "" || txtEMAIL.ToString() == "" || txtCARDNO.ToString() == "" || txtCVC.ToString() == "" || txtSTKDAY.ToString() == "" || txtSTKMONTH.ToString() == "")
            {
                Session["useraddsuccess"] = false;
                ViewBag.addmessage        = "Eksik veri girişi! Tüm Alanları Doldurunuz.";
                return(Redirect("/Account/Register"));
            }
            else
            {
                if (file != null)
                {
                    string pic   = System.IO.Path.GetFileName(file.FileName);
                    string path  = System.IO.Path.Combine(Server.MapPath("~/images/avatar"), pic);
                    string pathd = "~/images/avatar/" + pic;
                    // file is uploaded
                    file.SaveAs(path);
                    filefo = pathd;

                    using (MemoryStream ms = new MemoryStream())
                    {
                        file.InputStream.CopyTo(ms);
                        byte[] array = ms.GetBuffer();
                    }
                }
                DataRow newrow = dsUser.Tables[0].NewRow();
                newrow["ID"]        = Guid.NewGuid();
                newrow["USRNM"]     = txtUSRNM;
                newrow["PWD"]       = CryptionHelper.Encrypt(txtPWD, "tb");
                newrow["FULNM"]     = txtFULNM;
                newrow["EMAIL"]     = txtEMAIL;
                newrow["IS_ADMIN"]  = 1;
                newrow["IS_SYSADM"] = 0;
                if (filefo == "")
                {
                    newrow["AVATAR"] = "~/images/avatar/nullavatar.jpg";
                }
                else
                {
                    newrow["AVATAR"] = filefo;
                }
                newrow["AVATAR"]   = filefo;
                newrow["CARDNO"]   = txtCARDNO;
                newrow["CVC"]      = txtCVC;
                newrow["STKDAY"]   = txtSTKDAY;
                newrow["STKMONTH"] = txtSTKMONTH;
                newrow["EDATE"]    = DateTime.Now;
                //newrow["EUSRID"] = null;
                newrow["UDATE"] = DateTime.Now;
                //newrow["UUSRID"] = null;
                newrow["NOTE"] = "En Son Kayıt İşlemi Gerçekleştirdi.";
                AgentGc data = new AgentGc();
                string  veri = data.DataAdded("USR", newrow, dsUser.Tables[0]);
                Session["useraddsuccess"] = true;
                ViewBag.addmessageinfo    = veri;
                return(Redirect("/Account/Login"));
            }
        }
Esempio n. 3
0
        public ActionResult SelectUserInfoChange(string txtUSRNM, string txtFULNM, string txtPWD, string txtEMAIL, string txtCARDNO, string txtCVC, string txtSTKDAY, string txtSTKMONTH, HttpPostedFileBase file, System.Web.Mvc.FormCollection collection)
        {
            DataSet dsUser = new DataSet();
            string  USRID  = collection.AllKeys[8].ToString();
            string  filefo = "";

            using (DataVw dMan = new DataVw())
            {
                dsUser = dMan.ExecuteView_S("USR", "*", USRID, "", "ID = ");
            }

            //if (txtUSRNM.ToString() == "" || txtFULNM.ToString() == "" || txtPWD.ToString() == "" || txtEMAIL.ToString() == "" || txtCARDNO.ToString() == "" || txtCVC.ToString() == "" || txtSTKDAY.ToString() == "" || txtSTKMONTH.ToString() == "")
            //{
            //    return Content("<script language='javascript' type='text/javascript'>alert('Eksik veri girişi! Tüm Alanları Doldurunuz.');</script>");  ////Alert Mesajı Göndermek için.
            //    //ViewBag.addmessage = "Eksik veri girişi! Tüm Alanları Doldurunuz.";
            //    //return Redirect("/Account/Manage");
            //}
            //else
            //{
            if (file != null)
            {
                string pic   = System.IO.Path.GetFileName(file.FileName);
                string path  = System.IO.Path.Combine(Server.MapPath("~/images/avatar"), pic);
                string pathd = "~/images/avatar/" + pic;
                // file is uploaded
                file.SaveAs(path);
                filefo = pathd;

                using (MemoryStream ms = new MemoryStream())
                {
                    file.InputStream.CopyTo(ms);
                    byte[] array = ms.GetBuffer();
                }
            }

            DataRow newrow = dsUser.Tables[0].Rows[0];

            newrow["ID"]        = USRID;
            newrow["USRNM"]     = txtUSRNM;
            newrow["FULNM"]     = txtFULNM;
            newrow["EMAIL"]     = txtEMAIL;
            newrow["PWD"]       = CryptionHelper.Encrypt(txtPWD, "tb");
            newrow["IS_ADMIN"]  = 1;
            newrow["IS_SYSADM"] = 0;
            newrow["IS_HR"]     = 0;
            newrow["CHNG_PWD"]  = 0;
            if (filefo == "")
            {
                //newrow["AVATAR"] = "~/images/avatar/nullavatar.jpg";
                newrow["AVATAR"] = newrow["AVATAR"];
            }
            else
            {
                newrow["AVATAR"] = filefo;
            }
            if (!Convert.ToBoolean(Session["IS_SYSADM"]))
            {
                newrow["CARDNO"]   = txtCARDNO;
                newrow["CVC"]      = txtCVC;
                newrow["STKDAY"]   = txtSTKDAY;
                newrow["STKMONTH"] = txtSTKMONTH;
            }
            //newrow["EDATE"] = DateTime.Now;
            //newrow["EUSRID"] = null;
            newrow["UDATE"] = DateTime.Now;
            //newrow["UUSRID"] = null;
            newrow["NOTE"] = "En Son Güncelleme İşlemi Gerçekleştirdi.";
            AgentGc data = new AgentGc();
            string  veri = data.DataModified("USR", newrow, dsUser.Tables[0]);

            //return Content("<script language='javascript' type='text/javascript'>alert('" + veri + "');</script>");
            //ViewBag.addmessageinfo = veri;
            return(Redirect("/Account/Manage"));
            //}
            //return Redirect("/Account/Manage");
        }