예제 #1
0
		private void SaveRecord()
		{
            Int64 iGuarantorID = Int64.Parse(cboContact.SelectedItem.Value);
            Int16 iCreditCardTypeID = Int16.Parse(cboCardType.SelectedItem.Value);

            string javaScript;
            if (iGuarantorID == 0)
            {
                javaScript = "window.alert('Please select a guarantor to change the card type.')";
                System.Web.UI.ScriptManager.RegisterClientScriptBlock(this.updSave, this.updSave.GetType(), "openwindow", javaScript, true);
                return;
            }
            if (iCreditCardTypeID == 0)
            {
                javaScript = "window.alert('Please select a valid credit card type.')";
                System.Web.UI.ScriptManager.RegisterClientScriptBlock(this.updSave, this.updSave.GetType(), "openwindow", javaScript, true);
                return;
            }

            Security.AccessUserDetails clsAccessUserDetails = (Security.AccessUserDetails)Session["AccessUserDetails"];

            Contacts clsContacts = new Contacts();
            clsContacts.UpdateCreditCardType(iGuarantorID, iCreditCardTypeID, clsAccessUserDetails.Name);
            clsContacts.CommitAndDispose();

            cboContact_SelectedIndexChanged(null, null);

            javaScript = "window.alert('Card Type for " + cboContact.SelectedItem.Text + " has been updated.')";
            System.Web.UI.ScriptManager.RegisterClientScriptBlock(this.updSave, this.updSave.GetType(), "openwindow", javaScript, true);
		}