Exemple #1
0
 private void btnConfirm_Click(object sender, EventArgs e)
 {
     if (!Check())
     {
         return;
     }
     model_PageSize.PTYPE     = MyCommon.ToSqlString(txtptype.Text.Trim());
     model_PageSize.Pages     = Convert.ToInt16(numPages.Value);
     model_PageSize.Pfloat    = Convert.ToInt16(numPfloat.Value);
     model_PageSize.IsDefault = (chIsDefault.Checked ? 1 : 0);
     if (chIsDefault.Checked == true && !_IsDefault)
     {
         b_Pagesize.ClearDefault();
     }
     if (pid.HasValue == false)
     {
         ERM.BLL.PageSize bll_pagesize = new ERM.BLL.PageSize();
         model_PageSize.PID = bll_pagesize.GetPageSizeMaxId() + 1;
         bll_pagesize.Add(model_PageSize);
     }
     else
     {
         b_Pagesize.Update(model_PageSize);
     }
     this.DialogResult = DialogResult.OK;
 }
Exemple #2
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsDelete_Click(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection rows = this.dgPageSize.SelectedRows;

            if (rows.Count == 0)
            {
                TXMessageBoxExtensions.Info("至少要选择一行记录才能够操作!");
                return;
            }
            else
            {   //询问是否删除
                if (TXMessageBoxExtensions.Question("确定要删除记录吗 ?") == DialogResult.Cancel)
                {
                    return;
                }
                else//确定删除
                {
                    //if (rows[0].Cells["isdefault"].Value.ToString() == "1")
                    //{
                    //    TXMessageBoxExtensions.Info("必须先设置一个默认!");
                    //    return;
                    //}
                    ERM.BLL.PageSize bll_pagesiz = new ERM.BLL.PageSize();
                    DataSet          ds          = bll_pagesiz.GetAllList();
                    if (ds != null && ds.Tables.Count > 0 &&
                        ds.Tables[0] != null && ds.Tables[0].Rows.Count > 1)
                    {
                        int id = Convert.ToInt16(rows[0].Cells["PID"].Value.ToString());
                        bll_pagesiz.Delete(id);  //删除
                        BindGridViewData(false); //重新绑定数据
                    }
                    else
                    {
                        TXMessageBoxExtensions.Info("提示:至少需要保留一条记录信息!");
                    }
                }
            }
        }