Ejemplo n.º 1
0
        /// <summary>
        /// 保存按钮事件
        /// </summary>
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (btnSave.Tag.ToString() != "保存")
            {
                try
                {
                    Set_Button_State(false);
                    Set_EditZone_ControlReadOnly(false);
                    gridViewCollectionTypeList.Focus();
                    gridViewCollectionTypeList.FocusedColumn = colCollectionPercentum;
                }
                catch (Exception ex)
                {
                    ExceptionHandler.HandleException(this.Text + "--修改按钮事件错误。", ex);
                    gridViewCollectionTypeList.Focus();
                    gridViewCollectionTypeList.FocusedColumn = colCollectionPercentum;
                }
            }
            else
            {
                try
                {
                    int sumInt = DataTypeConvert.GetInt(TableCollectionTypeList.Compute("Sum(CollectionPercentum)", ""));
                    if (sumInt != 100)
                    {
                        MessageHandler.ShowMessageBox(tsmiSkbfbdhj.Text);// ("收款百分比的合计必须是100,请重新操作。");
                        gridViewCollectionTypeList.Focus();
                        gridViewCollectionTypeList.FocusedColumn = colCollectionPercentum;
                        return;
                    }

                    bSCollectionTypeList.EndEdit();

                    if (!collectionTypeDAO.SaveCollectionTypeList(dSCollectionTypeList.Tables[0], collectionTypeNoStr))
                    {
                        return;
                    }

                    Set_Button_State(true);
                    Set_EditZone_ControlReadOnly(true);
                    btnRefresh_Click(null, null);
                }
                catch (Exception ex)
                {
                    //ExceptionHandler.HandleException(this.Text + "--保存按钮事件错误。", ex);
                    ExceptionHandler.HandleException(this.Text + "--" + f.tsmiBcansj.Text, ex);
                    gridViewCollectionTypeList.Focus();
                    gridViewCollectionTypeList.FocusedColumn = colCollectionPercentum;
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 设定默认值
 /// </summary>
 private void TableCollectionTypeList_TableNewRow(object sender, DataTableNewRowEventArgs e)
 {
     try
     {
         e.Row["CollectionTypeNo"] = collectionTypeNoStr;
         int sumInt = DataTypeConvert.GetInt(TableCollectionTypeList.Compute("Sum(CollectionPercentum)", ""));
         e.Row["CollectionPercentum"] = (100 - sumInt) >= 0 ? 100 - sumInt : 0;
     }
     catch (Exception ex)
     {
         //ExceptionHandler.HandleException(this.Text + "--设定默认值事件错误。", ex);
         ExceptionHandler.HandleException(this.Text + "--" + f.tsmiSdmrzsjcw.Text, ex);
     }
 }