示例#1
0
        private void toolSave2_Click(object sender, EventArgs e)
        {
            bool ret;

            this.Cursor = Cursors.WaitCursor;
            DBGrid2.EndEdit();
            ArrayList arrtask = new ArrayList();

            for (int i = 0; i < DBGrid2.RowCount; i++)
            {
                if (Convert.ToBoolean(DBGrid2.Rows[i].Cells[0].Value) == true)
                {
                    arrtask.Add(DBGrid2.Rows[i].Cells[1].Value.ToString());
                }
            }

            if (tvUser2.SelectedNode.Level == 0)
            {
                ret = _dal.SaveTaskGrant(tvUser2.SelectedNode.Name.ToString(), arrtask, Util.UserId, out Util.emsg);
            }
            else
            {
                ret = _dal.SaveUserTaskGrant(tvUser2.SelectedNode.Name.ToString(), arrtask, Util.UserId, out Util.emsg);
            }
            if (!ret)
            {
                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                MessageBox.Show("Success!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            this.Cursor = Cursors.Default;
        }
示例#2
0
        private void toolRestore2_Click(object sender, EventArgs e)
        {
            if (DBGrid2.RowCount == 0)
            {
                return;
            }

            DBGrid2.EndEdit();
            string selectionlist = string.Empty;

            for (int i = 0; i < DBGrid2.RowCount; i++)
            {
                if (DBGrid2.Rows[i].Cells[0].Value != null && Convert.ToBoolean(DBGrid2.Rows[i].Cells[0].Value) == true)
                {
                    if (string.IsNullOrEmpty(selectionlist))
                    {
                        selectionlist = DBGrid2.Rows[i].Cells[1].Value.ToString();
                    }
                    else
                    {
                        selectionlist += "," + DBGrid2.Rows[i].Cells[1].Value.ToString();
                    }
                }
            }
            if (string.IsNullOrEmpty(selectionlist))
            {
                MessageBox.Show("请勾选您要的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (MessageBox.Show("您真的要恢复这些产品资料?", clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }

            bool ret = _dal.RestoreUselessProduct(selectionlist, out Util.emsg);

            if (ret)
            {
                LoadData2();
            }
            else
            {
                MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }