Esempio n. 1
0
        /// <summary>
        /// 保存添加的单位通知信息
        /// </summary>
        public ActionResult OrgNotifySave()
        {
            int notifyType = 2;
            string notifyTitle = GetString("Title");
            string notifyContent = GetString("Content");
            if (notifyTitle != "" && notifyContent != "")
            {
                Notify notify = new Notify();
                notify.NotifyType = notifyType;
                notify.Title = notifyTitle;
                notify.Content = notifyContent;
                notify.PublishTime = DateTime.Now;

                CQGJ.AddToNotify(notify);
                CQGJ.SaveChanges();

                int notifyId = notify.NotifyID;
                string orgString = Request.Form["org"].ToString();
                string[] orgIDList = orgString.Split(',');
                for (int i = 0; i < orgIDList.Length; i++)
                {
                    string orgIDCode = orgIDList[i];
                    NotifyMap nm = new NotifyMap();
                    try
                    {
                        nm.Notify = (from n in CQGJ.Notify where n.NotifyID == notifyId select n).First();
                    }
                    catch
                    {
                        //
                    }
                    nm.NotifyMapType = 1;
                    nm.ObjectID = Convert.ToInt32(orgIDCode);

                    CQGJ.AddToNotifyMap(nm);
                    CQGJ.SaveChanges();
                }
            }
            return RedirectToAction("OrgList");
        }
Esempio n. 2
0
        /// <summary>
        /// 保存添加的班级通知信息
        /// </summary>
        public ActionResult NotifySave()
        {
            int notifyType = 1;
            string notifyTitle = GetString("Title");
            string notifyContent = GetString("Content");

            if (notifyTitle != "" && notifyContent != "")
            {
                Notify notify = new Notify();
                notify.NotifyType = notifyType;
                notify.Title = notifyTitle;
                notify.Content = notifyContent;
                notify.PublishTime = DateTime.Now;

                CQGJ.AddToNotify(notify);
                CQGJ.SaveChanges();

                int notifyId = notify.NotifyID;

                string classesString = Request.Form["classes"].ToString();
                string[] classIDList = classesString.Split(',');

                for (int i = 0; i < classIDList.Length; i++)
                {
                    string classID = classIDList[i].ToString();
                    NotifyMap nm = new NotifyMap();
                    try
                    {
                        nm.Notify = (from n in CQGJ.Notify where n.NotifyID == notifyId select n).First();
                    }
                    catch
                    {
                        //
                    }

                    nm.NotifyMapType = 1;
                    nm.ObjectID = int.Parse(classID);

                    CQGJ.AddToNotifyMap(nm);
                    CQGJ.SaveChanges();
                }
                return RedirectToAction("ClassesList");
            }
            return null;
        }