Beispiel #1
0
 protected void lnkbtnSetupRecycling_Click(object sender, EventArgs e)
 {
     if (_account != null)
     {
         // create service location
         _recycleServiceLocation               = new ServiceLocationEntity();
         _recycleServiceLocation.Account       = _account;
         _recycleServiceLocation.Name          = "Primary Dock";
         _recycleServiceLocation.Address1      = _account.Address1;
         _recycleServiceLocation.Address2      = _account.Address2;
         _recycleServiceLocation.City          = _account.City;
         _recycleServiceLocation.ZipCode       = _account.ZipCode;
         _recycleServiceLocation.MainContact   = _account.MainContact;
         _recycleServiceLocation.Notes         = _account.Notes;
         _recycleServiceLocation.Phone         = _account.Phone;
         _recycleServiceLocation.ServiceTypeId = (int)ServiceTypeEntity.ServiceTypes.RecycleOnly;
         _recycleServiceLocation.Save();
         _account.Save();
         populate();
         recyclingTypes.Visible = true;
     }
     else
     {
         messages.AddInfoDiv("After you save the account will you be able to setup the asset reclamation");
     }
 }
Beispiel #2
0
 protected void btnSaveRecyclingDock_Click(object sender, EventArgs e)
 {
     if (txtRecylingDockName.Text.Trim().Length > 0)
     {
         var dock = new ServiceLocationEntity(Convert.ToInt32(hdnRecyclingDockId.Value));
         dock.Name          = txtRecylingDockName.Text;
         dock.AccountId     = _account.AccountId;
         dock.ServiceTypeId = (int)ServiceTypeEntity.ServiceTypes.RecycleOnly;
         dock.Save();
         rgRecyclingDocks.Rebind();
         divRecyclingDockDetails.Visible = false;
     }
 }
Beispiel #3
0
        protected void btnSaveServiceLocation_Click(object sender, EventArgs e)
        {
            string errorMessage = validate();

            if (errorMessage.Length == 0)
            {
                _serviceLocation.Name        = txtServiceLocationName.Text.Trim();
                _serviceLocation.Address1    = txtAddress1.Text.Trim().Length > 0 ? txtAddress1.Text.Trim() : null;
                _serviceLocation.Address2    = txtAddress2.Text.Trim().Length > 0 ? txtAddress2.Text.Trim() : null;
                _serviceLocation.City        = txtCity.Text.Trim().Length > 0 ? txtCity.Text.Trim() : null;
                _serviceLocation.State       = ddlState.SelectedValue.Length > 0 ? ddlState.SelectedValue.Trim() : null;
                _serviceLocation.ZipCode     = txtZip.Text.Trim().Length > 0 ? txtZip.Text.Trim() : null;
                _serviceLocation.Phone       = txtPhone.Text.Trim().GetNumbers().Length > 0 ? txtPhone.Text.Trim().GetNumbers() : null;
                _serviceLocation.MainContact = txtMainContact.Text.Trim().Length > 0 ? txtMainContact.Text.Trim() : null;
                _serviceLocation.Notes       = txtNotes.Text.Trim().Length > 0 ? txtNotes.Text.Trim() : null;
                _serviceLocation.Save();

                Response.Redirect("~/EditServiceLocation.aspx?id=" + _serviceLocation.ServiceLocationId.ToString());
            }
            else
            {
                messages.Controls.Add(HtmlHelper.Div("error", errorMessage));
            }
        }
Beispiel #4
0
        protected void btnSaveRecyclingDocks_Click(object sender, EventArgs e)
        {
            foreach (GridDataItem item in rgRecyclingDocks.Items)
            {
                TextBox     txtRecylingDockName = item.FindControl("txtRecyclingDockName") as TextBox;
                HiddenField dockId = item.FindControl("hdnRecyclingDockId") as HiddenField;

                if (dockId != null)
                {
                    ServiceLocationEntity dock = new ServiceLocationEntity(Convert.ToInt32(dockId.Value));
                    dock.Name = txtRecylingDockName.Text;
                    dock.Save();
                }
            }

            Response.Redirect("~/EditAccount.aspx?acctId=" + _account.AccountId.ToString());
        }
Beispiel #5
0
        protected void btnSaveAccount_Click(object sender, EventArgs e)
        {
            string errorMessage = validate();

            if (errorMessage.Length == 0)
            {
                _account.Name        = txtAcctName.Text.Trim();
                _account.AccountNo   = txtAcctNo.Text.Trim().Length > 0 ? txtAcctNo.Text.Trim() : null;
                _account.Address1    = txtAddress1.Text.Trim().Length > 0 ? txtAddress1.Text.Trim() : null;
                _account.Address2    = txtAddress2.Text.Trim().Length > 0 ? txtAddress2.Text.Trim() : null;
                _account.City        = txtCity.Text.Trim().Length > 0 ? txtCity.Text.Trim() : null;
                _account.State       = ddlState.SelectedValue.Length > 0 ? ddlState.SelectedValue : null;;
                _account.ZipCode     = txtZip.Text.Trim().Length > 0 ? txtZip.Text.Trim() : null;
                _account.Phone       = txtPhone.Text.Trim().GetNumbers().Length > 0 ? txtPhone.Text.Trim().GetNumbers() : null;
                _account.IsActive    = true;
                _account.MainContact = txtMainContact.Text.Trim().Length > 0 ? txtMainContact.Text.Trim() : null;
                _account.Notes       = txtNotes.Text.Trim().Length > 0 ? txtNotes.Text.Trim() : null;

                if (_account.IsNew)
                {
                    _serviceLocation         = new ServiceLocationEntity();
                    _serviceLocation.Account = _account;
                }

                _serviceLocation.Name          = _account.Name;
                _serviceLocation.Address1      = _account.Address1;
                _serviceLocation.Address2      = _account.Address2;
                _serviceLocation.City          = _account.City;
                _serviceLocation.ZipCode       = _account.ZipCode;
                _serviceLocation.MainContact   = _account.MainContact;
                _serviceLocation.Notes         = _account.Notes;
                _serviceLocation.Phone         = _account.Phone;
                _serviceLocation.ServiceTypeId = (int)ServiceTypeEntity.ServiceTypes.RecycleOnly;

                _account.Save();
                _serviceLocation.Save();

                Response.Redirect("~/EditRecyclingAccount.aspx?acctId=" + _account.AccountId.ToString());
            }
            else
            {
                messages.Controls.Add(HtmlHelper.Div("error", errorMessage));
            }
        }
Beispiel #6
0
        protected void rgAssetDocks_OnItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "delete":
                HiddenField hdnAssetDockId = e.Item.FindControl("hdnAssetDockId") as HiddenField;

                if (hdnAssetDockId != null)
                {
                    ServiceLocationEntity dock = new ServiceLocationEntity(Convert.ToInt32(hdnAssetDockId.Value));
                    dock.IsActive = false;
                    dock.Save();
                }
                break;

            default:
                break;
            }
        }
Beispiel #7
0
        protected void btnSaveAccount_Click(object sender, EventArgs e)
        {
            string errorMessage = validate();

            if (errorMessage.Length == 0)
            {
                bool isNew = _account.IsNew;

                _account.Name        = txtAcctName.Text.Trim();
                _account.AccountNo   = txtAcctNo.Text.Trim().Length > 0 ? txtAcctNo.Text.Trim() : null;
                _account.Address1    = txtAddress1.Text.Trim().Length > 0 ? txtAddress1.Text.Trim() : null;
                _account.Address2    = txtAddress2.Text.Trim().Length > 0 ? txtAddress2.Text.Trim() : null;
                _account.City        = txtCity.Text.Trim().Length > 0 ? txtCity.Text.Trim() : null;
                _account.State       = ddlState.SelectedValue.Length > 0 ? ddlState.SelectedValue : null;;
                _account.ZipCode     = txtZip.Text.Trim().Length > 0 ? txtZip.Text.Trim() : null;
                _account.Phone       = txtPhone.Text.Trim().GetNumbers().Length > 0 ? txtPhone.Text.Trim().GetNumbers() : null;
                _account.IsActive    = true;
                _account.MainContact = txtMainContact.Text.Trim().Length > 0 ? txtMainContact.Text.Trim() : null;
                _account.Notes       = txtNotes.Text.Trim().Length > 0 ? txtNotes.Text.Trim() : null;
                _account.Save();

                var i = 0;
                foreach (var item in ((IEnumerable <ServiceLocationEntity>)rgServiceLocations.DataSource))
                {
                    item.Ordinal = i++;
                    item.Save();
                }

                if (isNew)
                {
                    _assetReclamationServiceLocation         = new ServiceLocationEntity();
                    _assetReclamationServiceLocation.Account = _account;
                    //_assetReclamationServiceLocation.Name = "Primary Dock";
                    _assetReclamationServiceLocation.Name          = _account.Name;
                    _assetReclamationServiceLocation.Address1      = _account.Address1;
                    _assetReclamationServiceLocation.Address2      = _account.Address2;
                    _assetReclamationServiceLocation.City          = _account.City;
                    _assetReclamationServiceLocation.ZipCode       = _account.ZipCode;
                    _assetReclamationServiceLocation.MainContact   = _account.MainContact;
                    _assetReclamationServiceLocation.Notes         = _account.Notes;
                    _assetReclamationServiceLocation.Phone         = _account.Phone;
                    _assetReclamationServiceLocation.ServiceTypeId = (int)ServiceTypeEntity.ServiceTypes.AssetReclamationOnly;
                    _assetReclamationServiceLocation.Save();

                    // create service location
                    _recycleServiceLocation               = new ServiceLocationEntity();
                    _recycleServiceLocation.Account       = _account;
                    _recycleServiceLocation.Name          = "Primary Dock";
                    _recycleServiceLocation.Address1      = _account.Address1;
                    _recycleServiceLocation.Address2      = _account.Address2;
                    _recycleServiceLocation.City          = _account.City;
                    _recycleServiceLocation.ZipCode       = _account.ZipCode;
                    _recycleServiceLocation.MainContact   = _account.MainContact;
                    _recycleServiceLocation.Notes         = _account.Notes;
                    _recycleServiceLocation.Phone         = _account.Phone;
                    _recycleServiceLocation.ServiceTypeId = (int)ServiceTypeEntity.ServiceTypes.RecycleOnly;
                    _recycleServiceLocation.Save();
                }

                Response.Redirect("~/EditAccount.aspx?acctId=" + _account.AccountId.ToString());
            }
            else
            {
                messages.Controls.Add(HtmlHelper.Div("error", errorMessage));
            }
        }