示例#1
0
 /// <summary>
 /// 界面状态设置
 /// </summary>
 public void ShowUIState()
 {
     if (_UIState_BillPriceMain == UIState.Default || _UIState_BillPriceMain == UIState.Save || _UIState_BillPriceMain == UIState.Cancel)
     {
         barButtonItem4.Enabled = false;
         barButtonItem5.Enabled = false;
         if (gridViewBillPriceList.RowCount > 0)
         {
             //不需要审批的单据在未审核状态下新增,修改,删除按钮可以操作
             //需要审批的单据在审批未提交,审批不通过的状态下新增,修改,删除按钮可以操作
             //其它情况下新增,修改,删除按钮不能操作
             if (imageComboBoxEditSearchState.EditValue.ToString() == "999")   //已审核,主单数据
             {
                 barButtonItem1.Enabled = false;
                 barButtonItem2.Enabled = false;
                 barButtonItem3.Enabled = false;
                 barButtonItem7.Enabled = false;
                 barButtonItem8.Enabled = false;
             }
             else if (imageComboBoxEditSearchState.EditValue.ToString() == "0")  //无需审批,临时单
             {
                 barButtonItem1.Enabled = true;
                 barButtonItem2.Enabled = true;
                 barButtonItem3.Enabled = true;
                 barButtonItem7.Enabled = false;
                 barButtonItem8.Enabled = true;
             }
             else if (imageComboBoxEditSearchState.EditValue.ToString() == "1")  //审批未提交,临时单
             {
                 barButtonItem1.Enabled = true;
                 barButtonItem2.Enabled = true;
                 barButtonItem3.Enabled = true;
                 barButtonItem7.Enabled = true;
                 barButtonItem8.Enabled = false;
             }
             else if (imageComboBoxEditSearchState.EditValue.ToString() == "2")  //提交审批,临时单
             {
                 barButtonItem1.Enabled = false;
                 barButtonItem2.Enabled = false;
                 barButtonItem3.Enabled = false;
                 barButtonItem7.Enabled = false;
                 barButtonItem8.Enabled = false;
             }
             else if (imageComboBoxEditSearchState.EditValue.ToString() == "3")  //审批通过,临时单
             {
                 barButtonItem1.Enabled = false;
                 barButtonItem2.Enabled = false;
                 barButtonItem3.Enabled = false;
                 barButtonItem7.Enabled = false;
                 barButtonItem8.Enabled = true;
             }
             else if (imageComboBoxEditSearchState.EditValue.ToString() == "4")  //审批未通过,临时单
             {
                 barButtonItem1.Enabled = true;
                 barButtonItem2.Enabled = true;
                 barButtonItem3.Enabled = true;
                 barButtonItem7.Enabled = true;
                 barButtonItem8.Enabled = false;
             }
         }
     }
     else if (_UIState_BillPriceMain == UIState.Add || _UIState_BillPriceMain == UIState.Edit)
     {
         barButtonItem1.Enabled = false;
         barButtonItem2.Enabled = false;
         barButtonItem3.Enabled = false;
         barButtonItem4.Enabled = true;
         barButtonItem5.Enabled = true;
         barButtonItem7.Enabled = false;
         barButtonItem6.Enabled = false;
         barButtonItem8.Enabled = false;
     }
     if (_UIState_BillPriceMain == UIState.Add)
     {
         //界面未销毁,需要对控件清空处理
         ClearMainInfo();
         DataTable dtBAppDetail = DevUtil.GetGridControlBindingDataTable(gridViewBillPriceDetail);
         for (int i = 0; i < 9; i++)
         {
             DataRow dr = dtBAppDetail.NewRow();
             dtBAppDetail.Rows.Add(dr);
             gridControlBillPriceDetail.DataSource    = dtBAppDetail;
             gridViewBillPriceDetail.FocusedRowHandle = 0;
             this.LoadMaterialList(this.gridControlPopupMaterial, "001", Convert.ToDecimal(this.imageComboBoxEditSearchAccountType.EditValue), true);
             gridControlPopupMaterial.Visible = true;
         }
     }
     else if (_UIState_BillPriceMain == UIState.Edit)
     {
         gridViewBillPriceDetail.AddNewRow();
         gridViewBillPriceDetail.FocusedRowHandle = 0;
         this.LoadMaterialList(this.gridControlPopupMaterial, "001", Convert.ToDecimal(this.imageComboBoxEditSearchAccountType.EditValue), true);
     }
     gridViewBillPriceDetail.OptionsBehavior.Editable = true;
     if (gridControlBillPriceList.DataSource == null)
     {
         barButtonItem1.Enabled = false;
         barButtonItem2.Enabled = false;
         barButtonItem3.Enabled = false;
         barButtonItem8.Enabled = false;
     }
 }