Ejemplo n.º 1
0
        public ActionResult Edits(Sprzedawca spToEdit)
        {
            Response.AppendHeader("X-XSS-Protection", "0");
            try
            {

                var orgSp = (from m in _db.Sprzedawca
                                      where m.NrPracownika == spToEdit.NrPracownika
                                      select m).First();

                if (!ModelState.IsValid)
                    return View(orgSp);

                _db.ApplyPropertyChanges(orgSp.EntityKey.EntitySetName, spToEdit);
                _db.SaveChanges();

                return RedirectToAction("sales");

            }

            catch
            {

                return View();

            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Sprzedawca EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSprzedawca(Sprzedawca sprzedawca)
 {
     base.AddObject("Sprzedawca", sprzedawca);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Create a new Sprzedawca object.
 /// </summary>
 /// <param name="nrPracownika">Initial value of the NrPracownika property.</param>
 /// <param name="imie">Initial value of the Imie property.</param>
 /// <param name="nazwisko">Initial value of the Nazwisko property.</param>
 /// <param name="stanowisko">Initial value of the Stanowisko property.</param>
 /// <param name="nIP">Initial value of the NIP property.</param>
 /// <param name="login">Initial value of the Login property.</param>
 /// <param name="rola_w_systemie">Initial value of the Rola_w_systemie property.</param>
 public static Sprzedawca CreateSprzedawca(global::System.Decimal nrPracownika, global::System.String imie, global::System.String nazwisko, global::System.String stanowisko, global::System.String nIP, global::System.String login, global::System.String rola_w_systemie)
 {
     Sprzedawca sprzedawca = new Sprzedawca();
     sprzedawca.NrPracownika = nrPracownika;
     sprzedawca.Imie = imie;
     sprzedawca.Nazwisko = nazwisko;
     sprzedawca.Stanowisko = stanowisko;
     sprzedawca.NIP = nIP;
     sprzedawca.Login = login;
     sprzedawca.Rola_w_systemie = rola_w_systemie;
     return sprzedawca;
 }
Ejemplo n.º 4
0
        public ActionResult RegisterSp(string imie, string nazwisko, string stanowisko, string nip, string userName, string password, string confirmPassword, string email)
        {
            ViewData["PasswordLength"] = MembershipService.MinPasswordLength;
            Response.AppendHeader("X-XSS-Protection", "0");

            if (ValidateRegistration(userName, email, password, confirmPassword))
            {
                // Attempt to register the user
                MembershipCreateStatus createStatus = MembershipService.CreateUser(userName, password, email);

                if (createStatus == MembershipCreateStatus.Success)
                {
                    //dodanie go do roli sprzedqawcy
                    Roles.AddUserToRole(userName, "Sprzedawca");

                    //tworzenie nowego sprzedawcy
                    Sprzedawca sp = new Sprzedawca();
                    sp.Imie = imie;
                    sp.Nazwisko = nazwisko;
                    sp.Stanowisko = stanowisko;
                    sp.NIP = nip;
                    sp.Login = userName;
                    sp.Rola_w_systemie = "sp";

                    db.AddToSprzedawca(sp);
                    db.SaveChanges();

            //                    FormsAuth.SignIn(userName, false /* createPersistentCookie */);
                    return RedirectToAction("Index", "Admin");
                }
                else
                {
                    ModelState.AddModelError("_FORM", ErrorCodeToString(createStatus));
                }
            }

            // If we got this far, something failed, redisplay form
            return View();
        }