示例#1
0
        public ActionResult Create(string ddlShift, string chkSun, string chkMon, string chkTue, string chkWed, string chkThur, string chkFri, string chkSat)
        {
            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(Request.Form["selectAgent"]))
                {
                }
                string weekDays = "";
                if (!string.IsNullOrEmpty(chkSun))
                {
                    weekDays += "," + chkSun;
                }
                if (!string.IsNullOrEmpty(chkMon))
                {
                    weekDays += "," + chkMon;
                }
                if (!string.IsNullOrEmpty(chkTue))
                {
                    weekDays += "," + chkTue;
                }
                if (!string.IsNullOrEmpty(chkWed))
                {
                    weekDays += "," + chkWed;
                }
                if (!string.IsNullOrEmpty(chkThur))
                {
                    weekDays += "," + chkThur;
                }
                if (!string.IsNullOrEmpty(chkFri))
                {
                    weekDays += "," + chkFri;
                }
                if (!string.IsNullOrEmpty(chkSat))
                {
                    weekDays += "," + chkSat;
                }
                if (!string.IsNullOrEmpty(weekDays))
                {
                    weekDays = weekDays.Substring(1);
                }

                string agentIDs = Request.Form["selectAgent"];
                //int index = 0;
                //while (agentIDs.Length>2000)
                //{
                //    string insertAgentIDs = agentIDs.Substring(index * 2000, 2000);
                using (WFMDBDataContext db = new WFMDBDataContext())
                {
                    db.uspWFMInsertShiftAgentWeek(agentIDs, weekDays, int.Parse(ddlShift));
                }
                //}
            }
            return(RedirectToAction("index"));
            //return View("Index");
        }
        public ActionResult Create(string ddlShift, string chkSun, string chkMon, string chkTue, string chkWed, string chkThur, string chkFri, string chkSat)
        {
            if (ModelState.IsValid)
            {
                if (!string.IsNullOrEmpty(Request.Form["selectAgent"]))
                {

                }
                string weekDays = "";
                if (!string.IsNullOrEmpty(chkSun))
                    weekDays += "," + chkSun;
                if (!string.IsNullOrEmpty(chkMon))
                    weekDays += "," + chkMon;
                if (!string.IsNullOrEmpty(chkTue))
                    weekDays += "," + chkTue;
                if (!string.IsNullOrEmpty(chkWed))
                    weekDays += "," + chkWed;
                if (!string.IsNullOrEmpty(chkThur))
                    weekDays += "," + chkThur;
                if (!string.IsNullOrEmpty(chkFri))
                    weekDays += "," + chkFri;
                if (!string.IsNullOrEmpty(chkSat))
                    weekDays += "," + chkSat;
                if (!string.IsNullOrEmpty(weekDays))
                {
                    weekDays = weekDays.Substring(1);
                }

                string agentIDs = Request.Form["selectAgent"];
                //int index = 0;
                //while (agentIDs.Length>2000)
                //{
                //    string insertAgentIDs = agentIDs.Substring(index * 2000, 2000);
                using (WFMDBDataContext db = new WFMDBDataContext())
                {
                    db.uspWFMInsertShiftAgentWeek(agentIDs, weekDays, int.Parse(ddlShift));
                }
                //}

            }
            return RedirectToAction("index");
            //return View("Index");
        }