コード例 #1
0
        public async Task <IActionResult> Address(ViewModel.InformationViewModel viewmodel)
        {
            isAjax = HttpContext.Request.IsAjax("POST");
            if (isAjax)
            {
                if (ModelState.IsValid)
                {
                    WebEventoo_DomainClasses.Model.Address address = new WebEventoo_DomainClasses.Model.Address
                    {
                        AddressTwo     = viewmodel.Adress.AddressTwo,
                        CaptionAddress = viewmodel.Adress.CaptionAddress,
                        Name           = viewmodel.Adress.Name,
                        Lattiude       = lattiude,
                        Longtiude      = longtiude
                    };
                    await FAddressServices.AddAsync(address);

                    // Message = string.Format("Ok!");

                    return(new JsonResult("ادرس با موفقیت ذخیره شد"));
                }
            }

            return(new JsonResult(" خطا در ثبت عملیات"));
        }
コード例 #2
0
        public async Task <IActionResult> ForgetPassword(ViewModel.InformationViewModel Vmodel)
        {
            isAjax = HttpContext.Request.IsAjax("POST");
            if (isAjax)
            {
                if (ModelState.IsValid)
                {
                    var user = await _userManager.FindByNameAsync(Vmodel.Users.UserName);

                    if (user == null)
                    {
                        return(Json(new { Succeeded = false, Message = "چنین کاربری یافت نشد" }, serializerSettings: new Newtonsoft.Json.JsonSerializerSettings()));
                    }
                    var newPassword = _userManager.PasswordHasher.HashPassword(user, Vmodel.Users.Password);
                    user.PasswordHash = newPassword;
                    user.Password     = Vmodel.Users.Password;
                    var res = await _userManager.UpdateAsync(user);

                    if (res.Succeeded)
                    {
                        return(Json(new { Succeeded = true, Message = " تغییر رمز عبور با موفقیت انجام شد" }, serializerSettings: new Newtonsoft.Json.JsonSerializerSettings()));
                    }
                    else   /**/
                    {
                        return(Json(new { Succeeded = false, Message = "خطا در عملیات" }, serializerSettings: new Newtonsoft.Json.JsonSerializerSettings()));
                    }
                }
            }
            return(Json(new { Succeeded = false, Message = "خطا در عملیات" }, serializerSettings: new Newtonsoft.Json.JsonSerializerSettings()));
        }
コード例 #3
0
        /// <summary>
        /// نظرات
        /// </summary>
        /// <returns></returns>
        public async Task <IActionResult> CommentsEvent()
        {
            var vm = new ViewModel.InformationViewModel();
            // await FInformtionSErvices.AddAsync(vmodel.Information);
            var comment = await FCommentServices.GetAllCommentAsync();

            if (comment.Any())
            {
                ViewBag.Error = true;
                foreach (var item in comment)
                {
                    vm.CommentnList.Add(new WebEventoo_DomainClasses.Model.Comment
                    {
                        Event          = item.Event,
                        CaptionComment = item.CaptionComment,
                        User           = item.User,
                        Id             = item.Id
                    });
                }
                if (vmodel.CommentnList.Count < 0)
                {
                    ViewBag.Count = 0;
                }
                if (vmodel.CommentnList.Count > 0)
                {
                    ViewBag.Count = vmodel.CommentnList.Count;
                }
                return(View(vmodel));
            }
            ViewBag.Error = false;
            return(View(vm));
        }
コード例 #4
0
        public async Task <IActionResult> Login(ViewModel.InformationViewModel Vmodel)
        {
            isAjax = HttpContext.Request.IsAjax("POST");
            //test ajax

            if (isAjax)
            {
                if (ModelState.IsValid)
                {
                    string Username = Vmodel.Users.UserName;
                    string Password = Vmodel.Users.Password;
                    var    result   = await this.signInManager.PasswordSignInAsync(
                        Username, Password,
                        isPersistent : false, lockoutOnFailure : false);

                    if (result.Succeeded)
                    {
                        return(Json(new { Succeeded = true }, serializerSettings: new Newtonsoft.Json.JsonSerializerSettings()));
                    }
                    else
                    {
                        //    bool notactive = false;
                        return(Json(new { Succeeded = false }, serializerSettings: new Newtonsoft.Json.JsonSerializerSettings()));
                    }
                }
            }



            return(new JsonResult("خطا در درخواست!"));
        }
コード例 #5
0
        public async Task <IActionResult> EventReport()
        {
            var vm = new ViewModel.InformationViewModel();
            // await FInformtionSErvices.AddAsync(vmodel.Information);
            var x = await FreportServices.GetAllReportAsync();

            if (x.Any())
            {
                ViewBag.Error = true;
                foreach (var item in x)
                {
                    vm.ReportList.Add(new WebEventoo_DomainClasses.Model.Report
                    {
                        Event      = item.Event,
                        RoleReport = WebEventoo_DomainClasses.Model.Report.TypeReport.ReportEvent,

                        CaptionReport = item.CaptionReport
                    });
                    if (vm.ReportList.Count < 0)
                    {
                        ViewBag.Count = 0;
                    }
                    if (vm.ReportList.Count > 0)
                    {
                        ViewBag.Count = vm.ReportList.Count;
                    }
                    return(View(vm));
                }
            }
            ViewBag.Error = false;
            return(View(vm));
        }
コード例 #6
0
 public async Task <IActionResult> Comment(ViewModel.InformationViewModel vmodel)
 {
     if (ModelState.IsValid)
     {
         await FCommentServices.AddAsync(vmodel.Comment);
     }
     return(View());
 }
コード例 #7
0
 public AccountController(WebDbContext context, IEmailSender emailSender, UserManager <Users> userManager, SignInManager <Users> signInManager)
 {
     this.signInManager = signInManager;
     _context           = context;
     _userManager       = userManager;
     Vmodel             = new ViewModel.InformationViewModel();
     this.emailSender   = emailSender;
     _context.Database.EnsureCreated();
 }
コード例 #8
0
        public async Task <IActionResult> EditPlace(ViewModel.InformationViewModel vmodel)
        {
            if (ModelState.IsValid)
            {
                await FPlacesServices.UpdateAsync(vmodel.Place);

                Message = "Ok Edit";
            }
            return(RedirectToAction(nameof(Index)));
        }
コード例 #9
0
 public OperationController(WebDbContext db,
                            ICommentService Comment,
                            IEventServices Event, INotPublishedServices NotPublish, ITranctionServices TranctionServices)
 {
     Dbcontext           = db;
     vmodel              = new ViewModel.InformationViewModel();
     FNotPublishServices = NotPublish;
     FEventServices      = Event;
     FTranctionServices  = TranctionServices;
     FCommentServices    = Comment;
 }
コード例 #10
0
        public async Task <IActionResult> EditEvent(ViewModel.InformationViewModel vmodel)
        {
            if (ModelState.IsValid)
            {
                vmodel.Event.EventNow       = DateTime.Now;
                vmodel.Event.StatuseChecked = true;
                vmodel.Event.StatuseEnter   = true;
                await FEventServices.UpdateAsync(vmodel.Event);

                Message = "Ok Edit";
            }
            return(RedirectToAction(nameof(Index)));
        }
コード例 #11
0
        public async Task <IActionResult> Information(ViewModel.InformationViewModel vmodel)
        {
            isAjax = HttpContext.Request.IsAjax("POST");
            if (isAjax)
            {
                if (ModelState.IsValid)
                {
                    await FInformtionSErvices.AddAsync(vmodel.Information);

                    return(new JsonResult("عملیات با موفقیت ذخیره شد"));
                }
            }
            return(new JsonResult("خطا در ثبت عملیات"));
        }
コード例 #12
0
        //نیاز به ویرایش
        public async Task <IActionResult> IsEdit(int Id)
        {
            if (Id == null)
            {
                return(NotFound());
            }
            ViewModel.InformationViewModel Vmodel = new ViewModel.InformationViewModel();

            Vmodel.Event = await FEventServices.GetEventAsync(Id);

            Vmodel.Event.Statusevent = WebEventoo_DomainClasses.Model.Event.StatuseEvent.IsEdit;
            await FEventServices.UpdateAsync(Vmodel.Event);

            return(RedirectToAction("Index"));
        }
コード例 #13
0
        public async Task <IActionResult> EditInformation(int?Id)
        {
            if (Id == null)
            {
                return(NotFound());
            }
            ViewModel.InformationViewModel Vmodel = new ViewModel.InformationViewModel();

            Vmodel.Information = await FInformtionSErvices.GetInformationAsync(Id);

            if (Vmodel.Information == null)
            {
                return(NotFound());
            }
            return(View(Vmodel));
        }
コード例 #14
0
        public async Task <IActionResult> EditAddress(int?Id)
        {
            if (Id == null)
            {
                return(NotFound());
            }
            ViewModel.InformationViewModel Vmodel = new ViewModel.InformationViewModel();

            Vmodel.Adress = await FAddressServices.GetAddressAsync(Id);

            if (Vmodel.Adress == null)
            {
                return(NotFound());
            }
            return(View(Vmodel));
        }
コード例 #15
0
        public async Task <IActionResult> EditEvent(int?Id)
        {
            if (Id == null)
            {
                return(NotFound());
            }
            ViewModel.InformationViewModel Vmodel = new ViewModel.InformationViewModel();

            Vmodel.Event = await FEventServices.GetEventAsync(Id);

            if (Vmodel.Event == null)
            {
                return(NotFound());
            }
            return(View(Vmodel));
        }
コード例 #16
0
        public async Task <IActionResult> EditPlace(int?Id)
        {
            if (Id == null)
            {
                return(NotFound());
            }
            ViewModel.InformationViewModel Vmodel = new ViewModel.InformationViewModel();

            Vmodel.Place = await FPlacesServices.GetPlaceAsync(Id);

            if (Vmodel.Place == null)
            {
                return(NotFound());
            }
            return(View(Vmodel));
        }
コード例 #17
0
        public async Task <IActionResult> EditCermoney(int?Id)
        {
            if (Id == null)
            {
                return(NotFound());
            }
            ViewModel.InformationViewModel Vmodel = new ViewModel.InformationViewModel();

            Vmodel.Cermoney = await FCermoneyServices.GetCermoneyAsync(Id);

            if (Vmodel.Cermoney == null)
            {
                return(NotFound());
            }
            return(View(Vmodel));
        }
コード例 #18
0
        public async Task <IActionResult> EditAddress(ViewModel.InformationViewModel vmodel)
        {
            if (ModelState.IsValid)
            {
                WebEventoo_DomainClasses.Model.Address address = new WebEventoo_DomainClasses.Model.Address
                {
                    AddressTwo     = vmodel.Adress.AddressTwo,
                    CaptionAddress = vmodel.Adress.CaptionAddress,
                    Name           = vmodel.Adress.Name,
                    Lattiude       = lattiude,
                    Longtiude      = longtiude
                };
                await FAddressServices.AddAsync(address);

                Message = string.Format("Ok!");

                return(RedirectToAction("Index"));
            }
            return(View());
        }
コード例 #19
0
        public async Task <IActionResult> Register(ViewModel.InformationViewModel Vmodel)
        {
            isAjax = HttpContext.Request.IsAjax("POST");


            if (isAjax)
            {
                //  DateTime dt = new DateTime();

                if (ModelState.IsValid)
                {
                    var user = new Users
                    {
                        UserName = Vmodel.Users.UserName,
                        Password = Vmodel.Users.Password,
                        //   Email = Vmodel.Users.Email,
                        EmailUser      = Vmodel.Users.EmailUser,
                        EmailConfirmed = true,

                        //Email= Vmodel.Users.EmailUser,
                        Type = Users.UserType.UserWeb,
                    };
                    try
                    {
                        var result = await this._userManager.CreateAsync(user, Vmodel.Users.Password);

                        if (result.Succeeded)
                        {
                            //  await signInManager.SignInAsync(user, false);
                            return(new JsonResult("ثبت نام شما با موفقیت انجام شد"));
                        }
                    }
                    catch (Exception ex)
                    {
                        string e = ex.Message;
                    }
                }
            }

            return(new JsonResult("خطا در ارسال درخواست"));
        }
コード例 #20
0
        /// <summary>
        /// رویداد های بررسی نشده
        /// </summary>
        /// <returns></returns>
        public IActionResult StatuseChecked()

        {
            var obj = Dbcontext.Event.Where(p => p.Statusevent == Event.StatuseEvent.NotChecked);

            if (obj.Any())
            {
                //  vmodel.EventList = obj.ToList();
                ViewBag.Error = true;

                vmodel           = new ViewModel.InformationViewModel();
                vmodel.EventList = obj.OrderByDescending(x => x.TimeEvent).ToList();
                var dt2 = DateTime.Now;

                vmodel.PeriodEventTime = new List <string>();
                foreach (var item in vmodel.EventList)
                {
                    var dt = item.EventNow.Date;


                    TimeSpan ts = (dt2 - dt);

                    vmodel.PeriodEventTime.Add(ts.ToString(@"hh\:mm\:ss"));
                }
                if (vmodel.EventList.Count < 0)
                {
                    ViewBag.Count = 0;
                }
                if (vmodel.EventList.Count > 0)
                {
                    ViewBag.Count = vmodel.EventList.Count;
                }

                return(View(vmodel));
            }
            ViewBag.Error = false;
            return(View(vmodel));
        }
コード例 #21
0
        public IActionResult Event()
        {
            var vm = new ViewModel.InformationViewModel();

            var Exhibition = context.Exhibition.OrderBy(c => c.Name).Select(x => new { Id = x.Id, Value = x.Name, x.Type }).ToList();

            vm.Select = new SelectList(Exhibition, "Id", "Value");
            var Eduction = context.Eduction.OrderBy(c => c.Name).Select(x => new { Id = x.Id, Value = x.Name }).ToList();

            vm.SelectEduction = new SelectList(Eduction, "Id", "Value");
            var Place = context.Place.OrderBy(c => c.Name).Select(x => new { Id = x.Id, Value = x.Name }).ToList();

            vm.SelectPlace = new SelectList(Place, "Id", "Value");
            var Address = context.Address.OrderBy(c => c.Name).Select(x => new { Id = x.Id, Value = x.Name }).ToList();

            vm.SelectAddress = new SelectList(Address, "Id", "Value");
            var Cermoney = context.Cermoney.OrderBy(c => c.Name).Select(x => new { Id = x.Id, Value = x.Name }).ToList();

            vm.SelectCermoney = new SelectList(Cermoney, "Id", "Value");



            return(View(vm));
        }
コード例 #22
0
 public NotPublishedViewComponents(IServiceProvider serviceProvide)
 {
     _serviceProvider = serviceProvide;
     vmodel           = new ViewModel.InformationViewModel();
 }
コード例 #23
0
 public ReportsViewComponents(IServiceProvider serviceProvide)
 {
     _serviceProvider = serviceProvide;
     vmodel           = new ViewModel.InformationViewModel();
 }
コード例 #24
0
        public async Task <IActionResult> Event(ViewModel.InformationViewModel vmodel, IList <IFormFile> files)
        {
            if (ModelState.IsValid)
            {
                int?Exhibition;
                int?Eduction;
                int?Place;
                int?Address, Cermoney;



                vmodel.Event.EventNow       = DateTime.Now;
                vmodel.Event.StatuseChecked = true;
                vmodel.Event.StatuseEnter   = true;
                vmodel.Event.Statusevent    = WebEventoo_DomainClasses.Model.Event.StatuseEvent.Published;


                if (files == null || files.Count == 0)
                {
                    return(BadRequest());
                }
                vmodel.Event.Image = new List <WebEventoo_DomainClasses.Model.Images>();
                using (var ms = new MemoryStream())
                {
                    foreach (var item in files)
                    {
                        item.CopyTo(ms);
                        var ArrayImage = ms.ToArray();


                        vmodel.Event.Image.Add(new WebEventoo_DomainClasses.Model.Images()
                        {
                            ImageData = ArrayImage, NameImage = item.FileName
                        });



                        // vmodel.Event.Image = vmodel.Image;
                    }
                }
                Exhibition = int.Parse(vmodel.ExhibitionCode);
                // Eduction = int.Parse(vmodel.EductionCode);
                Place    = int.Parse(vmodel.PlaceCode);
                Address  = int.Parse(vmodel.AddressCode);
                Cermoney = int.Parse(vmodel.CermoneyCode);
                //if (Exhibition >= 1)
                //{
                // var ex = context.Exhibition.Where(x => x.Id == Exhibition).Select(x=>new {x.Name,x.Type }).ToList();
                //// vmodel.Event.Exhibotion = ex;
                vmodel.Event.Exhibotion = context.Exhibition.ToList().Where(x => x.Id == Exhibition).ToList();
                vmodel.Event.Place      = context.Place.ToList().Where(x => x.Id == Place).ToList();
                vmodel.Event.Address    = context.Address.ToList().Where(x => x.Id == Address).ToList();
                vmodel.Event.Cermoney   = context.Cermoney.ToList().Where(x => x.Id == Cermoney).ToList();
                //  var xdfdfdf = vmodel.Event;


                await FEventServices.AddAsync(vmodel.Event);

                Message = string.Format("Ok!");
                // return View("Event");
                return(RedirectToAction("Index"));

                //   }
            }
            return(View());
        }