public ActionResult SetSchedulMain(List <SchedulMainModel> arr_SchedulList) { try { string str_rq = HttpContext.Request.Params.ToString(); if (arr_SchedulList != null && _ISchedulCon.ConInit(out str_msg)) { List <string[]> arr2_updateValues = new List <string[]>(); List <string> arr_updateid = new List <string>(); List <string[]> arr2_insertValues = new List <string[]>(); List <string> arr_patId = new List <string>(); foreach (SchedulMainModel _SchedulMainModel in arr_SchedulList) { if (_SchedulMainModel.status == 1) { arr_patId.Add(_SchedulMainModel.patid.ToString()); string[] arr_updateValues = { _SchedulMainModel.SchedulDate.ConvertSqlCondition(), _SchedulMainModel.SchedulTime.ConvertSqlCondition(), _SchedulMainModel.patid.ToString(), _SchedulMainModel.teamid.ToString(), _SchedulMainModel.groupid.ToString(), _SchedulMainModel.macid.ToString(), _SchedulMainModel.dialyzerName.ConvertSqlCondition(), _SchedulMainModel.routeName.ConvertSqlCondition(), _SchedulMainModel.anticoagulantName.ConvertSqlCondition(), _SchedulMainModel.remark.ConvertSqlCondition(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", DateTimeFormatInfo.InvariantInfo).ConvertSqlCondition() }; if (_SchedulMainModel.mainid == 0) { arr2_insertValues.Add(arr_updateValues); } else { arr_updateid.Add(_SchedulMainModel.mainid.ToString()); arr2_updateValues.Add(arr_updateValues); } } } _ISchedulCon.UpdateSchedulMain(out str_msg, arr2_updateValues, arr_updateid.ToArray()); _ISchedulCon.InsertSchedulMain(out str_msg, arr2_insertValues); _ISchedulCon.UpadatePatIsRead(out str_msg, arr_patId.ToArray()); } ViewBag.SchedulDate = _GetData.SchedulInitTable(out str_msg, arr_SchedulList[0].groupid.ToString(), arr_SchedulList[0].SchedulDate, arr_SchedulList[0].SchedulTime); List <PatientModel> arr_Patient = _GetData.GetPatientModels(out str_msg); PatientModel _patientModelEmpty = new PatientModel(); arr_Patient.Insert(0, _patientModelEmpty); ViewBag.PatientListDate = arr_Patient; List <SchedulColumns> arr_schedulColumns = _GetData.GetSchedulColumns(out str_msg, 2); ViewBag.SchedulColumnsDate = arr_schedulColumns; PartialViewResult _partialViewResult = PartialView("/Views/Schedul/GetNewSchedul.cshtml"); return(_partialViewResult); } catch (Exception ex) { throw ex; } }