コード例 #1
0
ファイル: ReOrderCat.cs プロジェクト: ganjoor/desktop
        private void btnMoveToCat_Click(object sender, EventArgs e)
        {
            int PoetId = _db.GetCategory(Settings.Default.LastCat)._PoetID;

            using (CategorySelector dlg = new CategorySelector(PoetId))
            {
                if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    int NewCatId = dlg.SelectedCatID;
                    if (NewCatId == Settings.Default.LastCat)
                    {
                        MessageBox.Show("شما بخش جاری را انتخاب کرده‌اید!");
                    }
                    else
                    {
                        GanjoorCat cat = _db.GetCategory(NewCatId);
                        if (MessageBox.Show(string.Format("از انتقال {0} شعر انتخابی از بخش «{1}» به بخش «{2}» اطمینان دارید؟", grdMain.SelectedRows.Count, _db.GetCategory(Settings.Default.LastCat)._Text, cat._Text),
                                            "تأییدیه", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No)
                        {
                            return;
                        }
                        _db.BeginBatchOperation();
                        foreach (DataGridViewRow Row in grdMain.SelectedRows)
                        {
                            int PoemID = Convert.ToInt32(Row.Cells[ClmnID].Value);
                            _db.SetPoemCatID(PoemID, NewCatId);
                        }
                        _db.CommitBatchOperation();
                        LoadGridData();
                    }
                }
            }
        }
コード例 #2
0
ファイル: Editor.cs プロジェクト: daravi/ganjoor
 private void btnMoveToCategory_Click(object sender, EventArgs e)
 {
     using (CategorySelector dlg = new CategorySelector(ganjoorView.GetCurrentPoetID()))
     {
         if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
         {
             ganjoorView.MoveToCategory(dlg.SelectedCatID);
         }
     }
 }
コード例 #3
0
 private void btnSelectRandomCat_Click(object sender, EventArgs e)
 {
     using (CategorySelector dlg = new CategorySelector())
     {
         dlg.CheckedCatsString = _RandomCatIDs;
         if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
         {
             _RandomCatIDs     = dlg.CheckedCatsString;
             lblRandomCat.Text = RandomCatPath;
         }
     }
 }