private void btn_InsertUser_Click(object sender, EventArgs e) { int item = dgv_Drafts.SelectedCells.Count; int getCreatorLetter; if (item > 0) { if (Convert.ToInt16(dgv_Drafts.CurrentRow.Cells["lettertypet"].Value) == 2) { int GetReplayLetterID = Convert.ToInt32(dgv_Drafts.CurrentRow.Cells["ReplayLetterID"].Value); var query = (from l in DBCommon.Context.Letters where l.LetterID == GetReplayLetterID select l).ToList(); if (query.Count > 0) { getCreatorLetter = query[0].UserID; Frm_SelectedUserForSendLetter fm = new Frm_SelectedUserForSendLetter(); fm.GetLetterID = Convert.ToInt32(dgv_Drafts.CurrentRow.Cells["LetterID"].Value); fm.GuserID = getCreatorLetter; fm.Replayid = 1; fm.TopMost = true; fm.Show(); } } else { Frm_SelectedUserForSendLetter fm = new Frm_SelectedUserForSendLetter(); fm.GetLetterID = Convert.ToInt32(dgv_Drafts.CurrentRow.Cells["LetterID"].Value); fm.TopMost = true; fm.Show(); showdrafts(SearchDrafts()); } showdrafts(SearchDrafts()); } else { MessageBox.Show("لطفا ابتدا ردیفی را انتخاب کنید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ارجاعنامهToolStripMenuItem_Click(object sender, EventArgs e) { int item = dgv_ReciveLetter.SelectedCells.Count; int getletterid = Convert.ToInt32(dgv_ReciveLetter.CurrentRow.Cells["Letter_ID"].Value); int refrenceuser = Convert.ToInt32(dgv_ReciveLetter.CurrentRow.Cells["UserID"].Value); int UserId = PublicVariebale.gUserID; if (item > 0) { Frm_SelectedUserForSendLetter fm = new Frm_SelectedUserForSendLetter(); fm.Refrencetype = 1; fm.GetLetterID = getletterid; fm.refrencekonande = UserId; fm.refrenceshode = refrenceuser; fm.TopMost = true; fm.Show(); } else { MessageBox.Show("لطفا نامه ای را انتخاب کنید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error); } }