protected void btnKomentar_Click(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { user = (Data.EntityFramework.DAL.Users)Session["LoggedUser"]; int uid = temp.GetUserIDByName(user.UserName); if (!string.IsNullOrWhiteSpace(txtKomentar.Text)) { temp.SaveComment(txtKomentar.Text, uid, temp.GetUserBySpBr(txtSporazum.Text)); ResetFields(); } else ClientScript.RegisterStartupScript(this.GetType(), "Greška!", "alert('Žao mi je, ali ne možete upisati prazan komentar!');", true); } }
public bool SaveUser1(string u, string p) { int broj; broj = context.Users.Count(x => x.UserName == u); if (broj == 0) { Users temp = new Users(); temp.UserName = u; temp.Password = p; context.Users.AddObject(temp); context.SaveChanges(); return true; } else return false; }
public int GetUserIDByName(string uname) { Users user = new Users(); user = context.Users.Where(x => x.UserName == uname).SingleOrDefault(); return user.UserID; }
protected void Page_Load(object sender, EventArgs e) { using (PoslovniKlubBL temp = new PoslovniKlubBL()) { //MessageBox.Show(Request.QueryString["SporazumBroj"]); string SpBr = Request.QueryString["SporazumBroj"]; //int userid = temp.getKorBySp(SpBr); korisnici user = new korisnici(); user = temp.getKorBySp(SpBr); //user = temp.GetUser(userid); txtSporazum.Text = Request.QueryString["SporazumBroj"]; txtJMBG.Text = user.JMBG; txtPrezime.Text = user.Prezime; txtIme.Text = user.Ime; txtAdresa.Text = user.Adresa; int id = Convert.ToInt32(user.gradID); txtOpština.Text = temp.GetGradByID(id); txtMZ.Text = temp.GetMZByCode(user.mzCode); txtTelefon.Text = user.Telefon; txtTelefon2.Text = user.Telefon2; txtMobitel.Text = user.Mobitel; int fid = Convert.ToInt32(user.FilID); if(fid == 0) { txtFilijala.Text = ""; } else { txtFilijala.Text = temp.GetFilijalaByID(fid); } txtEmail.Text = user.email; txtKomunikacija.Text = user.KomunikPutem; } }
/// <summary> /// Create a new Users object. /// </summary> /// <param name="userID">Initial value of the UserID property.</param> /// <param name="userName">Initial value of the UserName property.</param> /// <param name="password">Initial value of the Password property.</param> public static Users CreateUsers(global::System.Int32 userID, global::System.String userName, global::System.String password) { Users users = new Users(); users.UserID = userID; users.UserName = userName; users.Password = password; return users; }
/// <summary> /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUsers(Users users) { base.AddObject("Users", users); }