Пример #1
0
        public DataSet GetmprstatusReport(ReportInputModel model)
        {
            DataSet ds = new DataSet();

            SqlParameter[] Param = new SqlParameter[5];
            string         data  = "";
            YSCMEntities   obj   = new YSCMEntities();

            if (model.OrgDepartmentId != 0)
            {
                List <int> departments = obj.MPRDepartments.Where(x => x.ORgDepartmentid == model.OrgDepartmentId).Select(x => (int)x.DepartmentId).ToList();
                data = string.Join(" , ", departments);
            }
            if (model.BuyerGroupId == 0)
            {
                Param[0]       = new SqlParameter("buyergroupid", SqlDbType.VarChar);
                Param[0].Value = DBNull.Value;
                Param[1]       = new SqlParameter("@fromdate", model.Fromdate);
                Param[2]       = new SqlParameter("@todate", model.Todate);
                Param[3]       = new SqlParameter("@DepartmentId", data);
                Param[4]       = new SqlParameter("@issuepurpose", model.Issuepurposeid);
            }
            else
            {
                //string region = (string.Join(",", model.multiregion.Select(x => x.Region.ToString()).ToArray()));
                Param[0] = new SqlParameter("@BuyerGroupId", model.BuyerGroupId);
                Param[1] = new SqlParameter("@fromdate", model.Fromdate);
                Param[2] = new SqlParameter("@todate", model.Todate);
                Param[3] = new SqlParameter("@DepartmentId", data);
                Param[4] = new SqlParameter("@issuepurpose", model.Issuepurposeid);
            }
            ds = _paBusenessAcess.GetmprstatusReport("newmprstatuareport", Param);
            return(ds);
        }
Пример #2
0
        public IHttpActionResult LoadprojectDurationwisereport(ReportInputModel model)
        {
            List <ReportbyprojectDuration> status = new List <ReportbyprojectDuration>();

            status = _paBusenessAcess.LoadprojectDurationwisereport(model);
            return(Ok(status));
        }
Пример #3
0
        public IActionResult Report(string courseId)
        {
            var viewModel = new ReportInputModel
            {
                CourseId = courseId,
            };

            return(this.View(viewModel));
        }
Пример #4
0
        public async Task CreateReport(ReportInputModel input)
        {
            await this.reportRepository.AddAsync(new Report
            {
                Content = input.Content,
                Subject = input.Subject,
                PostId  = int.Parse(input.PostId),
            });

            await this.reportRepository.SaveChangesAsync();
        }
        // GET: AdmiralsQuarters/Broadcast
        public ActionResult Index(ReportInputModel model)
        {
            var allShards = this.Cache.Get<IEnumerable<SimpleShardViewModel>>(
                "AllShards",
                () => this.shardService.GetShards()
                .ProjectTo<SimpleShardViewModel>()
                .ToList(),
                60 * 60);

            ViewBag.Shards = allShards;

            return View(model);
        }
Пример #6
0
        public async Task <IActionResult> Report(ReportInputModel inputModel)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(inputModel));
            }

            var userId = this.userManager.GetUserId(this.User);

            await this.reportsService.CreateReportAsync(inputModel.Title, inputModel.Description, inputModel.CourseId, userId);

            return(this.RedirectToAction("EnrolledCourses"));
        }
Пример #7
0
        public IActionResult Report([FromBody] ReportInputModel model)
        {
            try
            {
                var messageResponse = this.reportService.Store(model);

                return(this.Ok(messageResponse));
            }
            catch (Exception e)
            {
                return(this.BadRequest(e.Message));
            }
        }
Пример #8
0
        public IActionResult ReportPost(ReportInputModel inputModel)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View());
            }

            var post     = this.postService.GetPostById(inputModel.Id);
            var reporter = this.userService.GetUserByName(this.User.Identity.Name);

            this.reportService.CreateReport(inputModel.ReportReason, post.Id, post.UserId, reporter.Id);

            return(this.RedirectToAction("Index", "Home"));
        }
Пример #9
0
        public async Task <ReportOutputModel> Report([FromBody] ReportInputModel input)
        {
            try
            {
                var transactions = await _mobileTransactionRepository.GetAll().Where(x => x.CivilId == input.CivilId
                                                                                     & x.TransDate.Date >= input.FromDate.Date
                                                                                     & x.TransDate.Date <= input.ToDate.Date).OrderByDescending(x => x.TransDate.Date).ToListAsync();

                if (transactions.Count == 0)
                {
                    return(new ReportOutputModel
                    {
                        Status = false,
                        Message = (input.LanguaugeId == 1) ? "لا يوجد بصمات" : "No Transactions Found"
                    });
                }
                List <TransEntityModel> model = new List <TransEntityModel>();
                var      result   = transactions;
                DateTime tempdate = DateTime.Now.AddDays(1);
                foreach (var item in result)
                {
                    if (item.TransDate.Date != tempdate.Date)
                    {
                        var lst = transactions.Where(x => x.TransDate.Date == item.TransDate.Date).ToList();
                        TransEntityModel report = new TransEntityModel
                        {
                            TransDate    = item.TransDate.Date,
                            Transactions = ObjectMapper.Map <List <ReportEntityModel> >(lst)
                        };
                        model.Add(report);
                    }
                    tempdate = item.TransDate.Date;
                }

                return(new ReportOutputModel
                {
                    Status = true,
                    Transactions = model
                });
            }
            catch (Exception ex)
            {
                return(new ReportOutputModel
                {
                    Status = false,
                    Message = ex.Message
                });
            }
        }
Пример #10
0
        public ReportInputModel Store(ReportInputModel model)
        {
            this.CheckModelForNull(model);

            var report = new Report
            {
                Message = model.Message,
                UserId  = model.UserId
            };

            this.Data.Reports.Add(report);
            this.Data.SaveChanges();

            return(model);
        }
Пример #11
0
        public async Task <ReportInputModel> CreateAsync(string reportedUserId, string senderId)
        {
            var reportedUserUsername = await this.usersService.GetUserNameByUserIdAsync(reportedUserId);

            var senderUserName = await this.usersService.GetUserNameByUserIdAsync(senderId);

            var viewModel = new ReportInputModel
            {
                ReportedUserId       = reportedUserId,
                ReportedUserUserName = reportedUserUsername,
                SenderUserId         = senderId,
                SenderUserName       = senderUserName,
            };

            return(viewModel);
        }
Пример #12
0
        public async Task <GetEmpLocationsOutputModel> GetEmpLocations([FromBody] ReportInputModel input)
        {
            try
            {
                List <LocationModel> model = new List <LocationModel>();
                var user = await _userManager.Users.Include(x => x.Locations).Where(x => x.CivilId == input.CivilId).FirstOrDefaultAsync();

                var locations = user.Locations.Where(x => x.ToDate.Date >= DateTime.Now.Date);

                foreach (var item in locations)
                {
                    var           location      = _locationRepository.GetAll().Where(x => x.Id == item.LocationId).FirstOrDefault();
                    LocationModel locationmodel = new LocationModel {
                        Siteid = item.LocationId, SiteName = location.TitleAr, FromDate = item.FromDate, ToDate = item.FromDate
                    };
                    var crds = _locationCredentialRepository.GetAll().Where(x => x.LocationId == item.LocationId);
                    List <LocationCerdentialModel> cerdentiallist = new List <LocationCerdentialModel>();
                    foreach (var crd in crds)
                    {
                        cerdentiallist.Add(new LocationCerdentialModel {
                            lat = crd.Latitude, lon = crd.Longitude
                        });
                    }
                    locationmodel.cerdentials = cerdentiallist;
                    model.Add(locationmodel);
                }
                if (locations.Count() > 0)
                {
                    return(new GetEmpLocationsOutputModel {
                        Status = true, locations = model
                    });
                }
                else
                {
                    return(new GetEmpLocationsOutputModel {
                        Status = false, Message = (input.LanguaugeId == 1) ? "لا يوجد مواقع متاحة للبصمة" : "No Locations Avaliable"
                    });
                }
            }
            catch (Exception ex)
            {
                return(new GetEmpLocationsOutputModel {
                    Status = false, Message = ex.Message
                });
            }
        }
Пример #13
0
        public async Task <ActionResult <CreateReportOutputModel> > Create(ReportInputModel input)
        {
            var reporter = await this.reporters.FindByUser(this.currentUser.UserId);

            var pet = await this.pets.Find(input.Pet.Id);

            if (pet == null)
            {
                return(BadRequest(Result.Failure("Pet does not exist.")));
            }

            pet = new Pet
            {
                PetType        = input.Pet.PetType,
                Name           = input.Pet.Name,
                Age            = input.Pet.Age,
                RFID           = input.Pet.RFID,
                PetDescription = input.Pet.PetDescription
            };

            var location = await this.locations.FindByLongAndLat(input.Location.Latitude, input.Location.Longitude);

            location ??= new Location
            {
                Address   = input.Location.Address,
                Longitude = input.Location.Longitude,
                Latitude  = input.Location.Latitude
            };

            var report = new Report
            {
                Status          = input.Status,
                LostDate        = input.LostDate,
                ImagesLinksPost = input.ImagesLinksPost,
                RewardSum       = input.RewardSum,
                Location        = location,
                Pet             = pet,
                IsApproved      = false
            };

            await this.reports.Save(report);

            return(new CreateReportOutputModel(report.Id));
        }
Пример #14
0
        public DataSet GetMprstatuswisereport(ReportInputModel model)
        {
            DataSet ds = new DataSet();

            SqlParameter[] Param = new SqlParameter[7];
            string         data  = "";
            YSCMEntities   obj   = new YSCMEntities();

            if (model.DepartmentId == 0)
            {
                List <int> departments = obj.MPRDepartments.Where(x => x.ORgDepartmentid == model.OrgDepartmentId).Select(x => (int)x.DepartmentId).ToList();
                data = string.Join(" , ", departments);
            }
            else
            {
                data = string.Join(",", model.DepartmentId);
            }
            if (model.BuyerGroupId == 0)
            {
                Param[0]       = new SqlParameter("buyergroupid", SqlDbType.VarChar);
                Param[0].Value = DBNull.Value;
                Param[1]       = new SqlParameter("@fromdate", model.Fromdate);
                Param[2]       = new SqlParameter("@todate", model.Todate);
                Param[3]       = new SqlParameter("@ProjectManager", model.ProjectManager);
                Param[4]       = new SqlParameter("@SaleOrderNo", model.SaleOrderNo);
                Param[5]       = new SqlParameter("@Departmentid", data);
                Param[6]       = new SqlParameter("@JobCode", model.jobcode);
            }
            else
            {
                //string region = (string.Join(",", model.multiregion.Select(x => x.Region.ToString()).ToArray()));
                Param[0] = new SqlParameter("@BuyerGroupId", model.BuyerGroupId);
                Param[1] = new SqlParameter("@fromdate", model.Fromdate);
                Param[2] = new SqlParameter("@todate", model.Todate);
                Param[3] = new SqlParameter("@ProjectManager", model.ProjectManager);
                Param[4] = new SqlParameter("@SaleOrderNo", model.SaleOrderNo);
                Param[5] = new SqlParameter("@Departmentid", data);
                Param[6] = new SqlParameter("@JobCode", model.jobcode);
            }
            ds = _paBusenessAcess.GetMprstatuswisereport("Mprwisereport", Param);
            return(ds);
        }
Пример #15
0
        public async Task <ActionResult> Edit(int id, ReportInputModel input)
        {
            var reporterId = await this.reporters.GetIdByUser(this.currentUser.UserId);

            var reporterHasReport = await this.reporters.HasReports(reporterId, id);

            if (!reporterHasReport)
            {
                return(BadRequest(Result.Failure("You cannot edit this .")));
            }

            var pet = await this.pets.Find(input.Pet.Id);

            var location = await this.locations.FindByLongAndLat(input.Location.Latitude, input.Location.Longitude);

            location ??= new Location
            {
                Address   = input.Location.Address,
                Longitude = input.Location.Longitude,
                Latitude  = input.Location.Latitude
            };

            var report = await this.reports.Find(id);

            report.Location        = location;
            report.Status          = input.Status;
            report.Pet             = pet;
            report.ImagesLinksPost = input.ImagesLinksPost;
            report.RewardSum       = input.RewardSum;

            await this.reports.Save(report);

            await this.publisher.Publish(new ReportUpdateMessage
            {
                ReportId = report.Id,
                Status   = report.Status
            });

            return(Result.Success);
        }
Пример #16
0
        public ActionResult Broadcast(ReportInputModel model)
        {
            if (!ModelState.IsValid)
            {
                var allShards = this.Cache.Get<IEnumerable<SimpleShardViewModel>>(
                    "AllShards",
                    () => this.shardService.GetShards()
                    .ProjectTo<SimpleShardViewModel>()
                    .ToList(),
                    60 * 60);

                ViewBag.Shards = allShards;

                return View("Index", model);
            }

            this.SetSuccessMessage("The message will be sent out to all players in the shard.");

            var report = Mapper.Map<Report>(model);

            BackgroundJob.Enqueue<IReportsService>(rs => rs.BroadcastToShard(model.ShardId, report));

            return RedirectToAction("Index");
        }
        public async Task <IActionResult> ReportPost([FromBody] ReportInputModel model)
        {
            await this.reportService.CreateReport(model);

            return(this.Json(true));
        }
Пример #18
0
 public IHttpActionResult GetmprRequisitionReport(ReportInputModel input)
 {
     return(Ok(this._paBusenessAcess.GetmprRequisitionReport(input)));
 }
Пример #19
0
 public IHttpActionResult Loadprojectcodewisereport(ReportInputModel model)
 {
     //List<Reportbyprojectcode> status = new List<Reportbyprojectcode>();
     // status = _paBusenessAcess.Loadprojectcodewisereport(model);
     return(Ok(_paBusenessAcess.Loadprojectcodewisereport(model)));
 }
Пример #20
0
 public List <RequisitionReport> GetmprRequisitionReport(ReportInputModel input)
 {
     return(_purchaseDataAcess.GetmprRequisitionReport(input));
 }
Пример #21
0
 public List <ReportbyprojectDuration> LoadprojectDurationwisereport(ReportInputModel model)
 {
     return(_purchaseDataAcess.LoadprojectDurationwisereport(model));
 }
Пример #22
0
 public DataTable Loadprojectcodewisereport(ReportInputModel model)
 {
     return(_purchaseDataAcess.Loadprojectcodewisereport(model));
 }