public MinBuyCalcForm() { InitializeComponent(); var abSearches = new List <DropDownOption> { new DropDownOption { Id = -1, DisplayValue = "-- Select Search --" } }; abSearches.AddRange(SearchDAL.GetSearches <PlayerSearchCriteria>().Select(a => new DropDownOption { Id = a.PkId, DisplayValue = a.Name })); cmb_abSearches.DataSource = abSearches; var abAccounts = new List <DropDownOption> { new DropDownOption { Id = -1, DisplayValue = "-- Select a account --" } }; abAccounts.AddRange(UserDAL.GetUsers().Select(a => new DropDownOption { Id = a.Id, DisplayValue = a.Email })); cmb_accounts.DataSource = abAccounts; }
private void btn_getMin_Click(object sender, EventArgs e) { if (cmb_abSearches.SelectedValue + "" == "-1") { MessageBox.Show("Select a search"); return; } if (cmb_accounts.SelectedValue + "" == "-1") { MessageBox.Show("Login And select a account to run search with"); return; } lbl_minResult.Visible = true; var playerSearchCriteria = SearchDAL.GetSearch <PlayerSearchCriteria>(cmb_abSearches.SelectedValue); var userCrendential = UserDAL.GetUser(cmb_accounts.SelectedValue); var loginResult = LoginAccount(userCrendential); if (loginResult == "Loggedin Successfully") { TransferHelper helper = new TransferHelper(userCrendential); var minPriceResults = helper.GetMinPrice(playerSearchCriteria); grd_minPrices.DataSource = minPriceResults; grd_minPrices.Visible = true; lbl_minResult.Text = $"Top {minPriceResults.Count} Min Price for the search"; } else { MessageBox.Show("Error occured when trying to login"); } }
private void btn_editSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txt_searchSaveName.Text)) { MessageBox.Show("Search Name Required"); return; } PlayerSearchCriteria criteria = GetSearchCritieriaFromForm(); if (grd_searchList.SelectedRows.Count > 0) { object pkId = grd_searchList.SelectedRows[0].Cells["PkId"].Value; criteria.PkId = Convert.ToInt32(pkId); SearchDAL.UpdateSearch(criteria); } else { SearchDAL.SaveSearch(criteria); } SearchList_Load(sender, e); HideSearchForm(); }
public void addItem(LoginDTO credentials, ItemDTO items) { using (SearchDAL db = new SearchDAL(credentials.username, credentials.password)) { db.addItem(ItemDTOconversion(items)); } }
public List <CategoryDTO> categories(LoginDTO credentials) { List <Category> categories; using (SearchDAL db = new SearchDAL(credentials.username, credentials.password)) { categories = db.getCategories(); } return(categoryDTOConversion(categories)); }
public List <ResultsDTO> getResults(LoginDTO credentials, SearchCriteriaDTO criteria) { List <Item> items; using (SearchDAL db = new SearchDAL(credentials.username, credentials.password)) { items = db.getItems(criteria); } return(resultsDTOConversion(items)); }
private void btn_editSearch_Click(object sender, EventArgs e) { if (grd_searchList.SelectedRows.Count > 0) { object pkId = grd_searchList.SelectedRows[0].Cells["PkId"].Value; PlayerSearchCriteria criteria = SearchDAL.GetSearch <PlayerSearchCriteria>(pkId); FillFormFormCriteria(criteria); } ShowSearchForm(); }
public AccountList(Action <bool> longOperationCB) { InitializeComponent(); HideEditForm(); List <DropDownCheckOption> options = new List <DropDownCheckOption>(); options.AddRange(SearchDAL.GetSearches <PlayerSearchCriteria>().Select(a => new DropDownCheckOption { Id = a.PkId, DisplayValue = a.Name })); this.cmb_searches.Items.AddRange(options.ToArray()); _longOperationCB = longOperationCB; }
public List <PersonDTO> persons(LoginDTO credentials) { List <Person> people; using (SearchDAL db = new SearchDAL(credentials.username, credentials.password)) { people = db.getPeople(); } return(personDTOConversion(people)); }
private void btn_deleteSearch_Click(object sender, EventArgs e) { if (grd_searchList.SelectedRows.Count > 0) { object pkId = grd_searchList.SelectedRows[0].Cells["PkId"].Value; SearchDAL.DeleteSearch <PlayerSearchCriteria>(pkId); tab_searchPlayer.Controls.ResetAllControls(); SearchList_Load(sender, e); } HideSearchForm(); }
public DataTable Search_CustomerInformationBLL(Customer aCustomer, OrderDetails aOrderDetails) { DataTable dt = null; if (aCustomer.ID == 0 && aCustomer.ContactNo == "" && aCustomer.Address == "" && aCustomer.name == "" && aOrderDetails.IssueDate == "" && aOrderDetails.DeliveryDate == "") { return(dt); } else { SearchDAL aSearchDAL = new SearchDAL(); dt = aSearchDAL.Search_CustomerInformationDALL(aCustomer, aOrderDetails); return(dt); } }
public DataTable SearchResultBLL(Customer aCustomer, Record aRecord, Room aRoom) { DataTable dTable = null; if (aCustomer.Id == 0 && aCustomer.Name == "" && aCustomer.Age == 0 && aCustomer.ProfessionAddress == "" && aCustomer.PresentAddress == "" && aCustomer.PermanentAddress == "" && aCustomer.ContactNo == "" && aCustomer.Email == "" && aCustomer.NIDorPassportNo == "" && aRoom.Floor == "" && aRecord.RoomNO == "" && aRecord.BookingDate == "" && aRecord.CheckInDate == "" && aRecord.CheckOutDate == "" && aRecord.BookingDate == "yyyy-MM-dd" && aRecord.CheckInDate == "yyyy-MM-dd" && aRecord.CheckOutDate == "yyyy-MM-dd") { return(dTable); } else { SearchDAL aSearchDDAL = new SearchDAL(); dTable = aSearchDDAL.SearchResultDAL(aCustomer, aRecord, aRoom); return(dTable); } }
private void SearchList_Load(object sender, EventArgs e) { List <PlayerSearchCriteria> playerSearchCriterias = SearchDAL.GetSearches <PlayerSearchCriteria>(); grd_searchList.DataSource = playerSearchCriterias.ToDataTable(); if (playerSearchCriterias.Any()) { lbl_noSearches.Visible = false; grd_searchList.Visible = true; } else { lbl_noSearches.Visible = true; grd_searchList.Visible = false; } }
public bool testCredentials(LoginDTO credentials) { if (credentials.username != "" && credentials.password != "") { try { using (SearchDAL db = new SearchDAL(credentials.username, credentials.password)) { return(true); } } catch { return(false); } } return(false); }
public SearchList() { InitializeComponent(); HideSearchForm(); cmb_srchPlayerQuality.DataSource = DropDownHelper.GetQualities(); cmb_srchPlayerRarity.DataSource = DropDownHelper.GetRarities(); cmb_srchPlayerLeague.DataSource = DropDownHelper.GetLeagues(); cmb_srchPlayerClub.DataSource = DropDownHelper.GetClubs(); var abSettings = new List <DropDownOption> { new DropDownOption { Id = -1, DisplayValue = "-- AB Setting --" } }; abSettings.AddRange(SettingDAL.GetSettings().Select(a => new DropDownOption { Id = a.PkId, DisplayValue = a.Name })); cmb_abSettings.DataSource = abSettings; ac_playerName.DataSource = SearchDAL.GetPlayersForAutoSuggest().Select(a => a.DisplayName).Distinct().ToList(); }
public string GetList() { SearchDAL search = new SearchDAL(this.PickupLocation, this.PickupDate, this.ReturnLocarion, this.ReturnDate); return(search.GetCars()); }
public SearchBO() { searchDAL = new SearchDAL(); }
public ActionResult SearchResult(string searchKey, string searchType) { try { searchKey = searchKey.Trim(); if (searchKey != "") { if (searchType == "thread") { var resultThread = new List <ThreadBasicInfo>(); using (var db = new SearchDAL()) { List <Thread> searchThread = db.SearchThreads(searchKey); if (searchThread.Count < 1) { return(Json(new { status = "empty" }, JsonRequestBehavior.AllowGet)); } foreach (Thread thread in searchThread) { List <String> threadImage = db.GetAllImageThreadById(thread.ThreadId); resultThread.Add(new ThreadBasicInfo { ThreadID = thread.ThreadId, UserID = thread.UserId, ThreadName = thread.Title, ImageUrl = threadImage, ShortDescription = thread.ShortDescription, Status = thread.Status, CreatedDate = thread.CreatedDate.ToString("H:mm:ss MM/dd/yy") }); } } return(Json(new { data = resultThread, type = searchType }, JsonRequestBehavior.AllowGet)); } else if (searchType == "user") { var resultUser = new List <SearchUser>(); using (var db = new SearchDAL()) { List <Ws_User> searchUser = db.SearchUsers(searchKey); if (searchUser.Count < 1) { return(Json(new { status = "empty" }, JsonRequestBehavior.AllowGet)); } foreach (Ws_User user in searchUser) { resultUser.Add(db.GetUserInfoById(user.UserID, user.UserName)); } } return(Json(new { data = resultUser, type = searchType }, JsonRequestBehavior.AllowGet)); } else if (searchType == "userinfo") { var resultUser = new List <SearchUser>(); using (var db = new SearchDAL()) { List <User_Information> searchUser = db.SearchUserInfo(searchKey); if (searchUser.Count < 1) { return(Json(new { status = "empty" }, JsonRequestBehavior.AllowGet)); } foreach (User_Information user in searchUser) { resultUser.Add(new SearchUser { UserID = user.UserID, UserName = db.GetUserNameById(user.UserID), FullName = user.FullName, ProfileImage = user.ProfileImage, UserAddress = user.UserAddress, Phone = user.Phone, FacebookUrl = user.FacebookUrl }); } } return(Json(new { data = resultUser, type = searchType }, JsonRequestBehavior.AllowGet)); } else if (searchType == "event") { var resultEvent = new List <EventBasicInfo>(); using (var db = new SearchDAL()) { List <Event> searchEvent = db.SearchEvent(searchKey); if (searchEvent.Count < 1) { return(Json(new { status = "empty" }, JsonRequestBehavior.AllowGet)); } foreach (Event events in searchEvent) { var eventMainImage = db.GetMainImageEventById(events.EventID); resultEvent.Add(new EventBasicInfo { EventID = events.EventID, CreatorID = events.CreatorID, EventName = events.EventName, MainImageUrl = eventMainImage.ImageUrl, ShortDescription = events.ShortDescription, Status = events.Status, CreatedDate = DateTime.Now.ToString("H:mm:ss MM/dd/yy") }); } } return(Json(new { data = resultEvent, type = searchType }, JsonRequestBehavior.AllowGet)); } else if (searchType == "organization") { var resultOrgz = new List <OrganizationBasicInfo>(); using (var db = new SearchDAL()) { List <Organization> getOrg = db.SearchOrganizations(searchKey); if (getOrg.Count < 1) { return(Json(new { status = "empty" }, JsonRequestBehavior.AllowGet)); } foreach (Organization org in getOrg) { resultOrgz.Add(new OrganizationBasicInfo { OrganizationId = org.OrganizationId, OrganizationName = org.OrganizationName, Introduction = org.Introduction, LogoUrl = org.LogoUrl, Phone = org.Phone, Email = org.Email, Address = org.Address, IsActive = org.IsActive, Point = org.Point }); } } return(Json(new { data = resultOrgz, type = searchType }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { status = "error" }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { status = "emptyinput" }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { //ViewBag.ErrorMessage = ex; return(Redirect("/#/Error")); } }
public XmlDocument SearchUserByMobile(string mobileNo) { try { string[] uregid = mobileNo.Split('$'); mobileNo = objenc.DecryptInteger(uregid[0], uregid[1]); XmlDocument xmlDocument = new XmlDocument(); SearchBAL searchBal = new SearchBAL(mobileNo); if (searchBal.isValid()) { SearchDAL searchDal = new SearchDAL(); searchDal.SearchUserByMobile(mobileNo); if (searchDal.isError == CommonCode.OK) { if (searchDal.userData != null && searchDal.userData.Tables[0].Rows.Count != 0) { searchDal.userData.Tables[0].TableName = "FamilyDetails"; XmlDataDocument xmlDataDocument = new XmlDataDocument(searchDal.userData); XmlElement element = xmlDataDocument.DocumentElement; return(xmlDataDocument); } else if (searchDal.userData.Tables[0].Rows.Count == 0) { XmlDocument doc = new XmlDocument(); XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null); doc.AppendChild(docNode); XmlNode errrorNode = doc.CreateElement("ErrorMainNode"); doc.AppendChild(errrorNode); XmlNode nameNode = doc.CreateElement("Error"); nameNode.AppendChild(doc.CreateTextNode(CommonCode.DATA_NOT_FOUND.ToString())); errrorNode.AppendChild(nameNode); return(doc); } } else { XmlDocument doc = new XmlDocument(); XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null); doc.AppendChild(docNode); XmlNode errrorNode = doc.CreateElement("ErrorMainNode"); doc.AppendChild(errrorNode); XmlNode nameNode = doc.CreateElement("Error"); nameNode.AppendChild(doc.CreateTextNode(Convert.ToString(searchDal.isError))); errrorNode.AppendChild(nameNode); } } else { XmlDocument doc = new XmlDocument(); XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null); doc.AppendChild(docNode); XmlNode errrorNode = doc.CreateElement("ErrorMainNode"); doc.AppendChild(errrorNode); XmlNode nameNode = doc.CreateElement("Error"); nameNode.AppendChild(doc.CreateTextNode(Convert.ToString(CommonCode.WRONG_INPUT))); errrorNode.AppendChild(nameNode); } return(xmlDocument); } catch { CommonCode commonCode = new CommonCode(); return(commonCode.ErrorXml(CommonCode.SQL_ERROR)); } }