Esempio n. 1
0
    protected void Display_AddEdit()
    {
        WarehouseData wareHouse = null;
        m_refWarehouse = new WarehouseApi();
        wareHouse = m_refWarehouse.GetItem(this.m_iID);
        Util_Bind();

        if (this.m_iID > 0)
        {
            txt_address_name.Text = wareHouse.Name;
            lbl_address_id.Text = wareHouse.Id.ToString();
            txt_address_line1.Text = wareHouse.Address.AddressLine1;
            txt_address_line2.Text = wareHouse.Address.AddressLine2;
            txt_address_city.Text = wareHouse.Address.City;
            drp_address_region.SelectedIndex = Util_GetRegionIndex(Convert.ToInt32(wareHouse.Address.Region.Id));
            txt_address_postal.Text = wareHouse.Address.PostalCode;
            drp_address_country.SelectedIndex = Util_GetCountryIndex(wareHouse.Address.Country.Id);
            chk_default_warehouse.Checked = wareHouse.IsDefaultWarehouse;

            txt_address_name.Enabled = true;
            txt_address_line1.Enabled = true;
            txt_address_line2.Enabled = true;
            txt_address_city.Enabled = true;
            drp_address_region.Enabled = true;
            txt_address_postal.Enabled = true;
            drp_address_country.Enabled = true;
            chk_default_warehouse.Enabled = false;

            m_bIsDefault = wareHouse.IsDefaultWarehouse;
        }
        else
        {
            phAddressID.Visible = false;
            ltr_address_id.Visible = false;
            lbl_colon.Visible = false;
        }

        TotalPages.Visible = false;
        CurrentPage.Visible = false;
        lnkBtnPreviousPage.Visible = false;
        NextPage.Visible = false;
        LastPage.Visible = false;
        FirstPage.Visible = false;
        PageLabel.Visible = false;
        OfLabel.Visible = false;
    }
Esempio n. 2
0
    protected void Util_Bind()
    {
        if ((CountryList != null) && CountryList.Count > 0)
        {
            drp_address_country.DataSource = CountryList;
            drp_address_country.DataTextField = "Name";
            drp_address_country.DataValueField = "Id";
            drp_address_country.DataBind();
        }
        if (m_sPageAction == "addedit")
        {
            if (m_iID > 0)
            {
                WarehouseData wareHouse = null;
                m_refWarehouse = new WarehouseApi();
                wareHouse = m_refWarehouse.GetItem(this.m_iID);

                int cCountryId = wareHouse.Address.Country.Id;

                RegionCriteria.AddFilter(RegionProperty.CountryId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, cCountryId);
                RegionList = m_refRegion.GetList(RegionCriteria);
                if ((RegionList != null) && RegionList.Count > 0)
                {
                    drp_address_region.DataSource = RegionList;
                    drp_address_region.DataTextField = "Name";
                    drp_address_region.DataValueField = "Id";
                    drp_address_region.DataBind();
                }
            }
            else
            {
                int cCountryId = System.Convert.ToInt32(drp_address_country.SelectedIndex);
                if (cCountryId == 0)
                {
                    cCountryId = System.Convert.ToInt32(CountryList[0].Id); //The first country in the contryList.
                }
                RegionCriteria.AddFilter(RegionProperty.CountryId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, cCountryId);
                RegionList = m_refRegion.GetList(RegionCriteria);
                if ((RegionList != null) && RegionList.Count > 0)
                {
                    drp_address_region.DataSource = RegionList;
                    drp_address_region.DataTextField = "Name";
                    drp_address_region.DataValueField = "Id";
                    drp_address_region.DataBind();
                }
            }
        }
        else
        {
            RegionList = m_refRegion.GetList(RegionCriteria);
            if ((RegionList != null) && RegionList.Count > 0)
            {
                drp_address_region.DataSource = RegionList;
                drp_address_region.DataTextField = "Name";
                drp_address_region.DataValueField = "Id";
                drp_address_region.DataBind();
            }
        }
    }
Esempio n. 3
0
 protected void Process_MarkDefault()
 {
     m_refWarehouse = new WarehouseApi();
     m_refWarehouse.MarkAsDefault(this.m_iID);
     Response.Redirect(this.m_sPageName, false);
 }
Esempio n. 4
0
 protected void Process_Delete()
 {
     m_refWarehouse = new WarehouseApi();
     if (this.m_iID > 0 && !m_refWarehouse.GetItem(this.m_iID).IsDefaultWarehouse)
     {
         m_refWarehouse.Delete(this.m_iID);
         Response.Redirect(this.m_sPageName, false);
     }
     else
     {
         Response.Redirect(this.m_sPageName + "?action=view&id=" + this.m_iID.ToString(), false);
     }
 }
Esempio n. 5
0
    protected void Process_AddEdit()
    {
        WarehouseData wareHouse = null;
        m_refWarehouse = new WarehouseApi();

        if (this.m_iID > 0)
        {
            wareHouse = m_refWarehouse.GetItem(this.m_iID);
        }

        RegionData rData;
        rData = new RegionData();
        rData = m_refRegion.GetItem(Convert.ToInt64(drp_address_region.SelectedValue));

        CountryData cData;
        cData = new CountryData();
        cData = m_refCountry.GetItem(System.Convert.ToInt32(drp_address_country.SelectedValue));

        if (this.m_iID == 0)
        {
            wareHouse = new WarehouseData(txt_address_name.Text, new AddressData());
        }

        wareHouse.Name = (string)txt_address_name.Text;

        if (this.m_iID > 0)
        {
            wareHouse.Id = Convert.ToInt64(lbl_address_id.Text);
        }

        wareHouse.Address.AddressLine1 = (string)txt_address_line1.Text;
        wareHouse.Address.AddressLine2 = (string)txt_address_line2.Text;
        wareHouse.Address.City = (string)txt_address_city.Text;
        if (wareHouse.Address.Region == null)
        {
            wareHouse.Address.Region = new RegionData();
        }
        wareHouse.Address.Region.Id = Convert.ToInt64(drp_address_region.SelectedValue);
        wareHouse.Address.PostalCode = (string)txt_address_postal.Text;
        if (wareHouse.Address.Country == null)
        {
            wareHouse.Address.Country = new CountryData();
        }
        wareHouse.Address.Country.Id = System.Convert.ToInt32(drp_address_country.SelectedValue);
        wareHouse.IsDefaultWarehouse = System.Convert.ToBoolean(chk_default_warehouse.Checked);

        if (this.m_iID > 0)
        {
            m_refWarehouse.Update(wareHouse);
            Response.Redirect(m_sPageName + "?action=view&id=" + this.m_iID.ToString(), false);
        }
        else
        {
            m_refWarehouse.Add(wareHouse);
            Response.Redirect(m_sPageName, false);
        }
    }
Esempio n. 6
0
    protected void Display_View_All()
    {
        Ektron.Cms.Common.Criteria<WarehouseProperty> warehouseCriteria = new Ektron.Cms.Common.Criteria<WarehouseProperty>(WarehouseProperty.Name, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending);
        System.Collections.Generic.List<WarehouseData> WarehouseList = new System.Collections.Generic.List<WarehouseData>();
        int i = 0;

        m_refWarehouse = new WarehouseApi();

        dg_warehouse.AutoGenerateColumns = false;
        dg_warehouse.Columns.Clear();

        warehouseCriteria.PagingInfo.RecordsPerPage = m_refContentApi.RequestInformationRef.PagingSize;
        warehouseCriteria.PagingInfo.CurrentPage = _currentPageNumber;

        WarehouseList = m_refWarehouse.GetList(warehouseCriteria);

        TotalPagesNumber = System.Convert.ToInt32(warehouseCriteria.PagingInfo.TotalPages);

        if (TotalPagesNumber <= 1)
        {
            TotalPages.Visible = false;
            CurrentPage.Visible = false;
            lnkBtnPreviousPage.Visible = false;
            NextPage.Visible = false;
            LastPage.Visible = false;
            FirstPage.Visible = false;
            PageLabel.Visible = false;
            OfLabel.Visible = false;
        }
        else
        {
            lnkBtnPreviousPage.Enabled = true;
            FirstPage.Enabled = true;
            LastPage.Enabled = true;
            NextPage.Enabled = true;
            TotalPages.Visible = true;
            CurrentPage.Visible = true;
            lnkBtnPreviousPage.Visible = true;
            NextPage.Visible = true;
            LastPage.Visible = true;
            FirstPage.Visible = true;
            PageLabel.Visible = true;
            OfLabel.Visible = true;
            TotalPages.Text = (System.Math.Ceiling(Convert.ToDouble(TotalPagesNumber))).ToString();
            TotalPages.ToolTip = TotalPages.Text;

            CurrentPage.Text = _currentPageNumber.ToString();
            CurrentPage.ToolTip = CurrentPage.Text;

            if (_currentPageNumber == 1)
            {
                lnkBtnPreviousPage.Enabled = false;
                FirstPage.Enabled = false;
            }
            else if (_currentPageNumber == TotalPagesNumber)
            {
                NextPage.Enabled = false;
                LastPage.Enabled = false;
            }
        }

        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "Radio";
        colBound.HeaderText = "";
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center;

        dg_warehouse.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "Name";
        colBound.HeaderText = this.GetMessage("generic name");
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;

        dg_warehouse.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "ID";
        colBound.HeaderText = this.GetMessage("generic id");
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center;

        dg_warehouse.Columns.Add(colBound);
        dg_warehouse.BorderColor = System.Drawing.Color.White;

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "IsDefaultWarehouse";
        colBound.HeaderText = this.GetMessage("lbl default");
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center;

        dg_warehouse.Columns.Add(colBound);
        dg_warehouse.BorderColor = System.Drawing.Color.White;

        DataTable dt = new DataTable();
        DataRow dr;

        dt.Columns.Add(new DataColumn("Radio", typeof(string)));
        dt.Columns.Add(new DataColumn("Name", typeof(string)));
        dt.Columns.Add(new DataColumn("Id", typeof(string)));
        dt.Columns.Add(new DataColumn("IsDefaultWarehouse", typeof(string)));

        if (!(WarehouseList == null))
        {
            for (i = 0; i <= WarehouseList.Count - 1; i++)
            {
                m_bIsDefault = System.Convert.ToBoolean(WarehouseList[i].IsDefaultWarehouse);
                dr = dt.NewRow();
                dr[0] = "<input type=\"radio\" id=\"radio_warehouse\" name=\"radio_warehouse\" value=\"" + WarehouseList[i].Id + "\" />";
                dr[1] = "<a href=\"shippingsource.aspx?action=View&id=" + WarehouseList[i].Id + "\">" + WarehouseList[i].Name + "</a>";
                dr[2] = "<label id=\"lbl_warehouseId\">" + WarehouseList[i].Id + "</label>";
                dr[3] = "<input type=\"CheckBox\" id=\"chk_default" + i + "\" name=\"chk_default" + i + "\" disabled=\"true\" " + (m_bIsDefault ? "Checked=\"checked\"" : "") + "/>";
                dt.Rows.Add(dr);
            }
        }

        DataView dv = new DataView(dt);
        dg_warehouse.DataSource = dv;
        dg_warehouse.DataBind();
    }
Esempio n. 7
0
 public void Init()
 {
     instance = new WarehouseApi();
 }