示例#1
0
        public static void InsertMessage(string msg, string idOnChat, int idMsgReplayed)
        {
            bool flagReplayed = false;

            if (idMsgReplayed != 0)
            {
                flagReplayed = true;
            }
            if (msg != "" && idOnChat != "")
            {
                if (idOnChat != idGrp)
                {
                    MessagePersonalBuisnes.EnterMessagePersonal(userID_Ostad, idOnChat, msg, flagReplayed, idMsgReplayed);
                }
                else
                {// MesageGroupBuisnes.EnterMessageGroup(userID_Ostad, msg, flagReplayed, idMsgReplayed);
                }
            }
        }
        public static string InsertMessage(string userID, string idOnChat, string idGrp,
                                           string msg, int idMsgReplayed, int flagTypeFile = 1, string format = "")
        {
            bool flagReplayed = false;

            if (idMsgReplayed != 0)
            {
                flagReplayed = true;
            }
            if (msg != "")
            {
                DataTable dt;
                if (idOnChat != "")
                {
                    dt = MessagePersonalBuisnes.EnterMessagePersonal(userID, idOnChat, msg, flagReplayed,
                                                                     idMsgReplayed, flagTypeFile, format);
                }
                else
                {
                    dt = MesageGroupBuisnes.EnterMessageGroup(userID, msg, idGrp, flagReplayed,
                                                              idMsgReplayed, flagTypeFile, format);

                    if (idGrp.Trim() == userID.Trim())//detect page student
                    {
                        SendSmsContactBuisnes.InsertSendSms(idGrp.Trim());
                    }
                }
                dt = Functions.AddDefualt.GetDefualt(dt);

                string JSONString = JsonConvert.SerializeObject(dt);
                return(JSONString);
            }


            return(null);
        }