public int AddEdit(Complaint entity)
        {
            int i = 0;

            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 (string.IsNullOrEmpty(entity.ComplaintID))
            {
                entity.ComplaintID = Utility.GeneratorUniqueId(ID_PREFIX_CONSTANTS.COMPLAINT_ID_PREFIX);

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

            string[] addParams = { Complaint_Constant.COMPLAINT_ID,
                                    Complaint_Constant.SCHOOL_ID,
                                    Complaint_Constant.SESSION_ID,
                                    Complaint_Constant.CLASS_ID,
                                    Complaint_Constant.SECTION_ID,
                                    Complaint_Constant.BATCH_ID,
                                    Complaint_Constant.STUDENT_ID,
                                    Complaint_Constant.COMPLAINT_DESC,
                                    Complaint_Constant.CREATED_BY_ID,
                                    Complaint_Constant.MODIFIED_BY_ID
                                    };

            i = _ComplaintRepository.ExecuteNonQuery(entity, addParams, Complaint_Constant.SPROC_COMPLAINTS_UPS);

            return i;
        }
 public Complaint Get(Complaint entity)
 {
     string[] addParams = { Complaint_Constant.COMPLAINT_ID };
     return _ComplaintRepository.Get(entity, addParams, Complaint_Constant.SPROC_COMPLAINTS_SEL);
 }
        public int Delete(Complaint entity)
        {
            int i = 0;

            string[] addParams = { Complaint_Constant.COMPLAINT_ID };
            i = _ComplaintRepository.ExecuteNonQuery(entity, addParams, Complaint_Constant.SPROC_COMPLAINTS_DEL);

            return i;
        }
 public object GetScalar(Complaint entity)
 {
     throw new NotImplementedException();
 }
        public IEnumerable<Complaint> GetAll(Complaint entity)
        {
            User objUser = null;
            if (eSchoolSession.IsInSession(SessionKeys.CurrentUser))
                objUser = (User)eSchoolSession.GetDirectValue(SessionKeys.CurrentUser);

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

            string[] addParams = { Constants.PAGEINDEX, Constants.PAGESIZE, Constants.SORTEXP, Complaint_Constant.SCHOOL_ID };
            return _ComplaintRepository.GetAll(entity, addParams, Complaint_Constant.SPROC_COMPLAINTS_LSTALL);
        }