private bool IsDuplicateOwnerName(MFCustomer cust) { if (!(cust.Party is Person)) { return(false); } Person p = (Person)cust.Party; IList <MFCustomer> secCustomer = SecondaryOwners; Person person = null; bool isEqualAll = false; for (int i = 0; i < secCustomer.Count; i++) { if (secCustomer[i].Party is Person) { person = (Person)secCustomer[i].Party; for (int j = 0; j < person.CurrentName.ToMultilingualString().Values.Count; j++) { MLSValue mls = person.CurrentName.ToMultilingualString().Values[j]; isEqualAll = person.CurrentName.ToMultilingualString().GetValue(mls.Language.Code) .Equals(p.CurrentName.ToMultilingualString().GetValue(mls.Language.Code)); } if (isEqualAll) { return(isEqualAll); } } } return(isEqualAll); }
protected void CallbackTest_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { String index = e.Parameter; MFCustomer cus = (MFCustomer)GridCustomer.GetRow(int.Parse(index)); Session["CurrentParty"] = cus.Party.PartyID; }
protected void cbSendAcc_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { String code = e.Parameter; MFCustomer customer = MFCustomer.FindByCustomerNo(iSabayaContext, code); if (customer != null) { e.Result = customer.FullName; } }
protected void cbpGridAccountOutput_Callback(object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) { MFCustomer customer = this.MFCustomer; String currentLanguage = (String)Session["CurrentLanguage"]; IList <MFAccount> accounts = MFAccount.FindByMFCustomer(iSabayaContext, customer); gridAccountOutput.DataSource = accounts; gridAccountOutput.DataBind(); Session[this.ID + "cbpGridAccountOutput"] = accounts; }
protected void cbSelect_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { int rowIndex = int.Parse(e.Parameter); MFCustomer customer = (MFCustomer)GridCustomer.GetRow(rowIndex); if (customer != null) { Session[this.ID + this.GetType().ToString() + "SelectedRow"] = customer.CustomerID; txtMFCustomerNo.Text = customer.CustomerNo; e.Result = customer.CustomerNo; } }
protected void gdvSecondaryOwners_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID.Equals("btnDelete")) { MFCustomer customer = (MFCustomer)gdvSecondaryOwners.GetRow(e.VisibleIndex); if (customer != null) { SecondaryOwners.Remove(customer); gdvSecondaryOwners.DataBind(); } } }
/*Callback from card search*/ protected void ASPxCallback1_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { TreeListNode identityCategory = ComboTLNCardType.SelectedNode; String identityNo = TextCardCode.Text; String type = (String)ComboIPartyType.SelectedItem.Value; IList <Party> partys = this.FindByIdentity(identityCategory, identityNo); if (partys != null) { IList <MFCustomer> customers = new List <MFCustomer>(); foreach (Party party in partys) { MFCustomer cus = MFCustomer.FindByParty(iSabayaContext, party); if (cus != null) { customers.Add(cus); } if (party != null) { if (type.Equals("A")) { Session[this.ID + this.GetType().ToString() + "ctrls_CustomerControl_CurrentParty"] = party.PartyID; } else if (type.Equals("O")) { if (party is Organization || party is OrgUnit) { Session[this.ID + this.GetType().ToString() + "ctrls_CustomerControl_CurrentParty"] = party.PartyID; } } else if (type.Equals("P")) { if (party is Person) { Session[this.ID + this.GetType().ToString() + "ctrls_CustomerControl_CurrentParty"] = party.PartyID; } } Session[this.ID + this.GetType().ToString() + "GridCustomerVOS"] = customers; } GridCustomer.DataSource = customers; GridCustomer.DataBind(); } if (TextLostFocus != null) { TextLostFocus(this, EventArgs.Empty); } } }
protected void cbLostFocus_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e) { MFCustomer customer = MFCustomer.FindByCustomerNo(iSabayaContext, e.Parameter); if (customer != null) { Session[this.ID + this.GetType().ToString() + "SelectedRow"] = customer.CustomerID; e.Result = "hit"; } else { Session[this.ID + this.GetType().ToString() + "SelectedRow"] = null; e.Result = "nohit"; } }
protected void gdvSecondaryOwners_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { MultilingualString firstName = mlsSecOwnerFirstName.Value; MultilingualString lastName = mlsSecOwnerLastName.Value; IList <MFCustomer> secCustomer = SecondaryOwners; int secCount = secCustomer.Count; MFCustomer cust = null; for (int i = 0; i < firstName.Values.Count; i++) { IList <Person> listPerson = Person.FindByName(iSabayaContext, firstName.Values[i].Language, firstName.Values[i].Value, lastName.Values[i].Value); for (int j = 0; j < listPerson.Count; j++) { cust = MFCustomer.FindByParty(iSabayaContext, listPerson[i]); if (cust != null && !secCustomer.Contains(cust)) { secCustomer.Add(cust); } } } if (secCount == secCustomer.Count) { Person person = new Person() { CurrentName = new PersonName(null, new TimeInterval(DateTime.Now), ctrlSecOwnerNamePrefix.SelectedNameAffix, firstName, lastName, null, null, null, null), EffectivePeriod = new TimeInterval(DateTime.Now), }; person.CurrentName.Person = person; cust = new MFCustomer() { Party = person, IsPerson = true, Period = new TimeInterval(DateTime.Now), }; if (!this.IsDuplicateOwnerName(cust)) { secCustomer.Add(cust); } } gdvSecondaryOwners.DataBind(); }