public ActionResult Profil(ProfilModel korisnikModel, HttpPostedFileBase file)
        {
            //return Redirect("hehe"+korisnikModel.Korisnik.id.ToString());
            string        constr = ConfigurationManager.ConnectionStrings["ConnectionStringName"].ConnectionString;
            SqlConnection sqlcon = new SqlConnection(constr);

            if (sqlcon.State == ConnectionState.Closed)
            {
                sqlcon.Open();
            }
            SqlCommand sqlcmd = new SqlCommand("dodajSliku", sqlcon);

            sqlcmd.CommandType = CommandType.StoredProcedure;
            sqlcmd.Parameters.AddWithValue("@id", Convert.ToInt32(korisnikModel.Korisnik.id));
            if (file != null && file.ContentLength > 0)
            {
                string imgpath = Path.Combine(Server.MapPath("~/Content/profilne/" + korisnikModel.Korisnik.id.ToString()) + Path.GetExtension(file.FileName));
                file.SaveAs(imgpath);
            }
            sqlcmd.Parameters.AddWithValue("@nova", "~/Content/profilne/" + korisnikModel.Korisnik.id.ToString() + Path.GetExtension(file.FileName));
            sqlcmd.ExecuteNonQuery();
            sqlcon.Close();
            korisnikModel.Korisnik.profilna = "~/Content/profilne/" + korisnikModel.Korisnik.id.ToString() + Path.GetExtension(file.FileName);

            //return View(korisnikModel);
            return(RedirectToAction("Profil/" + korisnikModel.Korisnik.id.ToString(), "Korisnik"));
        }
Exemple #2
0
        public ActionResult EditPhoto(ProfilModel pm, HttpPostedFileBase FilePicture)
        {
            DataContext ctx = new DataContext(ConfigurationManager.ConnectionStrings["Cnstr"].ConnectionString);

            if (FilePicture.ContentLength > 0 && FilePicture.ContentLength < 20000)
            {
                string extension = Path.GetExtension(FilePicture.FileName);
                if (valideImageType.Contains(extension))
                {
                    string destFolder = Path.Combine(Server.MapPath("~/images/Users"), SessionUtils.ConnectedUser.IdUser.ToString());
                    if (!Directory.Exists(destFolder))
                    {
                        Directory.CreateDirectory(destFolder);
                    }


                    FilePicture.SaveAs(Path.Combine(destFolder, FilePicture.FileName));


                    SessionUtils.ConnectedUser.Photo = FilePicture.FileName;
                    ctx.EditUserProfilePhoto(SessionUtils.ConnectedUser);
                    return(RedirectToAction("MyProfile", "Home"));
                }
            }
            return(View(SessionUtils.ConnectedUser));
        }
        public ActionResult OfferedProducts(ProfilModel pm)
        {
            DataContext ctx = new DataContext(ConfigurationManager.ConnectionStrings["Cnstr"].ConnectionString);

            pm = SessionUtils.ConnectedUser;
            return(View(ctx.GetProductsFromMembre(pm)));
            //return View(new DonateProductModel());
        }
Exemple #4
0
        public bool EditUserProfilePhoto(ProfilModel pm)
        {
            UtilisateurEntity ue = new UtilisateurEntity();

            ue.IdUtilisateur = pm.IdUser;
            ue.Photo         = pm.Photo;

            return(((UtilisateurRepository)_utilisateurRepo).UpdatePhoto(ue));
        }
Exemple #5
0
        public ActionResult Profil()
        {
            if (this.Session["UserId"] != null && this.Session["Username"] != null)
            {
                ProfilModel model = new ProfilModel(Convert.ToInt32(this.Session["UserId"]));

                return(View(model));
            }
            else
            {
                return(View("Prijava"));
            }
        }
Exemple #6
0
        public ActionResult Profil(string UserEmail)
        {
            var Model = new ProfilModel();
            var User  = Context.Users.Where(x => x.Email.Equals(UserEmail)).FirstOrDefault();

            if (User != null)
            {
                Model.UserMail    = User.Email;
                Model.UserName    = User.Name;
                Model.UserSurname = User.Surname;
            }
            return(View(Model));
        }
Exemple #7
0
        // GET: Profil
        public ActionResult Index()
        {
            ProfilModel profil = new ProfilModel();

            profil.Kullanici = KULLANICI.GetKullanici();
            getBireyselUye();
            setIlIlceList();
            ViewData["SayfaBaslik"] = "PROFİL";
            MenuModel menu = getMenu(KULLANICI.GetKullanici());

            ViewBag.Menu = menu.MenuList;
            ViewBag.Menu = menu.MenuList;
            return(View(profil));
        }
Exemple #8
0
        public ActionResult ProfilEdit()
        {
            int id   = base.CurrentUserId();
            var user = db.Members.Where(w => w.Id == id).FirstOrDefault();

            if (user == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            ProfilModel model = new ProfilModel()
            {
                Members = user
            };

            return(View(model));
        }
Exemple #9
0
        public bool InsertProduct(ProfilModel pf)
        {
            DonateProductEntity dpe = new DonateProductEntity();

            dpe.IdUtilisateur  = pf.IdUser;
            dpe.IdAdresse      = pf.IdAdresse;
            dpe.Quantite       = pf.DonateProduct.Quantite;
            dpe.IdType         = pf.DonateProduct.IdType;
            dpe.NameProduct    = pf.DonateProduct.Nom;
            dpe.Bio            = pf.DonateProduct.Bio;
            dpe.DatePeremption = pf.DonateProduct.DatePeremption;
            dpe.Description    = pf.DonateProduct.Description;
            dpe.LabelEtat      = pf.DonateProduct.Etat;
            dpe.Pays           = pf.DonateProduct.Pays;
            dpe.NomMarque      = pf.DonateProduct.Marque;


            return(_donateProductRepo.Insert(dpe));
        }
Exemple #10
0
        public ActionResult ProfilGuncelle(ProfilModel _UyeModel)
        {
            DbBaglanti dbBaglanti = new DbBaglanti();
            DataTable  dtResult   = dbBaglanti.DataTableGetir("UYE_GUNCELLE " + KULLANICI.GetKullanici().UYE_ID + ",'" + _UyeModel.BireyselUye.AD + "','" + _UyeModel.BireyselUye.SOYAD + "','"
                                                              + _UyeModel.BireyselUye.CINSIYET + "','" + _UyeModel.BireyselUye.TEL_NO + "'," + "'" + _UyeModel.BireyselUye.EMAIL + "','" +
                                                              _UyeModel.BireyselUye.ADRES + "','" + _UyeModel.BireyselUye.IL_ID + "','" + _UyeModel.BireyselUye.ILCE_ID + "','" +
                                                              _UyeModel.Kullanici.KULLANICI_ADI + "','" + _UyeModel.Kullanici.SIFRE + "'");

            if (dtResult.Rows[0]["RESULT"].ToString() == "KAYIT BAŞARILI")
            {
                ViewData["result"] = dtResult.Rows[0]["RESULT"].ToString();
                return(View("Index"));
            }
            else
            {
                ViewData["result"] = dtResult.Rows[0]["RESULT"].ToString();
                return(View("UyeKayit"));
            }
        }
        //public ActionResult Notification(Notification notification)
        //{

        //    TakimOmruDBEntities db = new TakimOmruDBEntities();


        //    var altkategori = from s in db.SubPiece
        //                      join dt in db.Detail on s.SubPieceID equals dt.FKSubPieceID

        //                      select new
        //                      {
        //                          SubPieceId = s.SubPieceID,
        //                          SubPieceName = s.SubPieceName,
        //                          ToolLife = s.ToolLife,
        //                          PieceID = s.FKPieceID,
        //                          PieceCount = dt.PieceCount,
        //                          CreatedDate = dt.CreatedDate.Value.ToString("dd'/'MM'/'yyyy hh:mm")

        //                      };
        //    var data = altkategori.GroupBy(x => x.SubPieceId).Select(x => new
        //    {
        //        SubPieceId = x.First().SubPieceId,
        //        SubPieceName = x.First().SubPieceName,
        //        ToolLife = x.First().ToolLife,
        //        PieceID = x.First().PieceID,
        //        PieceCount = x.Sum(y => y.PieceCount),
        //        CreatedDate = x.First().CreatedDate
        //    }).Where(x => (x.PieceCount) > (x.ToolLife * 2) / 3);

        //    if (data != null)
        //    {
        //        db.Notification.Add(new Notification
        //        {
        //            Notification_Description = data.Select(x => x.SubPieceName) + "Parçasının ömrü tükenmek üzere",
        //            Notification_Date = DateTime.Now
        //        });
        //    }

        //    return Json(data);

        //}



        //public ActionResult Detay(int id)
        //{

        //    TakimOmruDBEntities db = new TakimOmruDBEntities();


        //    var altkategori = from s in db.SubPiece
        //                      join dt in db.Detail on s.SubPieceID equals dt.FKSubPieceID
        //                      where dt.FKSubPieceID==id
        //                      select new
        //                      {
        //                          SubPieceId = s.SubPieceID,
        //                          SubPieceName = s.SubPieceName,
        //                          PieceCount = dt.PieceCount,
        //                          CreatedDate = dt.CreatedDate

        //                      };
        //    return Json(
        //        new
        //        {
        //            data = from obj in altkategori
        //                   select new
        //                   {
        //                       SubPieceId = obj.SubPieceId,
        //                       SubPieceName = obj.SubPieceName,
        //                       PieceCount = obj.PieceCount,
        //                       CreatedDate = obj.CreatedDate
        //                   }
        //        }, JsonRequestBehavior.AllowGet);

        //}

        //public ActionResult AltKategoriTime()
        //{

        //    TakimOmruDBEntities db = new TakimOmruDBEntities();


        //    var altkategori = from s in db.SubPiece
        //                      join dt in db.Detail on s.SubPieceID equals dt.FKSubPieceID
        //                      where s.Type == true
        //                      select new
        //                      {
        //                          SubPieceId = s.SubPieceID,
        //                          SubPieceName = s.SubPieceName,
        //                          ToolLife = s.ToolLife,
        //                          PieceID = s.FKPieceID,
        //                          PieceCount = dt.PieceCount,
        //                          CreatedDate = dt.CreatedDate

        //                      };
        //    return Json(
        //        new
        //        {
        //            data = from obj in altkategori
        //                   select new
        //                   {
        //                       SubPieceId = obj.SubPieceId,
        //                       SubPieceName = obj.SubPieceName,
        //                       ToolLife = obj.ToolLife,
        //                       PieceID = obj.PieceID,
        //                       PieceCount = obj.PieceCount,
        //                       CreatedDate = obj.CreatedDate
        //                   }
        //        }, JsonRequestBehavior.AllowGet);

        //}
        //public ActionResult InsertPiece([FromBody]Piece piece)
        //{

        //    using (var client = new HttpClient())
        //    {
        //        client.BaseAddress = new Uri("https://x1mrph0du3.execute-api.eu-west-2.amazonaws.com/Prod/");
        //        client.DefaultRequestHeaders.Accept.Clear();
        //        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        //        HttpResponseMessage response = client.PostAsJsonAsync("api/prod/parcaekle", piece).Result;
        //        if (response.IsSuccessStatusCode)
        //        {
        //            return RedirectToAction("ParcaEkle");
        //        }
        //        return null;
        //    }
        //}
        public ActionResult Note()
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Login"));
            }
            TakimOmruDBEntities db = new TakimOmruDBEntities();

            ViewBag.UserID = Session["UserID"];

            ViewBag.Company = Session["Company"];
            ViewBag.Logo    = Session["Logo"];
            ViewBag.Name    = Session["FirstName"];
            int         UserId = Convert.ToInt32(Session["UserID"]);
            ProfilModel pm     = new ProfilModel();

            pm.users = db.User.Where(x => x.UserID == UserId).ToList();
            pm.notes = db.Notes.ToList();
            return(View(pm));
        }
Exemple #12
0
        public List <DonateProductModel> GetProductsFromMembre(ProfilModel pm)
        {
            List <DonateProductModel>        dpm            = new List <DonateProductModel>();
            List <GetSixLatestPrductsEntity> productsMembre = ((GetSixLatestProductsRepository)_getSixRepo).GetAllProductsFromMembre(pm.IdUser);

            foreach (GetSixLatestPrductsEntity prod in productsMembre)
            {
                DonateProductModel dp = new DonateProductModel();
                dp.Nom             = prod.NomProduit;
                dp.Description     = prod.Description;
                dp.DateProposition = prod.DateProposition;
                dp.Bio             = prod.Bio;
                dp.Quantite        = prod.Quantite;
                dp.Type            = prod.Type;
                dp.DateProposition = prod.DatePeremption;
                dp.Marque          = prod.Marque;

                dpm.Add(dp);
            }
            return(dpm);
        }
Exemple #13
0
        public string GetProfil(int uid)
        {
            ApiResponse response = new ApiResponse();

            using (var db = new ggwpDBEntities())
            {
                ProfilModel model = new ProfilModel(uid);

                if (model != null)
                {
                    response.code    = "200";
                    response.payload = model;
                }
                else
                {
                    response.code    = "404";
                    response.payload = null;
                }
            }

            return(JsonConvert.SerializeObject(response));
        }
Exemple #14
0
        public ActionResult ProfilEdit(ProfilModel model)
        {
            string message = string.Empty;

            try
            {
                int id           = base.CurrentUserId();
                var updateMember = db.Members.Where(w => w.Id == id).FirstOrDefault();
                updateMember.ModifiedDate = DateTime.Now;
                updateMember.Name         = model.Members.Name;
                updateMember.Surname      = model.Members.Surname;
                updateMember.Bio          = model.Members.Bio;

                if (string.IsNullOrEmpty(model.Members.Password) == false)
                {
                    updateMember.Password = model.Members.Password;
                }
                if (Request.Files != null && Request.Files.Count > 0)
                {
                    var file     = Request.Files[0];
                    var folder   = Server.MapPath("/Content/Images/uploads");
                    var fileName = Guid.NewGuid() + ".jpg";
                    file.SaveAs(Path.Combine(folder, fileName));

                    var filePath = "/Content/Images/uploads/" + fileName;
                    updateMember.ProfileImageName = filePath;
                }
                //db.Entry(updateMember).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", "Home"));
            }
            catch (Exception ex)
            {
                message         = ex.Message;
                ViewBag.myError = message;
                return(View());
            }
        }
        public ActionResult MyAccount(LoginModel lm)
        {
            DataContext ctx = new DataContext(ConfigurationManager.ConnectionStrings["Cnstr"].ConnectionString);

            if (ModelState.IsValid)
            {
                ProfilModel pf = ctx.UserAuth(lm);
                if (pf == null)
                {
                    ViewBag.Error = "Erreur Login/Password";
                    return(View());
                }
                else
                {
                    SessionUtils.IsLogged      = true;
                    SessionUtils.ConnectedUser = pf;
                    return(RedirectToAction("MyProfile", "Home", new { area = "Member" }));
                }
            }
            else
            {
                return(View());
            }
        }
        public ActionResult Profil(int id = 0)
        {
            List <Adress> addresses = null;
            var           member    = (Member)Session["LogonUser"];

            if (id != 0)
            {
                //id = member.ID;
                addresses = db.Adresses.Where(x => x.MemberId == id).ToList();
            }
            var user = db.Members.Where(x => x.ID == id).FirstOrDefault();

            if (user == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            ProfilModel model = new ProfilModel()
            {
                member = user,
                adress = addresses
            };

            return(View(model));
        }
        public ActionResult Profil(int id)
        {
            Korisnik       korisnikModel = new Korisnik();
            List <dojmovi> listaDojmova  = new List <dojmovi>();
            List <rute>    listaRuta     = new List <rute>();

            string        constr = ConfigurationManager.ConnectionStrings["ConnectionStringName"].ConnectionString;
            SqlConnection sqlcon = new SqlConnection(constr);

            if (sqlcon.State == ConnectionState.Closed)
            {
                sqlcon.Open();
            }
            SqlCommand    sqlcmd = new SqlCommand("getPodaciKorisnika", sqlcon);
            SqlDataReader reader;

            sqlcmd.CommandType = CommandType.StoredProcedure;
            sqlcmd.Parameters.AddWithValue("@id", id);
            reader = sqlcmd.ExecuteReader();

            while (reader.Read())
            {
                korisnikModel.id       = reader.GetInt32(0);
                korisnikModel.ime      = reader.GetString(1);
                korisnikModel.prezime  = reader.GetString(2);
                korisnikModel.email    = reader.GetString(3);
                korisnikModel.profilna = reader.GetString(7);
                if (!reader.IsDBNull(8))
                {
                    korisnikModel.mjestoStanovanja = reader.GetString(8);
                }
                if (!reader.IsDBNull(9))
                {
                    korisnikModel.brojTelefona = reader.GetString(9);
                }
            }
            reader.Close();

            sqlcmd             = new SqlCommand("selectRute", sqlcon);
            sqlcmd.CommandType = CommandType.StoredProcedure;
            sqlcmd.Parameters.AddWithValue("@id", id);
            reader = sqlcmd.ExecuteReader();

            while (reader.Read())
            {
                rute ruteModel = new rute();
                ruteModel.idRute        = reader.GetInt32(0);
                ruteModel.polaziste     = reader.GetString(2);
                ruteModel.odrediste     = reader.GetString(3);
                ruteModel.datum         = reader.GetDateTime(4);
                ruteModel.vrijeme       = reader.GetTimeSpan(5);
                ruteModel.drzava        = reader.GetString(6);
                ruteModel.nacinPlacanja = reader.GetString(7);
                listaRuta.Add(ruteModel);
            }
            reader.Close();

            sqlcmd             = new SqlCommand("selectDojmove", sqlcon);
            sqlcmd.CommandType = CommandType.StoredProcedure;
            sqlcmd.Parameters.AddWithValue("@id", korisnikModel.id);
            reader = sqlcmd.ExecuteReader();
            while (reader.Read())
            {
                dojmovi dojamModel = new dojmovi();
                dojamModel.idPosiljaoca = reader.GetInt32(1);
                dojamModel.idPrimaoca   = reader.GetInt32(2);
                dojamModel.dojam        = reader.GetString(3);
                //reader.Close();
                SqlCommand    sqlcmd2 = new SqlCommand("getPodaciKorisnika", sqlcon);
                SqlDataReader reader2;
                sqlcmd2.CommandType = CommandType.StoredProcedure;
                sqlcmd2.Parameters.AddWithValue("@id", reader.GetInt32(1));
                reader2 = sqlcmd2.ExecuteReader();

                while (reader2.Read())
                {
                    dojamModel.imePosiljaoca      = reader2.GetString(1);
                    dojamModel.profilnaPosiljaoca = reader2.GetString(7);
                }
                reader2.Close();
                listaDojmova.Add(dojamModel);
            }
            sqlcon.Close();

            ProfilModel profilModel = new ProfilModel();
            dojmovi     Dojam       = new dojmovi();

            profilModel.Dojam        = Dojam;
            profilModel.Korisnik     = korisnikModel;
            profilModel.ListaDojmova = listaDojmova;
            profilModel.ListaRuta    = listaRuta;
            return(View(profilModel));
        }