public ResponseModel saveCustomerChatReply([FromBody] CustomerChatReplyModel ChatMessageReply) { ResponseModel objResponseModel = new ResponseModel(); int result = 0; int statusCode = 0; string statusMessage = ""; try { CustomerChatCaller customerChatCaller = new CustomerChatCaller(); result = customerChatCaller.SaveCustomerChatMessageReply(new CustomerChatService(_connectionString), ChatMessageReply); statusCode = result > 0 ? (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 = result; } catch (Exception) { throw; } return(objResponseModel); }
/// <summary> /// Save Customer Chat reply /// </summary> /// <param name="ChatMessageReply"></param> /// <returns></returns> public int SaveCustomerChatMessageReply(CustomerChatReplyModel ChatReply) { MySqlCommand cmd = new MySqlCommand(); int resultCount = 0; try { DateTime Now = !string.IsNullOrEmpty(ChatReply.DateTime) ? DateTime.ParseExact(ChatReply.DateTime, "dd MMM yyyy hh:mm:ss tt", CultureInfo.InvariantCulture) : DateTime.Now; if (conn != null && conn.State == ConnectionState.Closed) { conn.Open(); } cmd = new MySqlCommand("SP_InsertCustomerChatReplyMessage", conn); cmd.Connection = conn; cmd.Parameters.AddWithValue("@_ProgramCode", ChatReply.ProgramCode); cmd.Parameters.AddWithValue("@_StoreCode", ChatReply.StoreCode); cmd.Parameters.AddWithValue("@_Mobile", ChatReply.Mobile); cmd.Parameters.AddWithValue("@_Message", string.IsNullOrEmpty(ChatReply.Message) ? "" : ChatReply.Message); cmd.Parameters.AddWithValue("@_ChatID", ChatReply.ChatID); cmd.Parameters.AddWithValue("@_DateTime", Now); cmd.CommandType = CommandType.StoredProcedure; resultCount = Convert.ToInt32(cmd.ExecuteScalar()); } catch (Exception) { throw; } finally { conn.Close(); } return(resultCount); }
public int SaveCustomerChatMessageReply(ICustomerChat customerChat, CustomerChatReplyModel ChatReply) { _customerChat = customerChat; return(_customerChat.SaveCustomerChatMessageReply(ChatReply)); }