コード例 #1
0
ファイル: Delete.aspx.cs プロジェクト: daniela12/gooptic
    private void BindData()
    {
        ZNode.Libraries.Admin.StoreLocatorAdmin StoreBind = new StoreLocatorAdmin();

        ZNode.Libraries.DataAccess.Entities.Store StoreList = StoreBind.GetByStoreID(ItemID);

        if (StoreList != null)
        {
            Name = StoreList.Name;
        }
    }
コード例 #2
0
ファイル: Delete.aspx.cs プロジェクト: daniela12/gooptic
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        ZNode.Libraries.Admin.StoreLocatorAdmin StoreAdmin = new StoreLocatorAdmin();

        bool check = false;

        check = StoreAdmin.DeleteStore(ItemID);

        if (check)
        {
            Response.Redirect(RedirectLink);
        }
        else
        {
            lblErrorMsg.Text = "Delete action could not be completed.";
            lblErrorMsg.Visible = true;
        }
    }
コード例 #3
0
ファイル: List.aspx.cs プロジェクト: daniela12/gooptic
 /// <summary>
 /// Bind data to grid
 /// </summary>
 private void BindGridData()
 {
     StoreLocatorAdmin store = new StoreLocatorAdmin();
     uxGrid.DataSource = store.GetAllStore();
     uxGrid.DataBind();
 }
コード例 #4
0
ファイル: List.aspx.cs プロジェクト: daniela12/gooptic
 /// <summary>
 /// Search a Store by Store Name, ZipCode , State and City
 /// </summary>
 private void BindSearchStore()
 {
     StoreLocatorAdmin AdminAccess = new StoreLocatorAdmin();
     uxGrid.DataSource = AdminAccess.SearchStore(txtstorename.Text.Trim(), txtzipcode.Text.Trim(), txtcity.Text.Trim(), txtstate.Text.Trim());
     uxGrid.DataBind();
 }
コード例 #5
0
ファイル: Add.aspx.cs プロジェクト: daniela12/gooptic
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        System.IO.FileInfo _FileInfo = null;
        ZNode.Libraries.Admin.StoreLocatorAdmin StoreLocatorAdmin = new StoreLocatorAdmin();
        ZNode.Libraries.DataAccess.Entities.Store store = new Store();
        if (ItemID > 0)
        {
            store = StoreLocatorAdmin.GetByStoreID(ItemID);
        }
        store.Name = txtstorename.Text;
        store.Address1 = txtaddress1.Text;
        store.Address2 = txtaddress2.Text;
        store.Address3 = txtaddress3.Text;
        store.City = txtcity.Text;
        store.State = txtstate.Text;
        store.Zip = txtzip.Text;
        store.Phone = txtphone.Text;
        store.Fax = txtfax.Text;
        store.ContactName = txtcname.Text;
        if (ListAccounts.SelectedItem.Text.Equals(""))
        {
            store.AccountID = null;
        }
        else
        {
            store.AccountID = Convert.ToInt32(ListAccounts.SelectedValue);
        }
        if (txtdisplayorder.Text != "")
        {
            store.DisplayOrder = Convert.ToInt32(txtdisplayorder.Text);
        }
        else
        {
            store.DisplayOrder = null;
        }

        store.ActiveInd = chkActiveInd.Checked;

        #region Image Validation

        if (RadioStoreNoImage.Checked == false)
        {
            //Validate image
            if ((ItemID == 0) || (RadioStoreNewImage.Checked == true))
            {
                if (UploadStoreImage.PostedFile.FileName != "")
                {
                    //Check for Store Image
                    _FileInfo = new System.IO.FileInfo(UploadStoreImage.PostedFile.FileName);

                    if (_FileInfo != null)
                    {
                        store.ImageFile = _FileInfo.Name;
                    }
                }
            }
            else
            {
                store.ImageFile = store.ImageFile;
            }
        }
        else
        {
            store.ImageFile = null;
        }

        #endregion

        //Upload File if this is a new Store or the New Image option was selected for an existing Store
        if (RadioStoreNewImage.Checked || ItemID == 0)
        {
            if (_FileInfo != null)
            {
                UploadStoreImage.SaveAs(Server.MapPath(ZNodeConfigManager.EnvironmentConfig.OriginalImagePath + _FileInfo.Name));

                ZNodeImage.ResizeImage(_FileInfo, ZNode.Libraries.Framework.Business.ZNodeConfigManager.SiteConfig.MaxCatalogItemLargeWidth, Server.MapPath(ZNodeConfigManager.EnvironmentConfig.LargeImagePath));
                ZNodeImage.ResizeImage(_FileInfo, ZNode.Libraries.Framework.Business.ZNodeConfigManager.SiteConfig.MaxCatalogItemThumbnailWidth, Server.MapPath(ZNodeConfigManager.EnvironmentConfig.ThumbnailImagePath));
                ZNodeImage.ResizeImage(_FileInfo, ZNode.Libraries.Framework.Business.ZNodeConfigManager.SiteConfig.MaxCatalogItemMediumWidth, Server.MapPath(ZNodeConfigManager.EnvironmentConfig.MediumImagePath));
                ZNodeImage.ResizeImage(_FileInfo, ZNode.Libraries.Framework.Business.ZNodeConfigManager.SiteConfig.MaxCatalogItemSmallWidth, Server.MapPath(ZNodeConfigManager.EnvironmentConfig.SmallImagePath));
            }
        }

        bool check = false;

        if (ItemID > 0)
        {
            check = StoreLocatorAdmin.UpdateStore(store);
        }
        else
        {
            check = StoreLocatorAdmin.InsertStore(store);
        }
        if (check)
        {
            Response.Redirect("List.aspx");
        }
        else
        {
            //display error message
            lblError.Text = "An error occurred while updating. Please try again.";
        }
    }