Esempio n. 1
0
        }//The conversation has been moved to the Trash.

        public string UpdateMsgStatus(string rowStatus, string msgCode, string mailMode)
        {
            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(msgCode))
                {
                    string[] ar = msgCode.Split('^');
                    if (ar.Length > 0)
                    {
                        for (int i = 0; i < ar.Length; i++)
                        {
                            if (!string.IsNullOrEmpty(Convert.ToString(ar[i])))
                            {
                                MVCModels.MessagingModel objMsgModel = new MVCModels.MessagingModel();
                                objMsgModel.Company_Code   = objCurInfo.GetCompanyCode();
                                objMsgModel.Msg_Code       = Convert.ToString(ar[i]).Split('~')[0];
                                objMsgModel.Target_Address = Convert.ToString(ar[i]).Split('~')[1];
                                objMsgModel.Sender         = Convert.ToString(ar[i]).Split('~')[1];
                                lstMsg.Add(objMsgModel);
                            }
                        }
                        int rowsAffected = 0;
                        if ("INBOX" == mailMode || "TRASH" == mailMode || "UNREAD" == mailMode)
                        {
                            rowsAffected = objMsg.UpdateMsgStatus(objCurInfo.GetCompanyCode(), lstMsg, rowStatus);
                        }
                        else if ("SENT" == mailMode)
                        {
                            rowsAffected = objMsg.UpdateSentMsgStatus(objCurInfo.GetCompanyCode(), lstMsg, rowStatus);
                        }
                        else
                        {
                            rowsAffected = objMsg.UpdateMsgStatusOtherthanInbox(objCurInfo.GetCompanyCode(), lstMsg, "3");
                        }
                        if (rowsAffected > 0)
                        {
                            if ("TRASH" == mailMode)
                            {
                                result = "The conversation has been deleted";
                            }
                            else if ("INBOX" == mailMode)
                            {
                                result = "The conversation has been moved to the Trash.";
                            }
                            else
                            {
                                result = "The conversation has been deleted";
                            }
                        }
                        else
                        {
                            if ("TRASH" == mailMode)
                            {
                                result = "Error while delete the conversation.";
                            }
                            else
                            {
                                result = "Error while move the conversation to trash";
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Dictionary <string, string> dicObj = new Dictionary <string, string>();
                DataControl.Impl.ExceptionHandler.WriteLog(ex: ex, dic: dicObj);
            }
            return(result);
        }