コード例 #1
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            if (MessageUtil.ConfirmYesNo("确定要删除这条记录吗?"))
            {
                if (Bm != null)
                {
                    if (Bm.Position >= 0)
                    {
                        int index = Math.Max(0, Bm.Position);
                        //DataSet dataSet =supergrid.PrimaryGrid.DataSource as DataSet;

                        if (ds != null)
                        {
                            DataTable table = ds.Tables[0];
                            goodmethod.tb_goodDelete(table.Rows[index]["GoodId"].ToString());
                            table.Rows.RemoveAt(index);

                            ds.AcceptChanges();

                            superGridControl1.PrimaryGrid.PurgeDeletedRows(true);
                        }
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 打印预览
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPrintView_Click(object sender, EventArgs e)
        {
            // 呐喊  491035839这个qq提出来不要重复打印一个单号,这样浪费纸,打印前检查单号有没有打印了,打印了就弹出提醒让用户确认
            _list.Clear();
            _list.Add(BuildPrintEntity());
            if (_list == null || _list.Count == 0)
            {
                MessageUtil.ShowWarning("请认真填写好发件人和收件人的姓名、电话、省市区、地址");
                return;
            }
            ZtoPrintBillManager printBillManager = new ZtoPrintBillManager(BillPrintHelper.BackupDbHelper);
            var tempResult = printBillManager.Exists(new KeyValuePair <string, object>(ZtoPrintBillEntity.FieldBillCode, txtBillCode.Text));

            if (tempResult)
            {
                if (MessageUtil.ConfirmYesNo("当前单号已经打印过了,是否再次打印?"))
                {
                    GreatReport();
                    _report.PrintPreview(false);
                }
            }
            else
            {
                GreatReport();
                _report.PrintPreview(false);
            }
        }
コード例 #3
0
        private void BtnDel_Click(object sender, RoutedEventArgs e)
        {
            //删除
            if (this.gridItem.SelectedItem == null)
            {
                return;
            }
            RsMaintainStandards selectItem = this.gridItem.SelectedItem as RsMaintainStandards;

            if (this.gridItem.SelectedItem == null)
            {
                MessageUtil.ShowError("请选择删除数据!");
                return;
            }
            if (!MessageUtil.ConfirmYesNo("是否确定删除选择的数据?!"))
            {
                return;
            }
            List <string>       deList = new List <string>();
            RsMaintainStandards m_RsMaintainStandards = this.gridItem.SelectedItem as RsMaintainStandards;

            m_RsMaintainStandards.USE_FLAG = -1;
            ws.UseService(s => s.UpdateRsMaintainStandards(m_RsMaintainStandards));
            GetPage();
        }
コード例 #4
0
 /// <summary>
 /// 直接打印
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     if (CheckInput())
     {
         _list.Clear();
         _list.Add(BuildPrintEntity());
         if (_list == null || _list.Count == 0)
         {
             MessageUtil.ShowWarning("请认真填写好发件人和收件人的姓名、电话、省市区、地址");
             return;
         }
         ZtoPrintBillManager printBillManager = new ZtoPrintBillManager(BillPrintHelper.BackupDbHelper);
         var tempResult = printBillManager.Exists(new KeyValuePair <string, object>(ZtoPrintBillEntity.FieldBillCode, txtBillCode.Text));
         if (tempResult)
         {
             if (MessageUtil.ConfirmYesNo("当前单号已经打印过了,是否再次打印?"))
             {
                 GreatReport();
                 _report.PrintEx(GRPrintGenerateStyle.grpgsPreviewAll, false);
             }
         }
         else
         {
             GreatReport();
             _report.PrintEx(GRPrintGenerateStyle.grpgsPreviewAll, false);
         }
     }
 }
コード例 #5
0
ファイル: frmGoods.cs プロジェクト: Alencc2015/Myc-
 private void btnDeleteClick(object sender, EventArgs e)
 {
     if (MessageUtil.ConfirmYesNo("确定要删除这条记录吗?"))
     {
         if (Bm != null)
         {
             if (Bm.Position >= 0)
             {
                 string id = tbgoodid.Text.Trim();
                 if (!string.IsNullOrEmpty(id))
                 {
                     goodmethod.tb_goodDelete(id);
                 }
                 FreshGoods();
                 GridRow gr = (GridRow)superGridControl1.PrimaryGrid.GetRowFromIndex(0);
                 if (gr != null)
                 {
                     SetcontrolsValueFromGrid(gr);
                 }
                 LogHelper.WriteLog(username + " 删除产品【产品编号:" + id + " 名称:" + tbgoodsname.Text.Trim() + " 货号:" + tbitemno.Text.Trim() + "器型编号:" + tbmodelno.Text.Trim() + "】");
                 if (Bm.Count == 0)
                 {
                     toolbar1.btndelete.Enabled = false;
                     toolbar1.btnedit.Enabled   = false;
                 }
             }
         }
     }
 }
コード例 #6
0
 /// <summary>
 /// 退出系统
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void bbiExit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (MessageUtil.ConfirmYesNo("是否退出系统") == DialogResult.Yes)
     {
         this.Close();
     }
 }
コード例 #7
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                var res = MessageUtil.ConfirmYesNo("设置完成后,请重启系统");
                if (res)
                {
                    var sql = "delete from dt_BaseSet ";
                    SQLiteHelper.ExecuteNonQuery(sql);

                    sql = string.Format(@"insert into dt_BaseSet (IP,PROT,D) 
                values('{0}','{1}','{2}')", txt_IP.Text, txt_prot.Text, txt_mm.Text);
                    if (SQLiteHelper.ExecuteNonQuery(sql) == 0)
                    {
                        MessageBox.Show("存储", "保存失败!", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
                    }
                    else
                    {
                        System.Environment.Exit(0);
                    }
                }
                else
                {
                    this.Hide();
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
コード例 #8
0
        private void btnDeleteClick(object sender, EventArgs e)
        {
            if (MessageUtil.ConfirmYesNo("确定要删除这条记录吗?"))
            {
                if (Bm != null)
                {
                    if (Bm.Position >= 0)
                    {
                        int index = supergrid.PrimaryGrid.ActiveRow.Index;
                        //DataSet dataSet =supergrid.PrimaryGrid.DataSource as DataSet;

                        if (ds != null)
                        {
                            DataTable table = ds.Tables[0];
                            spMethod.SelPorcelainDelete(table.Rows[index]["PlSerialNum"].ToString());
                            table.Rows.RemoveAt(index);
                            ds.AcceptChanges();
                            LogHelper.WriteLog(username + " 删除选瓷单据【单号:" + table.Rows[index]["PlSerialNum"].ToString() + "器型:" + tbmodelno.Text.Trim() + " 花色:" + tbMaterial.Text.Trim() + " 件数:" + tbpssl.Value + "】");
                        }

                        if (Bm.Count == 0)
                        {
                            toolbar1.btndelete.Enabled = false;
                            toolbar1.btnedit.Enabled   = false;
                        }
                    }
                }
            }
            isEdit = false;
        }
コード例 #9
0
        private void btnDeleteClick(object sender, EventArgs e)
        {
            if (MessageUtil.ConfirmYesNo("确定要删除这条记录吗?"))
            {
                if (Bm != null)
                {
                    if (Bm.Position >= 0)
                    {
                        //int index = superGridControl1.PrimaryGrid.ActiveRow.Index;
                        //DataSet dataSet =supergrid.PrimaryGrid.DataSource as DataSet;
                        string id = tbgoodid.Text.Trim();
                        if (!string.IsNullOrEmpty(id))
                        {
                            goodmethod.tb_SpgoodDelete(id);
                        }
                        FreshGoods();
                        GridRow gr = (GridRow)superGridControl1.PrimaryGrid.GetRowFromIndex(0);
                        SetControlsValueFromGrid(gr);
                        LogHelper.WriteLog(username + " 删除选瓷产品【产品编号:" + id + "器型名称:" + tbgoodname.Text.Trim() + " 花色:" + cmbColor.Text.Trim() + "】");

                        if (Bm.Count == 0)
                        {
                            toolbar1.btndelete.Enabled = false;
                            toolbar1.btnedit.Enabled   = false;
                        }
                    }
                }
            }
        }
コード例 #10
0
ファイル: frmWareIn.cs プロジェクト: Alencc2015/Myc-
        private void btnDeleteClick(object sender, EventArgs e)
        {
            if (MessageUtil.ConfirmYesNo("确定要删除这条记录吗?"))
            {
                if (Bm != null)
                {
                    if (Bm.Position >= 0)
                    {
                        int index = Math.Max(0, Bm.Position);
                        //DataSet dataSet =supergrid.PrimaryGrid.DataSource as DataSet;

                        if (ds != null)
                        {
                            DataTable table = ds.Tables[0];
                            WareInOutDbMgr.WareInOutDelete(table.Rows[index]["FSerialNum"].ToString());
                            table.Rows.RemoveAt(index);
                            ds.AcceptChanges();
                        }

                        if (Bm.Count == 0)
                        {
                            toolbar1.btndelete.Enabled = false;
                            toolbar1.btnedit.Enabled   = false;
                        }
                    }
                }
            }
        }
コード例 #11
0
        private void btnDeleteClick(object sender, EventArgs e)
        {
            if (MessageUtil.ConfirmYesNo("确定要删除这条记录吗?"))
            {
                if (Bm != null)
                {
                    if (Bm.Position >= 0)
                    {
                        int index = superGridControl1.PrimaryGrid.ActiveRow.Index;
                        //DataSet dataSet =supergrid.PrimaryGrid.DataSource as DataSet;

                        if (ds != null)
                        {
                            DataTable table = ds.Tables[0];
                            groupMethod.Delete(Convert.ToInt16(table.Rows[index]["GroupId"]));
                            table.Rows.RemoveAt(index);

                            ds.AcceptChanges();

                            //superGridControl1.PrimaryGrid.PurgeDeletedRows(true);
                        }

                        if (Bm.Count == 0)
                        {
                            toolbar1.btndelete.Enabled = false;
                            toolbar1.btnedit.Enabled   = false;
                        }
                    }
                }
            }
        }
コード例 #12
0
ファイル: FrmFiles.cs プロジェクト: andylaufzf/QuickBox
        /// <summary>
        /// 执行删除组
        /// </summary>
        private void btnDoDeleteGroupName_Click(object sender, EventArgs e)
        {
            string oldGroupName = this.lbGroupNames.SelectedItem.ToString();

            if (string.IsNullOrEmpty(oldGroupName))
            {
                MessageUtil.ShowWarning("删除失败,请选择要删除的分组名称");
                return;
            }

            IList <BoxGroup> groups = BoxFileData.getBoxGroups();

            if (null == groups.FirstOrDefault(o => o.Name == oldGroupName))
            {
                MessageUtil.ShowWarning("删除失败,旧的分组名称不存在");
                return;
            }

            if (!MessageUtil.ConfirmYesNo("是否删除该选择的分组?"))
            {
                return;
            }

            BoxFileData.deleteBoxGroup(oldGroupName);

            MessageUtil.ShowTips("删除成功");

            //刷新列表
            this.refreshShortcutGroup();

            this.showOperateGroupPanel();
        }
コード例 #13
0
ファイル: frmBaseInfo.cs プロジェクト: Alencc2015/Myc-
        private void btnDeleteClick(object sender, EventArgs e)
        {
            if (MessageUtil.ConfirmYesNo("确定要删除这条记录吗?"))
            {
                if (Bm != null)
                {
                    if (Bm.Position >= 0)
                    {
                        int index = Math.Max(0, Bm.Position);
                        //DataSet dataSet =supergrid.PrimaryGrid.DataSource as DataSet;

                        if (ds != null)
                        {
                            DataTable table = ds.Tables[0];
                            goodmethod.tb_baseDelete(table.Rows[index][0].ToString());
                            table.Rows.RemoveAt(index);

                            ds.AcceptChanges();

                            superGridControl1.PrimaryGrid.PurgeDeletedRows(true);
                        }

                        if (Bm.Count == 0)
                        {
                            toolbar1.btndelete.Enabled = false;
                            toolbar1.btnedit.Enabled = false;
                        }
                    }
                }
            }
 
        }
コード例 #14
0
        /// <summary>
        /// 删除权限
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            var id = this.privilegeTree.GetCurrentSelectedId();

            if (string.IsNullOrEmpty(id))
            {
                return;
            }

            if (MessageUtil.ConfirmYesNo("是否确认删除该权限") == DialogResult.Yes)
            {
                try
                {
                    CallerFactory <IPrivilegeService> .Instance.Delete(id);

                    this.privilegeTree.RefreshData();

                    MessageUtil.ShowInfo("删除成功");
                }
                catch (PoseidonException pe)
                {
                    Logger.Instance.Exception("删除权限失败", pe);
                    MessageUtil.ShowError(string.Format("保存失败,错误消息:{0}", pe.Message));
                }
            }
        }
コード例 #15
0
 /// <summary>
 /// 清空单号和订单号
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnClearBillCodeAndOrderNumber_Click(object sender, EventArgs e)
 {
     if (MessageUtil.ConfirmYesNo("确定清空单号和订单号信息?"))
     {
         txtBillCode.Text    = "";
         txtOrderNumber.Text = "";
     }
 }
コード例 #16
0
        private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = dataGridView1.CurrentRow;

            if (MessageUtil.ConfirmYesNo(string.Format("确认要删除{0}?", row.Cells[1].Value.ToString())))
            {
                DAL.CommonDAL.DeleteProjectItem(row.Cells[0].Value.ToString());
                LoadData();
            }
        }
コード例 #17
0
        /// <summary>
        /// 异常消息处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="ex"></param>
        private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs ex)
        {
            Logger.Instance.Exception("未处理异常", ex.Exception);

            string message = string.Format("{0}\r\n操作发生错误,您需要退出系统么?", ex.Exception.Message);

            if (MessageUtil.ConfirmYesNo(message) == DialogResult.Yes)
            {
                Application.Exit();
            }
        }
コード例 #18
0
 /// <summary>
 /// 清空收件人和单号和订单号
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnClearReceiveMan_Click(object sender, EventArgs e)
 {
     if (MessageUtil.ConfirmYesNo("确定清空收件人信息?"))
     {
         txtReceivePhone.Text   = "";
         txtReceiveAddress.Text = "";
         txtReceiveCompany.Text = "";
         txtReceiveMan.Text     = "";
         dgvReceiveArea.Text    = "";
         txtReceiveMan.Focus();
     }
 }
コード例 #19
0
        /// <summary>
        /// 删除附件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void menuDelete_Click(object sender, EventArgs e)
        {
            var select = GetCurrentSelect();

            if (select == null)
            {
                return;
            }

            if (MessageUtil.ConfirmYesNo("是否删除指定附件:" + select.Name) == DialogResult.Yes)
            {
                CallerFactory <IAttachmentService> .GetInstance(CallerType.WebApi).Delete(select.Id);
            }
        }
コード例 #20
0
ファイル: Form1.cs プロジェクト: windygu/RT_WaterFee
        private void btnMessageBox_Click(object sender, EventArgs e)
        {
            MessageUtil.ShowTips("提示信息对话框");
            MessageUtil.ShowWarning("警告消息提示框");
            MessageUtil.ShowError("错误消息提示框");

            MessageUtil.ShowYesNoAndTips("提示对话框,有Yes/No按钮");
            MessageUtil.ShowYesNoAndWarning("警告对话框,有Yes/No按钮");
            MessageUtil.ShowYesNoAndError("错误对话框,有Yes/No按钮");
            MessageUtil.ShowYesNoCancelAndTips("提示对话框,有Yes/No/Cancel按钮");

            MessageUtil.ConfirmYesNo("确认对话框,有Yes/No对话框");
            MessageUtil.ConfirmYesNoCancel("确认对话框,有Yes/No/Cancel对话框");
        }
コード例 #21
0
        private void BtnDel_Click(object sender, RoutedEventArgs e)
        {
            //删除
            if (this.Griditem.SelectedItem == null)
            {
                return;
            }
            SysPurview selectItem = this.Griditem.SelectedItem as SysPurview;

            if (!MessageUtil.ConfirmYesNo("是否确定删除选择的数据?!"))
            {
                return;
            }
            _SDMService.UseService(s => s.DelSysPurview(selectItem.PKNO));
            Initialize();
        }
コード例 #22
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSaveBill_Click(object sender, EventArgs e)
 {
     if (this.PrintBillEntities.Any())
     {
         var start = BaseBusinessLogic.ConvertToLong(txtStartBill.Text);
         var end   = BaseBusinessLogic.ConvertToLong(txtEndBill.Text);
         var count = end - start;
         if (count.ToString() == cmbPrintBillCount.Text)
         {
             for (int i = 0; i < PrintBillEntities.Count; i++)
             {
                 var billCode = BaseBusinessLogic.ConvertToLong(txtStartBill.Text) + i;
                 PrintBillEntities[i].BillCode = billCode.ToString();
             }
             if (MessageUtil.ConfirmYesNo(string.Format("确定保存{0}条单号吗?", PrintBillEntities.Count)))
             {
                 using (IDbHelper dbHelper = DbHelperFactory.GetHelper(CurrentDbType.SQLite, BillPrintHelper.BillPrintConnectionString))
                 {
                     try
                     {
                         dbHelper.BeginTransaction();
                         var manager = new ZtoPrintBillManager(dbHelper);
                         foreach (var itemBill in PrintBillEntities)
                         {
                             manager.SetProperty(new KeyValuePair <string, object>(ZtoPrintBillEntity.FieldId, itemBill.Id), new KeyValuePair <string, object>(ZtoPrintBillEntity.FieldBillCode, itemBill.BillCode));
                         }
                         dbHelper.CommitTransaction();
                         MessageUtil.ShowTips("保存成功");
                     }
                     catch (Exception ex)
                     {
                         dbHelper.RollbackTransaction();
                         LogUtil.WriteException(ex);
                     }
                 }
             }
         }
         else
         {
             string error = string.Format("需要打印{0},结束单号-开始单号和需要打印数据不相等,不能保存", PrintBillEntities.Count);
             MessageUtil.ShowError(error);
         }
     }
 }
コード例 #23
0
 private void FrmInputStartBillAndEndBill_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (string.IsNullOrEmpty(myInputStartBillAndEndBill1.txtStartBill.Text) || string.IsNullOrEmpty(myInputStartBillAndEndBill1.txtEndBill.Text))
     {
         DialogResult = DialogResult.Abort;
     }
     else
     {
         if (MessageUtil.ConfirmYesNo("确定关闭吗?"))
         {
             DialogResult = DialogResult.OK;
         }
         else
         {
             DialogResult = DialogResult.Abort;
             e.Cancel     = true;
         }
     }
 }
コード例 #24
0
        private void btnDeleteClick(object sender, EventArgs e)
        {
            if (MessageUtil.ConfirmYesNo("确定要删除这条记录吗?"))
            {
                if (Bm != null)
                {
                    if (Bm.Position >= 0)
                    {
                        int    index = Bm.Position;
                        string id    = tbModelNo.Text.Trim();
                        if (!string.IsNullOrEmpty(id))
                        {
                            goodmethod.tb_ModelDelete(id);
                        }
                        LogHelper.WriteLog(username + " 删除器型【编号:" + id + " 名称:" + tbModelName.Text.Trim() + "】");
                        FreshModels();
                        GridRow gr = (GridRow)superGridControl1.PrimaryGrid.GetRowFromIndex(0);
                        SetControlsValueFromGrid(gr);
                        //UpdateBindings(context);
                        //ClearControls();
                        //if (ds != null)
                        //{
                        //    DataTable table = ds.Tables[0];
                        //    goodmethod.tb_ModelDelete(id);
                        //    table.Rows.RemoveAt(index);

                        //    ds.AcceptChanges();

                        //    superGridControl1.PrimaryGrid.PurgeDeletedRows(true);
                        //}

                        if (Bm.Count == 0)
                        {
                            toolbar1.btndelete.Enabled = false;
                            toolbar1.btnedit.Enabled   = false;
                        }
                    }
                }
            }
        }
コード例 #25
0
        /// <summary>
        /// 删除分组
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.currentGroup == null)
            {
                return;
            }
            if (MessageUtil.ConfirmYesNo("是否确认删除该分组") == DialogResult.Yes)
            {
                try
                {
                    CallerFactory <IGroupService> .Instance.Delete(this.currentGroup);

                    LoadGroupsTree();

                    MessageUtil.ShowInfo("删除成功");
                }
                catch (PoseidonException pe)
                {
                    MessageUtil.ShowError(string.Format("删除失败,错误消息:{0}", pe.Message));
                }
            }
        }
コード例 #26
0
        /// <summary>
        /// 禁用用户
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDisable_Click(object sender, EventArgs e)
        {
            if (this.userGrid.GetCurrentSelect() == null)
            {
                return;
            }

            if (MessageUtil.ConfirmYesNo("是否禁用选定用户") == DialogResult.Yes)
            {
                try
                {
                    var user = this.userGrid.GetCurrentSelect();
                    CallerFactory <IUserService> .Instance.Disable(user.Id);

                    LoadUsers();
                }
                catch (Exception pe)
                {
                    MessageUtil.ShowError(string.Format("禁用失败,错误消息:{0}", pe.Message));
                }
            }
        }
コード例 #27
0
        /// <summary>
        /// 删除计量
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.lbMeasure.SelectedItem == null || this.currentMeasure == null)
            {
                return;
            }

            if (MessageUtil.ConfirmYesNo("是否确认删除选中能耗计量") == DialogResult.Yes)
            {
                try
                {
                    BusinessFactory <MeasureBusiness> .Instance.Delete(this.currentMeasure);

                    LoadMeasures();

                    MessageUtil.ShowInfo("删除成功");
                }
                catch (PoseidonException pe)
                {
                    MessageUtil.ShowError(string.Format("保存失败,错误消息:{0}", pe.Message));
                }
            }
        }
コード例 #28
0
        /// <summary>
        /// 删除字典
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDictDelete_Click(object sender, EventArgs e)
        {
            if (this.currentDict == null)
            {
                return;
            }

            if (MessageUtil.ConfirmYesNo("是否确认删除该字典") == DialogResult.Yes)
            {
                try
                {
                    CallerFactory <IDictService> .Instance.Delete(this.currentDict);

                    this.treeDict.Reload();

                    MessageUtil.ShowInfo("删除成功");
                }
                catch (PoseidonException pe)
                {
                    MessageUtil.ShowError(string.Format("保存失败,错误消息:{0}", pe.Message));
                }
            }
        }
コード例 #29
0
        /// <summary>
        /// 删除附件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.lbAttachments.SelectedIndex == -1 || this.lbAttachments.SelectedItem == null)
            {
                return;
            }

            var attach = this.lbAttachments.SelectedItem as Attachment;

            if (MessageUtil.ConfirmYesNo("是否删除选定附件:" + attach.Name) == DialogResult.Yes)
            {
                bool result = CallerFactory <IAttachmentService> .GetInstance(CallerType.WebApi).Delete(attach.Id);

                if (result)
                {
                    this.attachments.Remove(attach);
                }
                else
                {
                    MessageUtil.ShowWarning("删除附件失败");
                }
            }
        }
コード例 #30
0
        /// <summary>
        /// 删除统计
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.currentPopulation == null)
            {
                return;
            }

            if (MessageUtil.ConfirmYesNo("是否确认删除选中人数统计") == DialogResult.Yes)
            {
                try
                {
                    BusinessFactory <PopulationBusiness> .Instance.Delete(this.currentPopulation);

                    LoadPopulations();

                    MessageUtil.ShowInfo("删除成功");
                }
                catch (PoseidonException pe)
                {
                    MessageUtil.ShowError(string.Format("保存失败,错误消息:{0}", pe.Message));
                }
            }
        }