public int AddEdit(ClassSubjects entity)
        {
            User objUser = null;
            if (eSchoolSession.IsInSession(SessionKeys.CurrentUser))
                objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser);

            if (entity != null && string.IsNullOrEmpty(entity.SchoolID))
            {
                if (objUser != null && !string.IsNullOrEmpty(objUser.SchoolID))
                    entity.SchoolID = objUser.SchoolID;
            }

            if (objUser != null && !string.IsNullOrEmpty(objUser.UserID))
            {
                entity.CreatedByID = objUser.UserID;
                entity.ModifiedByID = objUser.UserID;
            }
            else
            {
                entity.CreatedByID = "1";
                entity.ModifiedByID = "1";
            }

            string[] addParams = new string[] { ClassSubjects_Constant.CLASS_SUBJECT_ID, ClassSubjects_Constant.CLASS_ID, ClassSubjects_Constant.SUBJECT_ID, ClassSubjects_Constant.CREATED_BY_ID, ClassSubjects_Constant.MODIFIED_BY_ID };

            return _IClassSubjectsRepository.ExecuteNonQuery(entity, addParams, ClassSubjects_Constant.SPROC_CLASSSUBJECTS_UPS);
        }
示例#2
0
        public ActionResult AddEditClassSubjects(ClassListViewModel model)
        {
            _IClassSubjectsService.DeleteAllClassSubjects(new ClassSubjects() { ClassID = model.ClassSubjects.ClassID });

            string[] csvSubjects = model.ClassSubjects.Subjects.Split(',');

            foreach (string singleSubject in csvSubjects)
            {
                if (string.IsNullOrEmpty(singleSubject))
                    continue;

                ClassSubjects obj = new ClassSubjects();
                obj.SubjectID = singleSubject.Trim();
                obj.ClassID = model.ClassSubjects.ClassID;
                obj.ClassSubjectID = Utility.GeneratorUniqueId("CLSSUB_");
                _IClassSubjectsService.AddEdit(obj);
            }

            return RedirectToAction("ManageClassSubjects", "Class");
        }
 public object GetScalar(ClassSubjects obj)
 {
     throw new NotImplementedException();
 }
 public IEnumerable<ClassSubjects> GetAll(ClassSubjects entity)
 {
     string[] addParams = new string[] { ClassSubjects_Constant.CLASSNAME, ClassSubjects_Constant.CLASS_ID };
     return _IClassSubjectsRepository.GetAll(entity, addParams, ClassSubjects_Constant.SPROC_CLASSSUBJECTS_GETALL);
 }
 public ClassSubjects Get(ClassSubjects obj)
 {
     throw new NotImplementedException();
 }
 public int DeleteAllClassSubjects(ClassSubjects entity)
 {
     string[] addParams = new string[] { ClassSubjects_Constant.CLASS_ID};
     return _IClassSubjectsRepository.ExecuteNonQuery(entity, addParams, ClassSubjects_Constant.SPROC_DELETEALLCLASSSUBJECTS);
 }
 public int Delete(ClassSubjects entity)
 {
     throw new NotImplementedException();
 }