/// Function Header******************************************************* /// Function Name: InesrtSectionVisitedDetails /// Function Type: Function /// Functionality: used to insert the section visited details /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public bool InsertFAQ(Entity.UserInfo oUserInfo) { using (TLWDALDataContext _db = new TLWDALDataContext()) { bool _blnRetVal = true; var _varFAQ = (from _f in _db.FAQs where _f.strQuestion.ToLower().Equals(oUserInfo.StrQuestion.ToLower()) && _f.strHeading.ToLower().Equals(oUserInfo.StrHeading.ToLower()) && _f.chrisDeleted.Equals('N') select _f).FirstOrDefault(); if (_varFAQ != null) _blnRetVal = false; else { DAL.FAQ oFAQ = new FAQ(); oFAQ.intQuestionId = 0; oFAQ.strHeading = oUserInfo.StrHeading; oFAQ.strQuestion = oUserInfo.StrQuestion; oFAQ.strAnswer = oUserInfo.StrAnswer; oFAQ.chrUserType = oUserInfo.ChrUserType; oFAQ.dtCreatedOn = oUserInfo.DtCreatedOn; oFAQ.strUserId = oUserInfo.StrUserId; oFAQ.chrisDeleted = 'N'; _db.FAQs.InsertOnSubmit(oFAQ); _db.SubmitChanges(); oFAQ = null; } _varFAQ = null; return _blnRetVal; } }
/// Function Header******************************************************* /// Function Name: SaveHotSectionDetails /// Function Type: Function /// Functionality: used to save the details /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public void DeleteHotSectionDetails(int _intHotSectionDetailsId) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var _varHotSections = _db.HotSectionDetails.Where(x => x.intHotSectionId.Equals(_intHotSectionDetailsId)).SingleOrDefault(); _varHotSections.chrIsDeleted = 'Y'; _varHotSections.dtDeletedOn = DateTime.Now; _db.SubmitChanges(); _varHotSections = null; } }
/// Function Header******************************************************* /// Function Name: SaveNewsletter /// Function Type: Function /// Functionality: used to save the details of newsletters /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public void DeleteNewsletter(int _intNewsLetterId) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var _varDup = _db.Newsletters.Where(x => x.intNewsLetterId.Equals(_intNewsLetterId) ).SingleOrDefault(); if (_varDup != null) { _varDup.chrIsDeleted = 'Y'; _varDup.dtDeletedOn = DateTime.Now; _db.SubmitChanges(); } } }
/// Function Header******************************************************* /// Function Name: ActivateDeactivateEvent /// Function Type: Function /// Functionality: used to update the activation and deactivation /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public void ApproveDisapproveEvent(int _intEventId) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var oVarObj = _db.Events.Where(x => x.intEventsId.Equals(_intEventId) ).SingleOrDefault(); if (oVarObj != null) { oVarObj.chrStatus = oVarObj.chrStatus.Equals('A') ? 'D' : 'A'; oVarObj.dtModifiedOn = DateTime.Now; _db.SubmitChanges(); oVarObj = null; } } }
/// Function Header******************************************************* /// Function Name: UpdateQuestionnaireDetails /// Function Type: Function /// Functionality: used to update the details /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public void DeleteQuestionnaireDetails(int _intQuestionnareId) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var oQuestionnaireDAL = _db.Questionnaires.Where(x => x.intQuestionnaireId.Equals(_intQuestionnareId) ).SingleOrDefault(); if (oQuestionnaireDAL != null) { oQuestionnaireDAL.chrIsDeleted = 'Y'; oQuestionnaireDAL.dtDeletedDate = DateTime.Now; _db.SubmitChanges(); oQuestionnaireDAL = null; } } }
/// Function Header******************************************************* /// Function Name: UpdateQuestionnaireDetails /// Function Type: Function /// Functionality: used to update the details /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public void ChangeStatusofQuestionnaire(int _intQuestionnareId) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var oQuestionnaireDAL = _db.Questionnaires.Where(x => x.intQuestionnaireId.Equals(_intQuestionnareId) ).SingleOrDefault(); if (oQuestionnaireDAL != null) { oQuestionnaireDAL.chrIsActive = oQuestionnaireDAL.chrIsActive.Equals('Y') ? 'N' : 'Y'; oQuestionnaireDAL.dtModifiedDate = DateTime.Now; _db.SubmitChanges(); oQuestionnaireDAL = null; } } }
/// Function Header******************************************************* /// Function Name: UpdateQuestionnaireDetails /// Function Type: Function /// Functionality: used to update the details /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public void DeleteEventDetails(int _intEventdId) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var oVarObj = _db.Events.Where(x => x.intEventsId.Equals(_intEventdId) ).SingleOrDefault(); if (oVarObj != null) { oVarObj.chrIsDeleted = 'Y'; oVarObj.dtDeletedOn = DateTime.Now; _db.SubmitChanges(); oVarObj = null; } } }
/// Function Header******************************************************* /// Function Name: ActivateDeactivateEvent /// Function Type: Function /// Functionality: used to update the activation and deactivation /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public void ActivateDeactivateEvent(int _intEventId) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var oVarObj = _db.Events.Where(x => x.intEventsId.Equals(_intEventId) ).SingleOrDefault(); if (oVarObj != null) { oVarObj.chrIsActive = oVarObj.chrIsActive.Equals('Y') ? 'N' : 'Y'; oVarObj.dtModifiedOn = DateTime.Now; _db.SubmitChanges(); oVarObj = null; } } }
/// Function Header******************************************************* /// Function Name: GetCompanyDetailsById /// Function Type: Function /// Functionality: used to get the details of company by companyid /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public Entity.CompanyInfo CheckEmailIDExistsInCompany(string strEmailId) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var _varCompDuplicate = (from _au in _db.CompanyInfos where _au.strCompanyEmail.Equals(strEmailId.ToLower()) && _au.chrIsActive.Equals('Y') select new Entity.CompanyInfo { StrEmpEmail = _au.strCompanyEmail, StrCompanyName = _au.strCompanyName, IntUserId = 1 } ).FirstOrDefault(); return _varCompDuplicate; } }
/// Function Header******************************************************* /// Function Name: DeleteNewsAnnouncements /// Function Type: Function /// Functionality: used to save the details of news and announcements /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public void DeleteNewsAnnouncements(int _intNewsAnnouncementsId) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var _varDup = _db.NewsandAnnouncements.Where(x => x.intNewsAnnouncementsId.Equals(_intNewsAnnouncementsId) ).SingleOrDefault(); if (_varDup != null) { _varDup.chrIsDelelte = 'Y'; _varDup.dtDeletedOn = DateTime.Now; _db.SubmitChanges(); _varDup = null; } } }
/// Function Header******************************************************* /// Function Name: SearchCompanies /// Function Type: Function /// Functionality: used to search the details of company /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public Entity.CompanyInfo CheckCompanyLogin(string strEmail, string strPassword) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var _varCompanyInfo = (from _ci in _db.CompanyInfos where _ci.chrIsDeleted.Equals('N') && _ci.strCompanyEmail.ToLower().Equals(strEmail.ToLower()) && _ci.strPassword.Equals(strPassword) select new Entity.CompanyInfo() { ChrIsActive = _ci.chrIsActive ?? 'Y', IntCompanyId = _ci.intCompanyId, ChrIsApproved = _ci.chrIsApproved ?? 'Y' }).FirstOrDefault(); return _varCompanyInfo; } }
/// Function Header******************************************************* /// Function Name: GetAllQuestionnaires /// Function Type: Function /// Functionality: used to update the details /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public List<Entity.QuestionnaireInfo> GetAllQuestionnaires() { using (TLWDALDataContext _db = new TLWDALDataContext()) { return (from _q in _db.Questionnaires where _q.chrIsDeleted.Equals('N') select new Entity.QuestionnaireInfo() { StrQuestion = _q.strQuestion, IntQuestionnaireId = _q.intQuestionnaireId, ChrDisplayYes = _q.chrDisplayYes, ChrDisplayNo = _q.chrDisplayNo, ChrDisplayDontKnow = _q.chrDisplayDontKnow, ChrIsActive = _q.chrIsActive, IntQuestionnaireType = _q.intQuestionnaireType, DtCreatedDate = _q.dtCreatedDate, StrQuestionHeading = _q.strQuestionHeading }).ToList(); } }
/// Function Header******************************************************* /// Function Name: GetAllEvents /// Function Type: Function /// Functionality: used to get the details /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public List<Entity.FAQTopicInfo> GetAllFAQTopics() { using (TLWDALDataContext _db = new TLWDALDataContext()) { var _varFAQRet = (from _faq in _db.FaqTopics where _faq.chrIsDeleted.Equals('N') orderby _faq.strFaqTopic ascending select new Entity.FAQTopicInfo { Int_FAQTopicId = _faq.int_FAQTopicId, StrFaqTopic = _faq.strFaqTopic, DtCreatedOn = _faq.dtCreatedOn, StrCreatedBy = _faq.strCreatedBy, } ).ToList(); return _varFAQRet; } }
/// Function Header******************************************************* /// Function Name: GetAllHotSectionsByPrimaryId /// Function Type: Function /// Functionality: used to get the details /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public Entity.HotSectionDetailsInfo GetAllHotSectionsByPrimaryId(int _intHotSectionId) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var _varRetResult = (from _hs in _db.HotSectionDetails where _hs.intHotSectionId.Equals(_intHotSectionId) && _hs.chrIsDeleted.Equals('N') select new Entity.HotSectionDetailsInfo { IntHotSectionId = _hs.intHotSectionId, StrHeading = _hs.strHeading, StrDescription = _hs.strDescription, DtCreatedOn = _hs.dtCreatedOn, StrLink = _hs.strLink ?? string.Empty, ChrIsDeleted = _hs.chrIsDeleted, GuidUserId = _hs.guidUserId }).SingleOrDefault(); return _varRetResult; } }
/// Function Header******************************************************* /// Function Name: GetAllEvents /// Function Type: Function /// Functionality: used to get the details /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public List<Entity.LibraryInfo> GetAllLibraries() { using (TLWDALDataContext _db = new TLWDALDataContext()) { return (from _q in _db.Libraries where _q.chrIsDeleted.Equals('N') orderby _q.dtModifiedDate descending select new Entity.LibraryInfo() { IntLibraryId = _q.intLibraryId, StrTitle = _q.strTitle, StrDescription = _q.strDescription, StrCategory = _q.strCategory, StrLocation = _q.strLocation, StrLocationType = _q.strLocationType, DtLibraryDate = _q.dtLibraryDate ?? DateTime.Now, DtCreatedDate = _q.dtCreatedDate, DtModifiedDate = _q.dtModifiedDate, ChrIsActive = _q.chrIsActive ?? 'Y' }).ToList(); } }
/// Function Header******************************************************* /// Function Name: UpdateQuestionnaireDetails /// Function Type: Function /// Functionality: used to update the details /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public void DeleteFAQTopicDetails(int _intFAQTopicId) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var oFaqTopic = _db.FaqTopics.Where(x => x.int_FAQTopicId.Equals(_intFAQTopicId)).FirstOrDefault(); if (oFaqTopic != null) { var _varFAQ = _db.FAQs.Where(x => x.strHeading.ToLower().Equals(oFaqTopic.strFaqTopic.ToLower())).ToList(); foreach (var item in _varFAQ) { item.chrisDeleted = 'Y'; item.dtDeletedOn = oFaqTopic.dtDeletedOn; _db.SubmitChanges(); } oFaqTopic.chrIsDeleted = 'Y'; oFaqTopic.dtDeletedOn = DateTime.Now; _db.SubmitChanges(); oFaqTopic = null; } } }
/// Function Header******************************************************* /// Function Name: GetAllNewsAnnouncements /// Function Type: Function /// Functionality: used to get all the news and announcements /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public List<Entity.NewsInfo> GetActiveNewsAnnouncements() { using (TLWDALDataContext _db = new TLWDALDataContext()) { var _varRetVal = (from _na in _db.NewsandAnnouncements where _na.chrIsDelelte.Equals('N') && _na.chrIsActive.Equals('Y') orderby _na.dtModifiedOn descending select new Entity.NewsInfo() { IntNewsAnnouncementsId = _na.intNewsAnnouncementsId, StrPDFFilename = _na.strPDFFilename, StrDescription = _na.strDescription ?? "", StrHeading = _na.strHeading, ChrIsActive = _na.chrIsActive ?? 'Y', ChrIsDelelte = _na.chrIsDelelte ?? 'N', ChrIsHomePage = _na.chrIsHomePage ?? 'Y', DtCreatedOn = _na.dtCreatedOn, DtModifiedOn = _na.dtModifiedOn ?? DateTime.Now, StrDirectLink = _na.strDirectLink ?? "" }).ToList(); return _varRetVal; } }
/// Function Header******************************************************* /// Function Name: InesrtSectionVisitedDetails /// Function Type: Function /// Functionality: used to insert the section visited details /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public void InesrtSectionVisitedDetails(Entity.UserInfo oUserInfo) { using (TLWDALDataContext _db = new TLWDALDataContext()) { bool blnIsExists = false; var _varSectionVisited = (from _sv in _db.SectionVisiteds orderby _sv.dtCreatedOn descending select _sv ).ToList().Take(1); if (_varSectionVisited != null) { if (_varSectionVisited.ElementAt(0).strSectionVisited.ToLower().Equals(oUserInfo.StrSectionVisited.ToLower()) && _varSectionVisited.ElementAt(0).strUserId.ToLower().Equals(oUserInfo.StrUserId.ToLower())) { blnIsExists = true; } } if (!blnIsExists) { DAL.SectionVisited oSectionVisited = new SectionVisited(); oSectionVisited.strUserId = oUserInfo.StrUserId; oSectionVisited.strUserType = oUserInfo.StrUserType; oSectionVisited.dtCreatedOn = oUserInfo.DtCreatedOn; oSectionVisited.strAgent = oUserInfo.StrAgent; oSectionVisited.strVisitedIP = oUserInfo.StrVisitedIP; oSectionVisited.strSectionVisited = oUserInfo.StrSectionVisited; _db.SectionVisiteds.InsertOnSubmit(oSectionVisited); _db.SubmitChanges(); oSectionVisited = null; } } }
/// Function Header******************************************************* /// Function Name: GetAllEvents /// Function Type: Function /// Functionality: used to get the details /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public List<Entity.EventInfo> SearchEvents(char _chrStatus, string _strUserName) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var _varEvents = (from _q in _db.Events where _q.chrIsDeleted.Equals('N') orderby _q.dtModifiedOn descending select new Entity.EventInfo() { IntEventsId = _q.intEventsId, StrUserName = _q.strUserName, DtEventDate = _q.dtEventDate, StrActivity = _q.strActivity, StrLocation = _q.strLocation, StrComments = _q.strComments, ChrStatus = _q.chrStatus, ChrIsActive = _q.chrIsActive ?? 'Y', DtCreatedOn = _q.dtCreatedOn ?? DateTime.Now }).ToList(); var _varRetObj = _varEvents; if (_chrStatus.Equals('A') || _chrStatus.Equals('D')) _varRetObj = _varRetObj.Where(x => x.ChrStatus.Equals(_chrStatus)).ToList(); if (_chrStatus.Equals('Y') || _chrStatus.Equals('N')) _varRetObj = _varRetObj.Where(x => x.ChrIsActive.Equals(_chrStatus)).ToList(); if (!_strUserName.ToString().Equals("0")) _varRetObj = _varRetObj.Where(x => x.StrUserName.Equals(_strUserName)).ToList(); return _varRetObj; } }
/// Function Header******************************************************* /// Function Name: SaveEventDetails /// Function Type: Function /// Functionality: used to save the details of event /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public int SaveEventDetails(Entity.EventInfo oEventInfo) { using (TLWDALDataContext _db = new TLWDALDataContext()) { int intRetVal = 0; DAL.Event oEventDAL = new Event(); oEventDAL.strUserName = oEventInfo.StrUserName; oEventDAL.dtEventDate = oEventInfo.DtEventDate; oEventDAL.strActivity = oEventInfo.StrActivity; oEventDAL.strLocation = oEventInfo.StrLocation; oEventDAL.strComments = oEventInfo.StrComments; oEventDAL.chrStatus = oEventInfo.ChrStatus; oEventDAL.dtCreatedOn = oEventInfo.DtCreatedOn; oEventDAL.chrIsDeleted = oEventInfo.ChrIsDeleted; oEventDAL.chrIsActive = oEventInfo.ChrIsActive; oEventDAL.dtModifiedOn = oEventInfo.DtCreatedOn; _db.Events.InsertOnSubmit(oEventDAL); _db.SubmitChanges(); intRetVal = oEventDAL.intEventsId; oEventDAL = null; oEventInfo = null; return intRetVal; } }
public List<Entity.EventInfo> GetWellnessData(string _strUserName) { using (TLWDALDataContext _db = new TLWDALDataContext()) { //var result = from customer in _db.tbl_wellnessEntries // where customer.UserName.Equals(_strUserName) // select customer; //return result.ToList(); return (from cust in _db.tbl_wellnessEntries where cust.UserName.Equals(_strUserName) select new Entity.EventInfo() { IntEventsId = cust.Id, UserName = cust.UserName, Sleep =Convert.ToInt32(cust.Sleep), Stress=Convert.ToInt32(cust.Stress), Outlook = Convert.ToInt32(cust.Outlook), Engagement = Convert.ToInt32(cust.Engagement), Energy = Convert.ToInt32(cust.Energy), Day = cust.Day, Dates = Convert.ToDateTime(cust. Dates) }).ToList(); } }
/// Function Header******************************************************* /// Function Name: GetEventByEventId /// Function Type: Function /// Functionality: used to get the details by id /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public Entity.EventInfo GetEventByEventId(int _intEventId) { using (TLWDALDataContext _db = new TLWDALDataContext()) { return (from _q in _db.Events where _q.chrIsDeleted.Equals('N') && _q.intEventsId.Equals(_intEventId) select new Entity.EventInfo() { IntEventsId = _q.intEventsId, StrUserName = _q.strUserName, DtEventDate = _q.dtEventDate, StrActivity = _q.strActivity, StrLocation = _q.strLocation, StrComments = _q.strComments, ChrStatus = _q.chrStatus, DtCreatedOn = _q.dtCreatedOn ?? DateTime.Now, ChrIsActive = _q.chrIsActive ?? 'Y' }).FirstOrDefault(); } }
/// Function Header******************************************************* /// Function Name: UpdateCompanyApprovedStatus /// Function Type: Function /// Functionality: used to disapproved the company /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public void UpdateRequestUserStatus(List<Entity.CompanyInfo> objListCompanyInfo) { using (TLWDALDataContext _db = new TLWDALDataContext()) { foreach (var item in objListCompanyInfo) { var _varCompInfo = _db.CompanyRequestedUsersLists.Where(x => x.intCompanyRequestedUsersListId.Equals(item.IntCompanyRequestedUsersListId)).FirstOrDefault(); if (_varCompInfo != null) { _varCompInfo.chrStatus = item.ChrStatus; _varCompInfo.dtModifiedDate = item.DtModifiedDate; _db.SubmitChanges(); } } } }
/// Function Header******************************************************* /// Function Name: UpdateCompanyApprovedStatus /// Function Type: Function /// Functionality: used to disapproved the company /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public void UpdateCompanyApprovedStatus(List<Entity.CompanyInfo> objListCompanyInfo) { using (TLWDALDataContext _db = new TLWDALDataContext()) { foreach (var item in objListCompanyInfo) { var _varCompInfo = _db.CompanyInfos.Where(x => x.intCompanyId.Equals(item.IntCompanyId)).FirstOrDefault(); if (_varCompInfo != null) { _varCompInfo.chrIsApproved = item.ChrIsApproved; _db.SubmitChanges(); } } } }
/// Function Header******************************************************* /// Function Name: UpdateCompanyDetails /// Function Type: Function /// Functionality: used to Update the details of company /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public void UpdateCompanyActiveStatus(int intCompanyId, DateTime dtModifiedDate) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var _varCompInfo = _db.CompanyInfos.Where(x => x.intCompanyId.Equals(intCompanyId)).FirstOrDefault(); if (_varCompInfo != null) { _varCompInfo.chrIsActive = _varCompInfo.chrIsActive.Equals('Y') ? 'N' : 'Y'; _varCompInfo.dtModifiedDate = dtModifiedDate; var varAspMembeShip = _db.aspnet_Memberships.Where(x => x.UserId.Equals(_varCompInfo.strUserID)).FirstOrDefault(); varAspMembeShip.IsApproved = _varCompInfo.chrIsActive.Equals('Y') ? true : false; _db.SubmitChanges(); } } }
/// Function Header******************************************************* /// Function Name: UpdateEventDetails /// Function Type: Function /// Functionality: used to update the details of event /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public int UpdateEventDetails(Entity.EventInfo oEventInfo) { using (TLWDALDataContext _db = new TLWDALDataContext()) { int intRetVal = 0; DAL.Event oEventDAL = _db.Events.Where(x => x.intEventsId.Equals(oEventInfo.IntEventsId)).FirstOrDefault(); oEventDAL.dtEventDate = oEventInfo.DtEventDate; oEventDAL.strActivity = oEventInfo.StrActivity; oEventDAL.strLocation = oEventInfo.StrLocation; oEventDAL.strComments = oEventInfo.StrComments; oEventDAL.chrStatus = oEventInfo.ChrStatus; oEventDAL.dtModifiedOn = oEventInfo.DtCreatedOn; oEventDAL.chrIsActive = oEventInfo.ChrIsActive; _db.SubmitChanges(); intRetVal = oEventDAL.intEventsId; oEventDAL = null; oEventInfo = null; return intRetVal; } }
/// Function Header******************************************************* /// Function Name: SearchCompanies /// Function Type: Function /// Functionality: used to search the details of company /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public List<Entity.CompanyInfo> SearchRequestedUsersForCompanies(int intCompanyId, char chrStatus) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var _varCompanyInfo = (from _ci in _db.CompanyRequestedUsersLists where _ci.chrStatus.Equals(chrStatus) && _ci.intCompanyId.Equals(intCompanyId) select new Entity.CompanyInfo() { StrEmpCode = _ci.strEmpCode, StrEmpEmail = _ci.strEmpEmail, StrEmpFirstName = _ci.strEmpFirstName + " " + _ci.strEmpMiddleName + " " + _ci.strEmpLastName ?? "", DtCreatedDate = _ci.dtCreatedDate ?? DateTime.Now, IntCompanyRequestedUsersListId = _ci.intCompanyRequestedUsersListId, IntCompanyId = _ci.intCompanyId, StrCompanyName = _db.CompanyInfos.Where(x => x.intCompanyId.Equals(_ci.intCompanyId)).Select(x => x.strCompanyName).FirstOrDefault(), DtModifiedDate = _ci.dtModifiedDate ?? _ci.dtCreatedDate ?? DateTime.Now, ChrStatus = _ci.chrStatus ?? 'I' //ChrIsApproved = _ci.chrIsApproved ?? 'Y' }).ToList(); return _varCompanyInfo; } }
/// Function Header******************************************************* /// Function Name: UpdateCompanyDetails /// Function Type: Function /// Functionality: used to Update the details of company /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* /// 04/09/12 David K. Bowers fixed a bug where address change was not getting stored in db /// 04/10/12 David K Bowers added in zip code public int UpdateCompanyDetails(Entity.CompanyInfo oCompanyInfo) { using (TLWDALDataContext _db = new TLWDALDataContext()) { int intRetVal = 0; if (intRetVal.Equals(0)) { DAL.CompanyInfo oCompanyInfoDAL = _db.CompanyInfos.Where(x => x.intCompanyId.Equals(oCompanyInfo.IntCompanyId)).FirstOrDefault(); oCompanyInfoDAL.strCompanyName = oCompanyInfo.StrCompanyName; oCompanyInfoDAL.strCompanyPhone = oCompanyInfo.StrCompanyPhone; oCompanyInfoDAL.strCompanyFax = oCompanyInfo.StrCompanyFax; oCompanyInfoDAL.intCountryId = oCompanyInfo.IntCountryId; oCompanyInfoDAL.intStateId = oCompanyInfo.IntStateId; oCompanyInfoDAL.strStateText = oCompanyInfo.StrStateName; oCompanyInfoDAL.strZipCode = oCompanyInfo.StrZipCode; oCompanyInfoDAL.strCity = oCompanyInfo.StrCity; //04/09/12 David K. Bowers fixed a bug where address change was not getting stored in db oCompanyInfoDAL.strCompanyAddress = oCompanyInfo.StrCompanyAddress; oCompanyInfoDAL.chrIsActive = oCompanyInfo.ChrIsActive; oCompanyInfoDAL.dtModifiedDate = oCompanyInfo.DtModifiedDate; oCompanyInfoDAL.chrIsApproved = oCompanyInfo.ChrIsApproved; _db.SubmitChanges(); intRetVal = oCompanyInfoDAL.intCompanyId; oCompanyInfoDAL = null; oCompanyInfo = null; } return intRetVal; } }
/// Function Header******************************************************* /// Function Name: GetAllEvents /// Function Type: Function /// Functionality: used to get the details /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public List<Entity.EventInfo> GetAllEvents() { using (TLWDALDataContext _db = new TLWDALDataContext()) { return (from _q in _db.Events where _q.chrIsDeleted.Equals('N') orderby _q.dtModifiedOn descending select new Entity.EventInfo() { IntEventsId = _q.intEventsId, StrUserName = _q.strUserName, DtEventDate = _q.dtEventDate, StrActivity = _q.strActivity, StrLocation = _q.strLocation, StrComments = _q.strComments, ChrStatus = _q.chrStatus, ChrIsActive = _q.chrIsActive ?? 'Y' }).ToList(); } }
/// Function Header******************************************************* /// Function Name: SearchCompanies /// Function Type: Function /// Functionality: used to search the details of company /// Input: /// Output: /// Return Value: /// Note: /// ********************************************************************* public List<Entity.CompanyInfo> SearchCompanies(Entity.CompanyInfo oCompanyInfo) { using (TLWDALDataContext _db = new TLWDALDataContext()) { var _varCompanyInfo = (from _ci in _db.CompanyInfos where _ci.chrIsDeleted.Equals('N') && _ci.chrIsApproved.Equals('Y') orderby _ci.dtCreatedDate descending select new Entity.CompanyInfo() { StrCompanyName = _ci.strCompanyName, StrCompanyEmail = _ci.strCompanyEmail, StrCompanyPhone = _ci.strCompanyPhone, ChrIsActive = _ci.chrIsActive ?? 'Y', DtCreatedDate = _ci.dtCreatedDate ?? DateTime.Now, DtModifiedDate = _ci.dtModifiedDate ?? DateTime.Now, IntCompanyId = _ci.intCompanyId, ChrIsApproved = _ci.chrIsApproved ?? 'Y' }).ToList(); var _varRetVal = _varCompanyInfo; if (!oCompanyInfo.StrCompanyEmail.Equals(string.Empty)) _varRetVal = _varRetVal.Where(x => x.StrCompanyEmail.ToLower().Contains(oCompanyInfo.StrCompanyEmail.ToLower())).ToList(); if (!oCompanyInfo.StrCompanyName.Equals(string.Empty)) _varRetVal = _varRetVal.Where(x => x.StrCompanyName.ToLower().Contains(oCompanyInfo.StrCompanyName.ToLower())).ToList(); if (!oCompanyInfo.ChrIsActive.Equals('X')) _varRetVal = _varRetVal.Where(x => x.ChrIsActive.Equals(oCompanyInfo.ChrIsActive)).ToList(); return _varRetVal; } }