예제 #1
0
        public ActionResult SendMessagex(string[] a, string text)
        {
            var listSender = new List <int>();

            foreach (var item in a)
            {
                listSender.Add(Convert.ToInt32(item));
            }
            var message = text;

            foreach (var item in listSender)
            {
                var messagelist = new List <MESSAGE_DETAIL>();
                {
                    var m = new MESSAGE_DETAIL();
                    m.CREATEDDATE = DateTime.Now;
                    m.TEXT        = message;
                    m.SENDERID    = item;

                    messagelist.Add(m);
                }
                using (var db = new DataBaseDataContext())
                {
                    db.MESSAGE_DETAILs.InsertAllOnSubmit(messagelist);
                    db.SubmitChanges();
                }
            }
            return(View());
        }
예제 #2
0
        public ActionResult SendMessage(MessageModel MessgeModel)

        {
            var listSender = MessgeModel.officers.Where(m => m.Chekbox == true).ToList();
            var message    = MessgeModel.MessageText;

            foreach (var item in listSender)
            {
                var messagelist = new List <MESSAGE_DETAIL>();
                {
                    var m = new MESSAGE_DETAIL();
                    m.CREATEDDATE = DateTime.Now;
                    m.TEXT        = message;
                    m.SENDERID    = item.ID;

                    messagelist.Add(m);
                }
                using (var db = new DataBaseDataContext())
                {
                    db.MESSAGE_DETAILs.InsertAllOnSubmit(messagelist);
                    db.SubmitChanges();
                }
            }
            string number = "";

            return(View());
        }