protected void deselect1_Click(object sender, EventArgs e) { if (lstSelected.SelectedItem != null) { foreach (int i in lstSelected.GetSelectedIndices()) { IncludedPointProgram.RemoveAt(i); } SetAvailableData(); } SetButtons(); }
protected void select1_Click(object sender, EventArgs e) { if (lstAvailable.SelectedItem != null) { foreach (int i in lstAvailable.GetSelectedIndices()) { IncludedPointProgram.Add(AvailableFilteredPointProgram[i]); } SetAvailableData(); } SetButtons(); }
protected void btnCreate_Click(object sender, EventArgs e) { string Name = string.Empty; if (MyCommon.Parse_Quotes(Logix.TrimAll(functioninput.Text)) != null) { Name = Convert.ToString(MyCommon.Parse_Quotes(Logix.TrimAll(functioninput.Text))); } if (!String.IsNullOrEmpty(Name)) { int AvailableListCount = AvailableFilteredPointProgram.Where(p => p.ProgramName.Equals(functioninput.Text, StringComparison.OrdinalIgnoreCase)).ToList().Count; int IncludedGroupCount = IncludedPointProgram.Where(p => p.ProgramName.Equals(functioninput.Text, StringComparison.OrdinalIgnoreCase)).ToList().Count; if (IncludedGroupCount > 0) { string alertMessage = Copient.PhraseLib.Lookup("term.pointsprogram", LanguageID) + ": " + Name + " " + Copient.PhraseLib.Lookup("term.is", LanguageID).ToLower() + " " + Copient.PhraseLib.Lookup("term.already", LanguageID).ToLower() + " " + Copient.PhraseLib.Lookup("term.selected", LanguageID).ToLower(); ScriptManager.RegisterStartupScript(UpdatePanelMain, UpdatePanelMain.GetType(), "AlertMessage", " AlertMessage('" + alertMessage + "');", true); } else if (AvailableListCount > 0) { string alertMessage = Copient.PhraseLib.Lookup("term.existing", LanguageID) + " " + Copient.PhraseLib.Lookup("term.pointsprogram", LanguageID).ToLower() + ": " + Name + " " + Copient.PhraseLib.Lookup("offer.message", LanguageID).ToLower(); ScriptManager.RegisterStartupScript(UpdatePanelMain, UpdatePanelMain.GetType(), "AlertMessage", " AlertMessage('" + alertMessage + "');", true); //First remove the selected point if exist any IncludedPointProgram.Clear(); IncludedPointProgram.Add(AvailableFilteredPointProgram.Where(p => p.ProgramName.Equals(functioninput.Text, StringComparison.OrdinalIgnoreCase)).FirstOrDefault()); SetAvailableData(); SetButtons(); } else { IncludedPointProgram.Clear(); //Then add newly created points program to the selected list IncludedPointProgram.Add(CreatePointsProgram()); SetAvailableData(); SetButtons(); } } else { string alertMessage = Copient.PhraseLib.Lookup("term.enter", LanguageID) + " " + Copient.PhraseLib.Lookup("term.valid", LanguageID).ToLower() + " " + Copient.PhraseLib.Lookup("term.pointsprogram", LanguageID).ToLower() + " " + Copient.PhraseLib.Lookup("term.name", LanguageID).ToLower(); ScriptManager.RegisterStartupScript(UpdatePanelMain, UpdatePanelMain.GetType(), "AlertMessage", " AlertMessage('" + alertMessage + "');", true); } }
private void GetOfferEligiblePointsCondition() { if (ConditionID > 0) { OfferEligibilePointsCondition = m_PointsCondition.GetConditionByID(ConditionID); } if (IncludedPointProgram == null) { IncludedPointProgram = new List <CMS.AMS.Models.PointsProgram>(); } if (OfferEligibilePointsCondition == null) { OfferEligibilePointsCondition = new CMS.AMS.Models.PointsCondition(); } else { CMS.AMS.Models.PointsProgram objPointsProgram = new CMS.AMS.Models.PointsProgram(); objPointsProgram.ProgramID = OfferEligibilePointsCondition.ProgramID; IncludedPointProgram.Add(OfferEligibilePointsCondition.PointsProgram); SetValues(OfferEligibilePointsCondition); } }
private void SetAvailableData() { GetAllPointsProgram(); AvailableFilteredPointProgram = AllPointsProgram.Where(p => !IncludedPointProgram.Any(inc => inc.ProgramID == p.ProgramID)).ToList(); string strFilter = functioninput.Text; if (functionradio1.Checked) { AvailableFilteredPointProgram = AvailableFilteredPointProgram.Where(p => p.ProgramName.StartsWith(strFilter, StringComparison.OrdinalIgnoreCase)).ToList(); } else { AvailableFilteredPointProgram = AvailableFilteredPointProgram.Where(p => p.ProgramName.IndexOf(strFilter, StringComparison.OrdinalIgnoreCase) >= 0).ToList(); } lstSelected.DataSource = IncludedPointProgram; lstSelected.DataBind(); lstAvailable.DataSource = AvailableFilteredPointProgram; lstAvailable.DataBind(); }