Exemple #1
0
    protected void GV_List_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        //添加
        if (e.CommandName.Equals("AddBinding"))
        {
            int         index = int.Parse(e.CommandArgument.ToString());
            GridViewRow row   = this.GV_List.Rows[index];

            string flowCode = ((Controls_TextBox)row.FindControl("tbFlow")).Text.Trim();
            if (flowCode == string.Empty)
            {
                ShowErrorMessage("MasterData.Order.Binding.Flow.Empty");
                return;
            }
            string bindingType = ((DropDownList)row.FindControl("ddlBindingType")).SelectedValue;
            string remark      = ((TextBox)row.FindControl("tbRemark")).Text.Trim();

            #region 检查是否存在
            OrderHead orderHead = TheOrderHeadMgr.LoadOrderHead(this.OrderNo);
            if (orderHead.Flow == flowCode)
            {
                ShowErrorMessage("MasterData.Order.Binding.Self");
                return;
            }
            for (int i = 0; i < index; i++)
            {
                GridViewRow oneRow      = this.GV_List.Rows[i];
                string      oneFlowCode = ((Label)oneRow.FindControl("lbFlow")).Text.Trim();
                if (flowCode == oneFlowCode)
                {
                    ShowErrorMessage("MasterData.Order.Binding.Flow.Exists");
                    return;
                }
            }
            #endregion

            OrderBinding orderBinding = new OrderBinding();
            orderBinding.OrderHead   = orderHead;
            orderBinding.BindedFlow  = TheFlowMgr.LoadFlow(flowCode);
            orderBinding.BindingType = bindingType;
            orderBinding.Remark      = remark;
            TheOrderBindingMgr.CreateOrderBinding(orderBinding);
            ShowSuccessMessage("MasterData.Order.Binding.Add.Successfully");
            UpdateView();
        }
        else if (e.CommandName.Equals("DeleteBinding"))
        {
            int id = int.Parse(e.CommandArgument.ToString());
            TheOrderBindingMgr.DeleteOrderBinding(id);
            ShowSuccessMessage("MasterData.Order.Binding.Delete.Successfully");
            UpdateView();
        }
    }
Exemple #2
0
    public override void UpdateView()
    {
        OrderHead            orderHead        = TheOrderHeadMgr.LoadOrderHead(this.OrderNo);
        IList <OrderBinding> orderBindingList = TheOrderBindingMgr.GetOrderBinding(this.OrderNo);

        if (orderHead.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE)
        {
            OrderBinding orderBinding = new OrderBinding();
            orderBinding.IsBlank = true;
            orderBindingList.Add(orderBinding);
            this.GV_List.Columns[4].Visible = true;
        }
        else
        {
            this.GV_List.Columns[4].Visible = false;
        }

        this.Visible = orderBindingList.Count == 0 ? false : true;

        this.GV_List.DataSource = orderBindingList;
        this.GV_List.DataBind();
    }