protected void Page_Load(object sender, EventArgs e)
    {
        DataModelControlHelper.RenderControls(leftRegion, SharedFields, SharedFieldsBehaviors, string.Empty);
        DataModelControlHelper.RenderControls(rightRegion, ExtensionFields, null, string.Empty);
        string[]   customerList = new string[] { "Shipper", "Consignee", "NotifyPart" };
        Customer[] customers    = BasicInformationProxy.FindCustomersByName(string.Empty);
        foreach (string customerField in customerList)
        {
            DropDownList list = DataModelControlHelper.GetControl(leftRegion, customerField) as DropDownList;
            list.DataTextField  = "Name";
            list.DataValueField = "Id";
            list.DataSource     = customers;
            list.DataBind();
            if (list.Items.Count > 0)
            {
                list.Items.Insert(0, new ListItem(string.Empty, string.Empty));
            }
        }


        if (!Page.IsPostBack)
        {
            InitialControls();
        }
    }
示例#2
0
    private void Update()
    {
        if (!CanEdit())
        {
            return;
        }
        Customer customer = GetFromControl();

        BasicInformationProxy.UpdateCustomer(customer);
    }
示例#3
0
    protected void gridCustomer_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        HiddenField txtId = this.gridCustomer.Rows[e.RowIndex].Cells[0].FindControl("Id") as HiddenField;

        if (!string.IsNullOrEmpty(txtId.Value))
        {
            BasicInformationProxy.DeleteCustomer(new Guid(txtId.Value));
        }

        Search();
    }
示例#4
0
    private void Search()
    {
        Customer[] customers = BasicInformationProxy.FindCustomersByName(this.txtSCustomerName.Text.Trim());

        if (customers.Length == 0)
        {
            customers = new Customer[] { new Customer() }
        }
        ;

        this.gridCustomer.DataSource = customers;
        this.gridCustomer.DataBind();
    }
示例#5
0
    protected void gridCustomer_RowEditing(object sender, GridViewEditEventArgs e)
    {
        HiddenField txtId = this.gridCustomer.Rows[e.NewEditIndex].Cells[0].FindControl("Id") as HiddenField;

        if (string.IsNullOrEmpty(txtId.Value))
        {
            return;
        }

        Customer customer = BasicInformationProxy.GetCustomerById(new Guid(txtId.Value));

        SetToControl(customer);

        this.pnlEdit.Visible = true;
    }
示例#6
0
    protected void btnDelete_Click(object sender, ImageClickEventArgs e)
    {
        if (!CanEdit())
        {
            return;
        }
        try
        {
            bool needSearch = false;
            foreach (GridViewRow row in this.gridCustomer.Rows)
            {
                CheckBox check = row.Cells[0].FindControl("check") as CheckBox;

                if (check == null)
                {
                    continue;
                }

                if (check.Checked)
                {
                    HiddenField txtId = row.Cells[0].FindControl("Id") as HiddenField;

                    if (!string.IsNullOrEmpty(txtId.Value))
                    {
                        BasicInformationProxy.DeleteCustomer(new Guid(txtId.Value));
                    }

                    needSearch = true;
                }
            }

            if (needSearch)
            {
                Search();
            }
        }
        catch (Exception ex)
        {
            this.lblError.Text = ex.Message;
        }
    }
示例#7
0
    private void Add()
    {
        if (!CanEdit())
        {
            return;
        }
        if (!string.IsNullOrEmpty(this.txtId.Value))
        {
            return;
        }

        if (string.IsNullOrEmpty(this.txtCustomerName.Text))
        {
            return;
        }

        BasicInformationProxy.CreateCustomer(
            this.txtCustomerName.Text.Trim(),
            this.txtDescription.Text.Trim(),
            this.txtAddress.Text.Trim(),
            this.txtPhoneNumber.Text.Trim());
    }