Пример #1
0
        protected void gvUmpire_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int umpireID = 0;

            if (e.CommandName == "DoEdit")
            {
                hdId.Value = e.CommandArgument.ToString();
                umpireID   = Convert.ToInt32(e.CommandArgument.ToString());

                UmpireMaster umpire = UmpireManager.Get(umpireID);

                txtName.Text     = umpire.UmpireName;
                txtAddress.Text  = umpire.Address1;
                txtAddress2.Text = umpire.Address2;
                txtFedID.Text    = umpire.FederalTaxID;

                if (umpire.StateID != null)
                {
                    ddlState.SelectedValue = umpire.StateID.ToString();

                    CollectionManager.FillCollection(ddlCity, "CityId", "CityName", City.GetAll((int)umpire.StateID));
                }

                if (umpire.CityID != null)
                {
                    ddlCity.SelectedValue = umpire.CityID.ToString();

                    CollectionManager.FillCollection(ddlLossZip, "ZipCodeID", "ZipCode", ZipCode.getByCityID((int)umpire.CityID));
                }

                if (!string.IsNullOrEmpty(umpire.ZipCode))
                {
                    ddlLossZip.SelectedValue = umpire.ZipCode;
                }

                txtEmail.Text = umpire.Email;

                txtPhone.Text = umpire.Phone;

                pnlEdit.Visible = true;

                pnlGrid.Visible = false;
            }
            else if (e.CommandName == "DoDelete")
            {
                umpireID = Convert.ToInt32(e.CommandArgument.ToString());

                AppraiserMaster appraiser = AppraiserManager.Get(umpireID);

                if (appraiser != null)
                {
                    appraiser.Status = false;

                    AppraiserManager.Save(appraiser);
                }
            }

            loadUmpires();
        }
Пример #2
0
        protected void saveAppraiser()
        {
            // 2013-08-07 tortega
            int clientID = Core.SessionHelper.getClientId();


            using (TransactionScope scope = new TransactionScope()) {
                bool exists = AppraiserManager.IsExist(txtName.Text.Trim(), Convert.ToInt32(hdId.Value));
                if (exists)
                {
                    lblMessage.Text    = "Appraiser name already exists.";
                    lblMessage.Visible = true;
                    txtName.Focus();
                    return;
                }
                AppraiserMaster appraiser = AppraiserManager.Get(Convert.ToInt32(hdId.Value));
                appraiser.AppraiserName = txtName.Text;
                appraiser.BusinessName  = txtBusinessName.Text;
                appraiser.FederalTaxID  = txtFedID.Text.Trim();
                appraiser.Address1      = txtAddress.Text.Trim();
                appraiser.Address2      = txtAddress2.Text.Trim();
                appraiser.StateID       = Convert.ToInt32(ddlState.SelectedValue);
                appraiser.CityID        = Convert.ToInt32(ddlCity.SelectedValue);
                appraiser.ZipCode       = ddlLossZip.SelectedValue;
                appraiser.FederalTaxID  = txtFedID.Text.Trim();
                appraiser.Email         = txtEmail.Text;
                appraiser.Phone         = txtPhone.Text;

                appraiser.Status = true;

                // 2013-08-07 tortega
                if (clientID > 0)
                {
                    appraiser.ClientId = clientID;
                }

                AppraiserManager.Save(appraiser);

                scope.Complete();
            }
        }