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

            string javaScript;
            if (iContactID == 0)
            {
                javaScript = "window.alert('Please select a customer to change the guarantor.')";
                System.Web.UI.ScriptManager.RegisterClientScriptBlock(this.updSave, this.updSave.GetType(), "openwindow", javaScript, true);
                return;
            }
            if (iGuarantorID == 0)
            {
                javaScript = "window.alert('Please select a valid guarantor.')";
                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.UpdateGuarantor(iContactID, iGuarantorID, clsAccessUserDetails.Name);
            clsContacts.CommitAndDispose();

            cboContact_SelectedIndexChanged(null, null);

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