Beispiel #1
0
        public JsonResult GetEventReportByID(int eventId, int eventType)
        {
            EventReportDetails eventdetails = new EventReportDetails();

            EduData = new EducationManagerData();
            try {
                eventdetails = EduData.GetEventReportByID(eventType, eventId, 1);
            } catch (Exception ex) {
                clsError.WriteException(ex);
            }
            return(Json(eventdetails, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        //public StaffEventCreation GetEventByYakkrId(string YakkrId)
        //{
        //    StaffEventCreation evt = new StaffEventCreation();
        //    StaffDetails staffDetails = StaffDetails.GetInstance();

        //    try
        //    {
        //        if (Connection.State == ConnectionState.Open)
        //            Connection.Close();

        //        command.Connection = Connection;
        //        command.CommandType = CommandType.StoredProcedure;
        //        _dataset = new DataSet();
        //        command.Parameters.Clear();
        //        command.Parameters.Add(new SqlParameter("@Agencyid", staffDetails.AgencyId));
        //        command.Parameters.Add(new SqlParameter("@userid", staffDetails.UserId));
        //        command.Parameters.Add(new SqlParameter("@yakkrid", YakkrId));
        //        command.CommandText = "SP_GetEventByEventId";
        //        SqlDataAdapter da = new SqlDataAdapter(command);
        //        da.Fill(_dataset);
        //        Connection.Close();
        //        if (_dataset != null)
        //        {
        //            if (_dataset.Tables[0].Rows.Count > 0)
        //            {
        //                evt.CreatedBy = _dataset.Tables[0].Rows[0]["StaffName"].ToString();
        //                evt.EventDate = _dataset.Tables[0].Rows[0]["EventDateTime"].ToString();
        //                evt.EventName = _dataset.Tables[0].Rows[0]["TrainingName"].ToString();
        //                evt.EventDescription = _dataset.Tables[0].Rows[0]["description"].ToString();
        //                evt.CancelReason = _dataset.Tables[0].Rows[0]["cancellreason"].ToString();



        //            }
        //        }



        //    }
        //    catch (Exception ex)
        //    {
        //        clsError.WriteException(ex);
        //    }
        //    return evt;


        //}


        public EventReportDetails GetEventReportByID(int eventType, int eventId, int mode, string search = "", string CheckInUserId = null, string AgencyId = null, string ManagerId = null)
        {
            EventReportDetails evtDetails = new EventReportDetails();

            evtDetails.ParticipantDetails = new List <ParticipantDetail>();
            StaffDetails staffDetails = StaffDetails.GetInstance();


            try
            {
                if (Connection.State == ConnectionState.Open)
                {
                    Connection.Close();
                }

                command.Connection  = Connection;
                command.CommandType = CommandType.StoredProcedure;
                _dataset            = new DataSet();
                command.Parameters.Clear();
                command.Parameters.Add(new SqlParameter("@AgencyId", staffDetails.AgencyId));
                command.Parameters.Add(new SqlParameter("@EventId", eventId));
                command.Parameters.Add(new SqlParameter("@EventType", eventType));
                command.Parameters.Add(new SqlParameter("@Mode", mode));
                command.Parameters.Add(new SqlParameter("@Userid", staffDetails.UserId));
                command.Parameters.Add(new SqlParameter("@Search", search));
                command.Parameters.Add(new SqlParameter("@CheckInUserId", CheckInUserId));
                command.CommandText = "GetEventReportByID";
                SqlDataAdapter da = new SqlDataAdapter(command);
                da.Fill(_dataset);
                Connection.Close();
                if (_dataset != null)
                {
                    if (_dataset.Tables[0].Rows.Count > 0)
                    {
                        evtDetails.Eventid          = Convert.ToInt32(_dataset.Tables[0].Rows[0]["EventID"]);
                        evtDetails.Trainer          = _dataset.Tables[0].Rows[0]["Trainer"].ToString();
                        evtDetails.EventName        = _dataset.Tables[0].Rows[0]["TrainingName"].ToString();
                        evtDetails.EventDescription = _dataset.Tables[0].Rows[0]["Description"].ToString();
                        evtDetails.EventDate        = _dataset.Tables[0].Rows[0]["TrainingDate"].ToString();
                        evtDetails.EventAddress     = _dataset.Tables[0].Rows[0]["EventAddress"].ToString();
                        // evtDetails.IsTodayEvent = Convert.ToInt32(_dataset.Tables[0].Rows[0]["EventAddress"]);
                        if (_dataset.Tables.Count > 1 && _dataset.Tables[1].Rows.Count > 0)
                        {
                            foreach (DataRow item in _dataset.Tables[1].Rows)
                            {
                                var _pDetail = new ParticipantDetail()
                                {
                                    ParticipantId          = item["UserId"].ToString(),
                                    ParticipantName        = item["Name"].ToString(),
                                    ParticipantRoleName    = item["RoleName"].ToString(),
                                    RSVPStatusModifiedDate = item["RSVPStatusModifiedDate"].ToString() == "" ? "--" : item["RSVPStatusModifiedDate"].ToString(),
                                    RSVPStatusName         = item["RSVPStatus"].ToString(),
                                    RSVPStatusId           = DBNull.Value == item["RSVPStatusId"] ? -1 : Convert.ToInt32(item["RSVPStatusId"]),
                                };
                                if (mode == 2)
                                {
                                    _pDetail.Signature  = DBNull.Value == item["Signature"] ? "" : item["Signature"].ToString();
                                    _pDetail.IsAttended = DBNull.Value == item["IsAttended"] ? -1 : Convert.ToInt32(item["IsAttended"]);
                                    _pDetail.Avatar     = item["Avatar"].ToString();
                                }
                                if (mode == 3)
                                {
                                    _pDetail.Avatar = item["Avatar"].ToString();
                                    _pDetail.Gender = DBNull.Value == item["Gender"] ? -1 : Convert.ToInt32(item["Gender"]);
                                }

                                evtDetails.ParticipantDetails.Add(_pDetail);

                                //evtDetails.ParticipantDetails.Add(new ParticipantDetail()
                                // {


                                //     ParticipantId = item["UserId"].ToString(),
                                //     ParticipantName = item["Name"].ToString(),
                                //     ParticipantRoleName = item["RoleName"].ToString(),
                                //     RSVPStatusModifiedDate= item["RSVPStatusModifiedDate"].ToString()==""?"--": item["RSVPStatusModifiedDate"].ToString(),
                                //     RSVPStatusName = item["RSVPStatus"].ToString(),
                                //     RSVPStatusId = DBNull.Value == item["RSVPStatusId"] ? -1 : Convert.ToInt32(item["RSVPStatusId"])


                                // });
                            }
                        }

                        if (mode == 1 && eventType == 1)
                        {
                            evtDetails.ParticipantCount = evtDetails.ParticipantDetails.Count(x => x.RSVPStatusId == 1);
                        }
                        else if (mode == 1 && eventType == 2)
                        {
                            evtDetails.ParticipantCount = evtDetails.ParticipantDetails.Count(x => x.RSVPStatusName == "Attended" || x.RSVPStatusName == "Walk-in");
                        }
                        else if (mode == 2)
                        {
                            evtDetails.ParticipantCount = evtDetails.ParticipantDetails.Count(x => x.IsAttended == 1);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }

            return(evtDetails);
        }