Beispiel #1
0
        public ResponseModel GetChatTicketsByID(int ticketID)
        {
            GetChatTicketsByID customGetChatTickets = null;
            ResponseModel      objResponseModel     = new ResponseModel();
            int    statusCode    = 0;
            string statusMessage = "";
            HSChatTicketingCaller chatTicketingCaller = new HSChatTicketingCaller();

            try
            {
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();
                authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token));

                customGetChatTickets = chatTicketingCaller.GetTicketsByID(new HSChatTicketingService(_connectioSting), ticketID, authenticate.TenantId, authenticate.UserMasterID, authenticate.ProgramCode);

                statusCode                    = customGetChatTickets != null ? (int)EnumMaster.StatusCode.Success : (int)EnumMaster.StatusCode.RecordNotFound;
                statusMessage                 = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode);
                objResponseModel.Status       = true;
                objResponseModel.StatusCode   = statusCode;
                objResponseModel.Message      = statusMessage;
                objResponseModel.ResponseData = customGetChatTickets != null ? customGetChatTickets : null;
            }
            catch (Exception)
            {
                throw;
            }
            return(objResponseModel);
        }
Beispiel #2
0
        /// <summary>
        /// Get Chat Tickets By ID
        /// </summary>
        /// <param name="ticketID"></param>
        /// <param name="tenantID"></param>
        /// <param name="userMasterID"></param>
        /// <param name="programCode"></param>
        /// <returns></returns>
        public GetChatTicketsByID GetChatTicketsByID(int ticketID, int tenantID, int userMasterID, string programCode)
        {
            DataSet            ds  = new DataSet();
            MySqlCommand       cmd = new MySqlCommand();
            GetChatTicketsByID customGetChatTickets = new GetChatTicketsByID();

            try
            {
                conn.Open();
                cmd.Connection = conn;
                MySqlCommand sqlcmd = new MySqlCommand("SP_HSGetChatTicketsByID", conn);
                sqlcmd.CommandType = CommandType.StoredProcedure;

                sqlcmd.Parameters.AddWithValue("ticket_ID", ticketID);
                sqlcmd.Parameters.AddWithValue("Tenant_ID", tenantID);
                sqlcmd.Parameters.AddWithValue("UserMaster_ID", userMasterID);
                sqlcmd.Parameters.AddWithValue("program_Code", programCode);
                MySqlDataAdapter da = new MySqlDataAdapter();
                da.SelectCommand = sqlcmd;
                da.Fill(ds);

                if (ds != null && ds.Tables[0] != null)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        customGetChatTickets.TicketID             = ds.Tables[0].Rows[i]["TicketID"] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[i]["TicketID"]);
                        customGetChatTickets.TicketStatus         = ds.Tables[0].Rows[i]["StatusID"] == DBNull.Value ? 0 :Convert.ToInt32(ds.Tables[0].Rows[i]["StatusID"]);
                        customGetChatTickets.TicketTitle          = ds.Tables[0].Rows[i]["TicketTitle"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["TicketTitle"]);
                        customGetChatTickets.TicketDescription    = ds.Tables[0].Rows[i]["TicketDescription"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["TicketDescription"]);
                        customGetChatTickets.CategoryID           = ds.Tables[0].Rows[i]["CategoryID"] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[i]["CategoryID"]);
                        customGetChatTickets.Category             = ds.Tables[0].Rows[i]["CategoryName"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["CategoryName"]);
                        customGetChatTickets.SubCategoryID        = ds.Tables[0].Rows[i]["SubCategoryID"] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[i]["SubCategoryID"]);
                        customGetChatTickets.SubCategory          = ds.Tables[0].Rows[i]["SubCategoryName"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["SubCategoryName"]);
                        customGetChatTickets.IssueTypeID          = ds.Tables[0].Rows[i]["IssueTypeID"] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[i]["IssueTypeID"]);
                        customGetChatTickets.IssueType            = ds.Tables[0].Rows[i]["IssueTypeName"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["IssueTypeName"]);
                        customGetChatTickets.AssignTo             = ds.Tables[0].Rows[i]["Assignee"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["Assignee"]);
                        customGetChatTickets.Priority             = ds.Tables[0].Rows[i]["PriortyName"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["PriortyName"]);
                        customGetChatTickets.CustomerID           = ds.Tables[0].Rows[i]["CustomerID"] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[i]["CustomerID"]);
                        customGetChatTickets.CustomerName         = ds.Tables[0].Rows[i]["CustomerName"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["CustomerName"]);
                        customGetChatTickets.CustomerMobileNumber = ds.Tables[0].Rows[i]["CustomerMobileNumber"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["CustomerMobileNumber"]);
                        customGetChatTickets.Brand          = ds.Tables[0].Rows[i]["Brand"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["Brand"]);
                        customGetChatTickets.CreatedDate    = ds.Tables[0].Rows[i]["CreatedAgo"] == DBNull.Value ? string.Empty : Convert.ToString(ds.Tables[0].Rows[i]["CreatedAgo"]);
                        customGetChatTickets.ChatTicketNote = ds.Tables[1].AsEnumerable().Select(x => new ChatTicketNotes()
                        {
                            Name        = x.Field <object>("Name") == DBNull.Value ? string.Empty : Convert.ToString(x.Field <object>("Name")),
                            Comment     = x.Field <object>("Comment") == DBNull.Value ? string.Empty : Convert.ToString(x.Field <object>("Comment")),
                            CommentDate = x.Field <object>("CommentDate") == DBNull.Value ? string.Empty : Convert.ToString(x.Field <object>("CommentDate"))
                        }).ToList();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();
                }
            }
            return(customGetChatTickets);
        }