コード例 #1
0
        /// <summary>
        /// This method is used to get a data for popup and search text box auto lookup.
        /// </summary>
        /// <param name="objCandidateDetailModel"></param>
        /// <returns></returns>
        public List <CandidateDetailModel> GetPopupData(CandidateDetailModel objCandidateDetailModel)
        {
            GEEDbContext context       = new GEEDbContext();
            var          cadDetailList = (from candDet in context.CandidateDetails
                                          select candDet);

            //Sorting
            if (!(string.IsNullOrEmpty(objCandidateDetailModel.SortColumn) && string.IsNullOrEmpty(objCandidateDetailModel.SortOrder)))
            {
                cadDetailList = cadDetailList.OrderBy(objCandidateDetailModel.SortColumn + " " + objCandidateDetailModel.SortOrder);
            }
            //Search
            if (!string.IsNullOrEmpty(objCandidateDetailModel.SearchValue))
            {
                cadDetailList = cadDetailList.Where(m => m.FirstName.ToLower().Contains(objCandidateDetailModel.SearchValue.ToLower()) ||
                                                    m.Lastname.ToLower().Contains(objCandidateDetailModel.SearchValue.ToLower()) ||
                                                    m.FatheFirstName.ToLower().Contains(objCandidateDetailModel.SearchValue.ToLower()));
            }
            int recordsTotal = cadDetailList.Count();
            var data         = cadDetailList.Skip(objCandidateDetailModel.PageNo).Take(objCandidateDetailModel.PageSize).ToList();
            List <CandidateDetailModel> candidatedeModelList = new List <CandidateDetailModel>();

            foreach (var item in data)
            {
                candidatedeModelList.Add(Mapper.Map <CandidateDetailModel>(item));
            }
            if (candidatedeModelList.Count > 0)
            {
                candidatedeModelList[0].RowCount = recordsTotal;
            }
            return(candidatedeModelList);
        }
コード例 #2
0
        public CandidateDetailModel Update(CandidateDetailModel entity)
        {
            var candidatede = _CandidateDetailDataAccess.Update(Mapper.Map <CandidateDetail>(entity));

            return(new CandidateDetailModel {
                CandidateDetail_ID = candidatede.CandidateDetail_ID
            });
        }
コード例 #3
0
        public async Task <CandidateDetailModel> SaveAsync(CandidateDetailModel entity)
        {
            var candidatedet = await _CandidateDetailDataAccess.SaveAsync(Mapper.Map <CandidateDetail>(entity));

            return(new CandidateDetailModel {
                CandidateDetail_ID = candidatedet.CandidateDetail_ID
            });
        }
コード例 #4
0
 public async Task <HttpResponseMessage> Update(CandidateDetailModel data)
 {
     try
     {
         await _candidatedetail.UpdateAsync(data);
     }
     catch (Exception ex)
     {
         Common.MyLogger.Error(ex.Message + ex.StackTrace + ex.InnerException.ToString());
         return(Request.CreateResponse(HttpStatusCode.BadRequest, "Update Error"));
     }
     return(Request.CreateResponse(HttpStatusCode.OK, "Data Updated"));
 }
コード例 #5
0
 /// <summary>
 /// This method is used to get a data for popup and search text box auto lookup.
 /// </summary>
 /// <param name="objCandidateDetailModel"></param>
 /// <returns></returns>
 public JsonResult <List <CandidateDetailModel> > GetPopupData(CandidateDetailModel objCandidateDetailModel)
 {
     try
     {
         var objList = _candidatedetail.GetPopupData(objCandidateDetailModel);
         return(Json(objList));
     }
     catch (Exception ex)
     {
         Common.MyLogger.Error(ex.Message + ex.StackTrace + ex.InnerException.ToString());
         return(null);
     }
 }
コード例 #6
0
        public async Task <HttpResponseMessage> Save(EnquiryModel data)
        {
            try
            {
                #region For Add data into Application table
                List <ApplicationModel> applicationModelList = new List <ApplicationModel>();
                ApplicationModel        applicationModel     = new ApplicationModel()
                {
                    //Enquiry_ID = enquiry.Enquiry_ID,
                    ApplicaitonNo = data.ApplicaitonNo,
                    IsSubmitted   = false,
                    Sessionyear   = data.Sessionyear,
                    SchoolID      = data.SchoolID,
                    GroupID       = data.GroupID,
                    CreatedDate   = DateTime.Today
                };
                applicationModelList.Add(applicationModel);
                #endregion

                #region For Add data into CandidateDetail table
                List <CandidateDetailModel> candidateDetailList  = new List <CandidateDetailModel>();
                CandidateDetailModel        candidateDetailModel = new CandidateDetailModel()
                {
                    // Enquiry_ID = data.Enquiry_ID,
                    AdmissionClass_id = data.AdmissionClass_id,
                    FirstName         = data.FirstName,
                    MiddleName        = data.MiddleName,
                    Lastname          = data.Lastname,
                    DOB                 = data.DOB,
                    Email               = data.Email,
                    StudentType_ID      = data.StudentType_ID,
                    ContactMobileNo     = data.ContactMobileNo,
                    hasSibiling         = data.hasSibiling,
                    SiblingAdmNumber_ID = data.SiblingAdmNumber_ID,
                    Address1            = data.Address1,
                    Address2            = data.Address2,
                    City_ID             = data.City_ID,
                    State_ID            = data.State_ID,
                    Country_ID          = data.Country_ID,
                    FatheFirstName      = data.FatheFirstName,
                    FatherMiddleName    = data.FatherMiddleName,
                    FatherLasttName     = data.FatherLasttName,
                    MotherFirstName     = data.MotherFirstName,
                    MotherMiddleName    = data.MotherMiddleName,
                    MotherLasttName     = data.MotherLasttName,
                    Sessionyear         = data.Sessionyear,
                    SchoolID            = data.SchoolID,
                    GroupID             = data.GroupID,
                    SubjectId           = data.SubjectId,
                    CreatedDate         = DateTime.Today
                };
                candidateDetailList.Add(candidateDetailModel);

                EnquiryModel enquiry = new EnquiryModel
                {
                    Applications     = applicationModelList,
                    CandidateDetails = candidateDetailList,
                    CreatedDate      = DateTime.Today,
                    Enquiry_ID       = 0,
                    MarketSource_ID  = data.MarketSource_ID,
                    EnquiryType_ID   = data.EnquiryType_ID,
                    EnquiryNo        = data.EnquiryNo
                };
                await _enquiry.SaveAsync(enquiry);

                #endregion
            }
            catch (Exception ex)
            {
                Common.MyLogger.Error(ex.Message + ex.StackTrace + ex.InnerException.ToString());
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Error"));
            }
            return(Request.CreateResponse(HttpStatusCode.OK, "Data Saved"));
        }
コード例 #7
0
 public async Task DeleteAsync(CandidateDetailModel entity)
 {
     await _CandidateDetailDataAccess.DeleteAsync(entity.CandidateDetail_ID);
 }
コード例 #8
0
 public void Delete(CandidateDetailModel entity)
 {
     _CandidateDetailDataAccess.Delete(entity.CandidateDetail_ID);
 }