protected void Page_Load(object sender, EventArgs e) { try { Response.Expires = -1; infobar.Visible = false; ResolveDepedencies(); GetQueryStrings(); bCreateGroupOrProgramFromOffer = MyCommon.Fetch_CM_SystemOption(134) == "1" ? true : false; bEnableRestrictedAccessToUEOfferBuilder = MyCommon.Fetch_SystemOption(249) == "1" ? true : false; AssignPageTitle("term.offer", "term.eligibilitycustomercondition", OfferID.ToString()); if (!IsPostBack) { SetUpAndLocalizePage(); CustomerGroupConditions objCustomerGroupConditions = m_CustCondition.GetOfferCustomerCondition(OfferID, EngineID); if (objCustomerGroupConditions != null) { IncludedConditionGroup = (from p in objCustomerGroupConditions.IncludeCondition where p.Deleted == false & p.CustomerGroupID != 0 select p.CustomerGroup).ToList(); ExcludedConditionGroup = (from p in objCustomerGroupConditions.ExcludeCondition where p.Deleted == false & p.CustomerGroupID != 0 select p.CustomerGroup).ToList(); } GetOfferEligibleCustomerCondition(); GetAllCustomerGroup(); IncludedGroup = (from p in OfferEligibileCustomerGroupCondition.IncludeCondition where p.Deleted == false select p.CustomerGroup).ToList(); List <CustomerGroup> IncludedGroupsWithPhrase = IncludedGroup.Where(p => p.PhraseID != null).ToList(); foreach (CustomerGroup cgroup in IncludedGroupsWithPhrase) { cgroup.Name = PhraseLib.Lookup((Int32)cgroup.PhraseID, LanguageID).Replace("'", "'"); } ExcludedGroup = (from p in OfferEligibileCustomerGroupCondition.ExcludeCondition where p.Deleted == false select p.CustomerGroup).ToList(); SetAvailableData(); chkDisallow_Edit.Checked = OfferEligibileCustomerGroupCondition.DisallowEdit; chkHouseHold.Checked = OfferEligibileCustomerGroupCondition.HouseHoldEnabled; chkOffline.Checked = OfferEligibileCustomerGroupCondition.EvaluateOfflineCustomer; SetButtons(); DisableControls(); } else { GetValuesFromHidden(); ScriptManager.RegisterStartupScript(this, this.GetType(), "selectAndFocus", " SetFoucs();", true); } } catch (Exception ex) { infobar.InnerText = ErrorHandler.ProcessError(ex); infobar.Visible = true; } }
private void CopyToSelectedGroup() { CustomerGroup custGroup = m_Offer.GetOfferDefaultCustomerGroup(hdnOfferID.Value.ConvertToLong(), hdnEngineID.Value.ConvertToInt32()); if (custGroup == null) { //delete Customer Eligibility Conditions m_Offer.DeleteOfferEligibleConditions(hdnOfferID.Value.ConvertToLong(), hdnEngineID.Value.ConvertToInt32()); //Copy all the customers from deleted default group to selected groups in customer conditions CustomerGroupConditions CustConditions = m_CustGroupCondition.GetOfferCustomerCondition(hdnOfferID.Value.ConvertToLong(), hdnEngineID.Value.ConvertToInt32()); if (DefaultCustomerGroup != null && DefaultCustomerGroup.GroupMembers != null && CustConditions != null) { foreach (CMS.AMS.Models.Customer customer in DefaultCustomerGroup.GroupMembers) { m_Offer.SatisfyCustomerCondition(CustConditions, customer.CustomerPK); } } //Group Deleted Successfully m_CustGroup.DeleteCustomerGroup(DefaultCustomerGroup.CustomerGroupID); ClientScript.RegisterStartupScript(this.GetType(), "pageclose", "<script>CloseModel()</script>"); } }