protected void grdList_RowUpdating(object sender, GridViewUpdateEventArgs e) { Label id = (Label)grdList.Rows[e.RowIndex].FindControl("lblUserID"); TextBox name = (TextBox)grdList.Rows[e.RowIndex].FindControl("txtName"); TextBox surname = (TextBox)grdList.Rows[e.RowIndex].FindControl("txtSurname"); TextBox emailaddress = (TextBox)grdList.Rows[e.RowIndex].FindControl("txtEMailAddress"); TextBox phone = (TextBox)grdList.Rows[e.RowIndex].FindControl("txtPhone"); TextBox address = (TextBox)grdList.Rows[e.RowIndex].FindControl("txtAddress"); TextBox city = (TextBox)grdList.Rows[e.RowIndex].FindControl("txtCity"); TextBox password = (TextBox)grdList.Rows[e.RowIndex].FindControl("txtPassword"); semantıcEntities db = new semantıcEntities(); int id1 = Convert.ToInt32(id.Text); USER m = (from x in db.USER where x.UserID == id1 && x.IsActive == true select x).SingleOrDefault(); m.Name = name.Text; m.Surname = surname.Text; m.Email = emailaddress.Text; m.Phone = phone.Text; m.Address = address.Text; m.City = city.Text; m.Password = password.Text; db.SaveChanges(); USER[] m1 = (from x in db.USER where x.IsActive == true select x).ToArray(); grdList.DataSource = m1; grdList.DataBind(); }
public bool funcRegister(string Name, string Surname, string City, string Phone, string Email, string Address, string Password) { bool boolCheck = false; using (semantıcEntities Bitirme = new semantıcEntities()) { USER UserCheck = (from info in Bitirme.USER where info.Email == Email select info).SingleOrDefault(); if (UserCheck != null) { boolCheck = false; } else { USER UserNew = new USER(); UserNew.Name = Name; UserNew.Surname = Surname; UserNew.City = City; UserNew.Phone = Phone; UserNew.Email = Email; UserNew.Address = Address; UserNew.Password = Password; UserNew.IsActive = Convert.ToBoolean("True"); Bitirme.USER.Add(UserNew); Bitirme.SaveChanges(); boolCheck = true; } } return(boolCheck); }
protected void btnLogin_Click(object sender, EventArgs e) { if (cbRememberMe.Checked) { Response.Cookies["Email"].Value = txtUsername.Text; Response.Cookies["Email"].Expires = DateTime.Now.AddDays(30); Response.Cookies["Password"].Value = txtPassword.Text; Response.Cookies["Password"].Expires = DateTime.Now.AddDays(30); } if (string.IsNullOrEmpty(txtUsername.Text) || string.IsNullOrEmpty(txtPassword.Text)) { lblMessage.Visible = true; lblMessage.Text = "Please fill all necessary fields!"; } else { string email = txtUsername.Text; string password = txtPassword.Text; semantıcEntities db = new semantıcEntities(); USER u = (from x in db.USER where x.Email == email && x.Password == password && x.IsActive == true select x).SingleOrDefault(); admın a = (from x in db.admın where x.Email == email && x.Password == password && x.IsActive == true select x).SingleOrDefault(); if (u == null && a == null) { lblMessage.Visible = true; lblMessage.Text = "Please check your information!"; } if (u != null) { Session["User"] = u; Response.Redirect("UserHomepage.aspx"); } else { lblMessage.Visible = true; lblMessage.Text = "Please check your information!"; } if (a != null) { Session["Admin"] = a; Response.Redirect("AdminHomepage.aspx"); } else { lblMessage.Visible = true; lblMessage.Text = "Please check your information!"; } } }
protected void grdList_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { grdList.EditIndex = -1; semantıcEntities db = new semantıcEntities(); USER[] m = (from x in db.USER where x.IsActive == true select x).ToArray(); grdList.DataSource = m; grdList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { semantıcEntities db = new semantıcEntities(); DATASET[] dataSetList = (from x in db.DATASET where x.IsActive == true select x).ToArray(); GridView1.DataSource = dataSetList; GridView1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { semantıcEntities db = new semantıcEntities(); USER [] listOfUsers = (from x in db.USER where x.IsActive == true select x).ToArray(); grdList.DataSource = listOfUsers; grdList.DataBind(); } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { GridView2.Visible = true; string secilenDeger = e.CommandName; semantıcEntities db = new semantıcEntities(); DATASET ds = (from x in db.DATASET where x.Name == secilenDeger && x.IsActive == true select x).SingleOrDefault(); CLUSTER[] clusterList = (from x in db.CLUSTER where x.DataSetID == ds.DatasetID select x).ToArray(); GridView2.DataSource = clusterList; GridView2.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { semantıcEntities db = new semantıcEntities(); DATASET[] dataSetList = (from x in db.DATASET where x.IsActive == true select x).ToArray(); for (int i = 0; i < dataSetList.Length; i++) { listSol.Items.Add(dataSetList[i].Name); } } }
protected void listSol_SelectedIndexChanged(object sender, EventArgs e) { listOrta.Items.Clear(); listOrta.Visible = true; semantıcEntities db = new semantıcEntities(); DATASET ds = (from x in db.DATASET where x.Name == listSol.SelectedItem.Value && x.IsActive == true select x).SingleOrDefault(); CLUSTER[] clusterList = (from x in db.CLUSTER where x.DataSetID == ds.DatasetID select x).ToArray(); for (int i = 0; i < clusterList.Length; i++) { listOrta.Items.Add(clusterList[i].Name); } }
protected void grdList_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridViewRow row = (GridViewRow)grdList.Rows[e.RowIndex]; Label lbldeleteid = (Label)row.FindControl("lblID"); semantıcEntities db = new semantıcEntities(); int id = Convert.ToInt32(lbldeleteid.Text); USER m = (from x in db.USER where x.UserID == id && x.IsActive == true select x).SingleOrDefault(); m.IsActive = false; db.SaveChanges(); USER[] m1 = (from x in db.USER where x.IsActive == true select x).ToArray(); grdList.DataSource = m1; grdList.DataBind(); }
protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e) { GridView3.Visible = true; string secilenDeger = e.CommandName; semantıcEntities db = new semantıcEntities(); CLUSTER ds = (from x in db.CLUSTER where x.Name == secilenDeger select x).SingleOrDefault(); // DOCUMENT[] documentList = (from x in db.DOCUMENT where x.ClusterID == ds.ClusterID select x).ToArray(); FILE[] fileList = (from x in db.FILE where x.DocumentID == ds.ClusterID select x).ToArray(); GridView3.DataSource = fileList; GridView3.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { USER gelenUser = (USER)Session["User"]; lblMessage.Visible = true; lblMessage.Text = "Merhaba " + gelenUser.Name + " " + gelenUser.Surname; if (!IsPostBack) { semantıcEntities db = new semantıcEntities(); DATASET[] dataSetList = (from x in db.DATASET where x.IsActive == true select x).ToArray(); for (int i = 0; i < dataSetList.Length; i++) { TreeNode t = new TreeNode(); t.Text = dataSetList[i].Name; int dataSetid = dataSetList[i].DatasetID; CLUSTER[] clusterList = (from x in db.CLUSTER where x.DataSetID == dataSetid select x).ToArray(); for (int j = 0; j < clusterList.Length; j++) { TreeNode c = new TreeNode(); c.Text = clusterList[j].Name; int clusterId = clusterList[j].ClusterID; DOCUMENT[] documentList = (from x in db.DOCUMENT where x.ClusterID == clusterId select x).ToArray(); for (int k = 0; k < documentList.Length; k++) { TreeNode d = new TreeNode(); d.Text = documentList[k].Name; c.ChildNodes.Add(d); } t.ChildNodes.Add(c); } treeList.Nodes.Add(t); } } }
public USER funcLoginCheck(string Email, string Password) { USER returnUserInfo = new USER(); using (semantıcEntities Bitirme = new semantıcEntities()) { string strPasswordHash = HashPassword(Password); USER customerCheck = (from info in Bitirme.USER where info.Email == Email select info).SingleOrDefault(); if (!VerifyPassword(Password, customerCheck.Password)) { returnUserInfo = null; } else { returnUserInfo = customerCheck; } } return(returnUserInfo); }
protected void Button1_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(TextBox1.Text) || String.IsNullOrEmpty(FileUpload1.FileName)) { //uyarı ver } else { semantıcEntities db = new semantıcEntities(); DATASET d = new DATASET(); d.IsActive = true; d.Name = TextBox1.Text; //d.URL = Server.MapPath() /* * fuImage.SaveAs(Server.MapPath("~/Dataset/" + fuImage.FileName)); * d.URL = (Server.MapPath("~/Dataset/" + fuImage.FileName)); */ db.DATASET.Add(d); db.SaveChanges(); } }