private void merge(int IsExist) { clss = (List <ClassListDTO>)Session["clss"]; mrgClass = (ClassListDTO)Session["mrgClass"]; //int classCode = (int)ViewState["classCode"]; //mrgClass.ProfID = (int)Session["idOstad"]; //nimsal = ViewState["nimsal"].ToString(); //string mergeCode = ViewState["mergeCode"].ToString(); //string count_sessions = ViewState["count_sessions"].ToString(); //string date_first_session = ViewState["date_first_session"].ToString(); //mrgClass.ClassDay = (int)ViewState["DayID"]; //string stime = ViewState["stime"].ToString(); //string etime = ViewState["etime"].ToString(); foreach (var item in clss) { item.MergeCode = mrgClass.MergeCode; item.CourseCode = mrgClass.CourseCode; item.CourseName = mrgClass.CourseName; item.FirstSession = mrgClass.FirstSession; item.SessionCount = mrgClass.SessionCount; item.ProfID = mrgClass.ProfID; item.Semester = mrgClass.Semester; item.ClassDay = mrgClass.ClassDay; item.ClassStartTime = mrgClass.ClassStartTime; item.ClassEndTime = mrgClass.ClassEndTime; item.ClassCount = clss.Count(); } if (clss.Count > 1 || IsExist == 1) { string temp = clss[clss.Count - 1].CourseName; for (int i = 0; i < clss.Count; i++) { if (i != clss.Count - 1) { temp += " " + clss[i].ClassCode + " و "; } else { temp += " " + clss[i].ClassCode; } } foreach (ClassListDTO item in clss) { item.ClassName = temp; clsB.MergeClass(item); } mergeClassDT = clsB.getMergeClass(nimsal); ViewState.Add("mergeClassDT", mergeClassDT); string msg = "کلاس ها با موفقیت ادغام شدند"; RadWindowManager1.RadAlert(msg, 0, 100, " پیام سیستم", ""); List <ClassListDTO> empty = new List <ClassListDTO>(); grdList.DataSource = empty; grdList.DataBind(); //cmbOstad.SelectedIndex = 0; txtmergeCode.Text = string.Empty; txtFirstSession.Text = string.Empty; txtSessionCount.Text = string.Empty; nimsal = ViewState["nimsal"].ToString(); bindInfoGrid(); } else if (clss.Count == 1) { string msg = "برای ادغام کردن کلاس، حداقل باید دو کلاس انتخاب کنید"; RadWindowManager1.RadAlert(msg, 0, 100, " پیام سیستم", ""); } else { string msg = "کلاسی را برای ادغام انتخاب نکرده اید"; RadWindowManager1.RadAlert(msg, 0, 100, " پیام سیستم", ""); } }