Beispiel #1
0
        public string UpdateMsgReadStatus(string isRead, string msgDetails)
        {
            string result = string.Empty;
            List <MVCModels.MessagingModel> lstMsg = new List <MVCModels.MessagingModel>();

            DataControl.CurrentInfo objCurInfo = new DataControl.CurrentInfo();
            DataControl.BLMessaging objMsg     = new DataControl.BLMessaging();
            try
            {
                if (!string.IsNullOrEmpty(msgDetails))
                {
                    string[] ar = msgDetails.Split('^');
                    if (ar.Length > 0)
                    {
                        for (int i = 0; i < ar.Length; i++)
                        {
                            if (!string.IsNullOrEmpty(Convert.ToString(ar[i]).Split('~')[0]))
                            {
                                string targetAddress = Convert.ToString(ar[i]).Split('~')[1];
                                MVCModels.MessagingModel objMsgModel = new MVCModels.MessagingModel();
                                objMsgModel.Company_Code   = objCurInfo.GetCompanyCode();
                                objMsgModel.Msg_Code       = Convert.ToString(ar[i]).Split('~')[0];
                                objMsgModel.Target_Address = targetAddress;
                                lstMsg.Add(objMsgModel);
                            }
                        }
                        int rowsAffected = 0;
                        rowsAffected = objMsg.UpdateMsgReadStatus(objCurInfo.GetCompanyCode(), lstMsg, isRead);
                        if (rowsAffected > 0)
                        {
                            if (isRead == "1")
                            {
                                result = "The conversation has been marked as read.";
                            }
                            else
                            {
                                result = "The conversation has been marked as unread.";
                            }
                        }
                        else
                        {
                            if (isRead == "1")
                            {
                                result = "Error while change the conversation as read.";
                            }
                            else
                            {
                                result = "Error while change the conversation as unread.";
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Dictionary <string, string> dicObj = new Dictionary <string, string>();
                DataControl.Impl.ExceptionHandler.WriteLog(ex: ex, dic: dicObj);
            }
            return(result);
        }//The conversation has been moved to the Trash.