コード例 #1
0
        public IHttpActionResult PutKatilimci(int id, Katilimci katilimci)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != katilimci.ID)
            {
                return(BadRequest());
            }

            db.Entry(katilimci).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!KatilimciExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public ActionResult Edit(int?id)  //Edit Get
        {
            #region  Toplanti Doldurma
            List <SelectListItem> IcerikTurListe =
                (from k in db.Toplantilar
                 select new SelectListItem
            {
                Text = k.Konu,
                Value = k.ID.ToString()
            }).ToList();



            ViewBag.Liste = IcerikTurListe;


            #endregion

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Katilimci tp = db.Katilimcilar.Find(id);
            if (tp == null)
            {
                return(HttpNotFound());
            }

            return(View(tp));
        }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Katilimci kt = db.Katilimcilar.Find(id);

            db.Katilimcilar.Remove(kt);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
        public ActionResult CreateDavet()
        {
            var form = Request.Form;

            var  TopId     = form["toplantiId"];
            var  mail      = form["mail"];
            var  konusmaci = form["konusmaciMi"];
            int  toplantiId;
            bool konusmaciMi;

            try
            {
                toplantiId  = Convert.ToInt32(TopId);
                konusmaciMi = konusmaci == null ? false : true;
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index"));
            }


            if (db.Toplantilar.Find(toplantiId) == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var toplanti = db.Toplantilar.Find(toplantiId);

            if (User.Identity.GetUserId() != toplanti.YoneticiID)
            {
                return(RedirectToAction("Index"));
            }

            var davetli = userManager.FindByEmail(mail);

            if (davetli == null)
            {
                return(RedirectToAction("yonet", new { id = toplantiId, err = "Kullanıcı bulunamadı, Link oluşturup kullanabilirsiniz" }));
            }

            if (konusmaciMi && db.Katilimcilar.Where(x => x.ToplantiID == toplanti.ID && x.Izin == Izin.Konusmaci).Count() >= 3)
            {
                return(RedirectToAction("yonet", new { id = toplantiId, err = "En çok 3 konuşmacı ekleyebilirsiniz ." }));
            }

            if (db.Katilimcilar.Where(x => x.ToplantiID == toplanti.ID && x.ApplicationUserID == davetli.Id).Count() > 0)
            {
                return(RedirectToAction("yonet", new { id = toplantiId, err = "Kullanıcı zaten var ." }));
            }

            var davet = new Katilimci {
                Izin = konusmaciMi ? Izin.Konusmaci : Izin.Dinleyici, ToplantiID = toplanti.ID, ApplicationUserID = davetli.Id
            };

            db.Katilimcilar.Add(davet);
            db.SaveChanges();

            return(RedirectToAction("Yonet", new { id = toplantiId }));
        }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "ID,Ad,Soyad,ToplantiID")] Katilimci kt)
 {
     if (ModelState.IsValid)
     {
         db.Entry(kt).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(kt));
 }
コード例 #6
0
 public ActionResult Create([Bind(Include = "ID,Ad,Soyad,ToplantiID")] Katilimci kt)
 {
     if (ModelState.IsValid)
     {
         db.Katilimcilar.Add(kt);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(kt));
 }
コード例 #7
0
        public void KatilimciSil(Katilimci katilimci)
        {
            if (katilimci == null)
            {
                throw new ArgumentNullException("katilimci");
            }

            _katilimciDepo.Sil(katilimci);
            _önbellekYönetici.KalıpİleSil(KATİLİMCİ_PATTERN_KEY);
            _olayYayınlayıcı.OlaySilindi(katilimci);
        }
コード例 #8
0
        public IHttpActionResult GetKatilimci(int id)
        {
            Katilimci katilimci = db.Katilimcilar.Find(id);

            if (katilimci == null)
            {
                return(NotFound());
            }

            return(Ok(katilimci));
        }
コード例 #9
0
        public IHttpActionResult PostKatilimci(Katilimci katilimci)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Katilimcilar.Add(katilimci);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = katilimci.ID }, katilimci));
        }
コード例 #10
0
        public IHttpActionResult DeleteKatilimci(int id)
        {
            Katilimci katilimci = db.Katilimcilar.Find(id);

            if (katilimci == null)
            {
                return(NotFound());
            }

            db.Katilimcilar.Remove(katilimci);
            db.SaveChanges();

            return(Ok(katilimci));
        }
コード例 #11
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Katilimci kt = db.Katilimcilar.Find(id);

            if (kt == null)
            {
                return(HttpNotFound());
            }

            return(View(kt));
        }
コード例 #12
0
ファイル: KatılımcıHub.cs プロジェクト: emrahshn/Provent
 public void Destroy(Katilimci katilimci)
 {
     _katilimciServisi.KatilimciSil(katilimci);
 }
コード例 #13
0
ファイル: XlsController.cs プロジェクト: emrahshn/Provent
        public virtual ActionResult AsyncUpload()
        {
            Stream        stream      = null;
            var           fileName    = "";
            var           contentType = "";
            List <string> data        = new List <string>();
            DataTable     dt          = new DataTable();

            if (String.IsNullOrEmpty(Request["qqfile"]))
            {
                // IE
                HttpPostedFileBase httpPostedFile = Request.Files[0];
                if (httpPostedFile == null)
                {
                    throw new ArgumentException("No file uploaded");
                }
                stream      = httpPostedFile.InputStream;
                fileName    = Path.GetFileName(httpPostedFile.FileName);
                contentType = httpPostedFile.ContentType;
                if (contentType == "application/vnd.ms-excel" || contentType == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
                {
                    string filename   = httpPostedFile.FileName;
                    string targetpath = Server.MapPath("~/Doc/");
                    httpPostedFile.SaveAs(targetpath + filename);
                    string pathToExcelFile = targetpath + filename;
                    using (SpreadsheetDocument doc = SpreadsheetDocument.Open(pathToExcelFile, false))
                    {
                        Sheet             sheet     = doc.WorkbookPart.Workbook.Sheets.GetFirstChild <Sheet>();
                        Worksheet         worksheet = (doc.WorkbookPart.GetPartById(sheet.Id.Value) as WorksheetPart).Worksheet;
                        IEnumerable <Row> rows      = worksheet.GetFirstChild <SheetData>().Descendants <Row>();
                        // DataTable dt = new DataTable();
                        uint referans = 1;
                        int  cnt      = 0;
                        foreach (Row row in rows)
                        {
                            foreach (Cell cell in row.Descendants <Cell>())
                            {
                                string val = GetValue(doc, cell);
                                val = val.ToLower();
                                val = val.Replace(" ", String.Empty);
                                if (val != "isim" && val != "ad" && val != "adı")
                                {
                                    continue;
                                }
                                else
                                {
                                    referans = row.RowIndex.Value;
                                }
                            }
                        }

                        foreach (Row row in rows)
                        {
                            if (row.RowIndex.Value == referans)
                            {
                                foreach (Cell cell in row.Descendants <Cell>())
                                {
                                    dt.Columns.Add(GetValue(doc, cell));
                                }
                            }
                            else
                            {
                                //Add rows to DataTable.
                                if (dt.Columns.Count > 0)
                                {
                                    dt.Rows.Add();
                                    int i = 0;
                                    foreach (Cell cell in row.Descendants <Cell>())
                                    {
                                        dt.Rows[dt.Rows.Count - 1][i] = GetValue(doc, cell);
                                        i++;
                                    }
                                }
                            }
                        }
                    }

                    /*
                     * if ((System.IO.File.Exists(pathToExcelFile)))
                     * {
                     *  System.IO.File.Delete(pathToExcelFile);
                     * }
                     * return Json("success", JsonRequestBehavior.AllowGet);
                     */
                }
                else
                {
                }
            }
            else
            {
                //Webkit, Mozilla
                stream   = Request.InputStream;
                fileName = Request["qqfile"];
            }

            var fileBinary = new byte[stream.Length];

            stream.Read(fileBinary, 0, fileBinary.Length);

            var fileExtension = Path.GetExtension(fileName);

            if (!String.IsNullOrEmpty(fileExtension))
            {
                fileExtension = fileExtension.ToLowerInvariant();
            }
            if (String.IsNullOrEmpty(contentType))
            {
                switch (fileExtension)
                {
                case ".xlsx":
                    contentType = MimeTipleri.TextXlsx;
                    break;

                case ".xls":
                default:
                    break;
                }
            }
            var xls = _xlsService.XlsEkle(fileBinary, contentType, null);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                #region sponsorlar
                string kayitspo   = dt.Rows[i][12].ToString();
                string koankspo   = dt.Rows[i][27].ToString();
                string trasnspo   = dt.Rows[i][41].ToString();
                int    kayitspoId = 0;
                int    konakspoId = 0;
                int    transspoId = 0;
                if (kayitspo == "DERNEK")
                {
                    kayitspoId = -1;
                }
                if (kayitspo == "MÜNFERİT")
                {
                    kayitspoId = -2;
                }
                foreach (var m in _musteriServisi.TümFirmaAl())
                {
                    if (m.Adı == kayitspo)
                    {
                        kayitspoId = m.Id;
                    }
                    if (m.Adı == koankspo)
                    {
                        konakspoId = m.Id;
                    }
                    if (m.Adı == kayitspo)
                    {
                        transspoId = m.Id;
                    }
                }
                #endregion
                #region kayit
                int    kayittipiId = 0;
                string kayittipi   = dt.Rows[i][14].ToString();
                foreach (var m in _kayitServisi.TümKayitAl())
                {
                    if (m.KayıtTipi == kayittipi.Trim() && dt.Rows[i][13].ToString().Trim() == m.KayıtUcreti)
                    {
                        kayittipiId = m.Id;
                    }
                    if (kayitspoId == -1 && (dt.Rows[i][13].ToString().Trim() == "0" || dt.Rows[i][13].ToString().Trim() == ""))
                    {
                        kayittipiId = 27;
                    }
                }
                #endregion
                #region konaklama
                int    refakatci       = 0;
                int    konaklamatipiId = 0;
                string konaklamatipi   = dt.Rows[i][31].ToString();
                string konaklamabedeli = dt.Rows[i][32].ToString();
                int    kontenjan       = 1;
                if (konaklamatipi.Trim() == "DBL")
                {
                    kontenjan = 2;
                }
                if (konaklamatipi.Trim() == "1")
                {
                    kontenjan = 0;
                    refakatci = 1;
                }

                foreach (var m in _konaklamaServisi.TümKonaklamaAl())
                {
                    if (m.OtelKontenjanı == kontenjan && konaklamabedeli.Trim() == m.OtelUcreti)
                    {
                        konaklamatipiId = m.Id;
                    }
                }
                string gTarihi = String.IsNullOrEmpty(dt.Rows[i][29].ToString()) ? DateTime.Now.ToShortTimeString() : DateTime.FromOADate(Convert.ToDouble(dt.Rows[i][29])).ToShortDateString();
                string cTarihi = String.IsNullOrEmpty(dt.Rows[i][30].ToString()) ? DateTime.Now.ToShortTimeString() : DateTime.FromOADate(Convert.ToDouble(dt.Rows[i][30])).ToShortDateString();
                #endregion

                Katilimci k = new Katilimci
                {
                    KongreId           = 19,
                    Email              = dt.Rows[i][6].ToString(),
                    Tel                = dt.Rows[i][7].ToString(),
                    TCKN               = dt.Rows[i][8].ToString(),
                    Adı                = dt.Rows[i][9].ToString(),
                    Soyadı             = dt.Rows[i][10].ToString(),
                    OtelGiris          = Convert.ToDateTime(gTarihi),
                    OtelCikis          = Convert.ToDateTime(cTarihi),
                    UlasimVarisTarihi  = Convert.ToDateTime(gTarihi),
                    UlasimKalkisTarihi = Convert.ToDateTime(gTarihi),
                    TransferTarihi     = Convert.ToDateTime(gTarihi),
                    KayıtSponsorId     = kayitspoId,
                    KonaklamaSponsorId = konakspoId,
                    TransferSponsorId  = transspoId,
                    KayıtId            = kayittipiId,
                    KonaklamaId        = konaklamatipiId,
                    Refakatci          = refakatci
                };

                _katilimciServisi.KatilimciEkle(k);
            }
            return(Json(new { success = true, data = JsonConvert.SerializeObject(dt) }, MimeTipleri.TextPlain));
        }
コード例 #14
0
 public static Katilimci ToEntity(this KatilimciModel model, Katilimci destination)
 {
     return(model.MapTo(destination));
 }
コード例 #15
0
 //Konaklama
 public static KatilimciModel ToModel(this Katilimci entity)
 {
     return(entity.MapTo <Katilimci, KatilimciModel>());
 }