public ReferCountLetterEntity getReferCount(int count, DateTime fromDate, DateTime toDate) { ReferCountLetterEntity entity = new ReferCountLetterEntity(); string cond = ReferCountLetterEntity.FIELD_REFER_COUNT + ">=" + provider.getSQLString(count) + " and " + provider.getBetweenDate(ReferCountLetterEntity.FIEL_LETTERDATE, fromDate, toDate, null); provider.loadToDataSet(entity, cond); return(entity); }
private void btnShow_Click(object sender, EventArgs e) { bool b = FormChecker.CheckDate(txtFromDate, lblFromDate); b &= FormChecker.CheckDate(txtToDate, lblToDate); int count = 0; try { count = int.Parse(txtReferLimit.Text); } catch (Exception ex) { MessageBox.Show("عدد وارد شده صحیح نیست"); return; } if (!b) { MessageBox.Show("خطا در تاریخ های وارده شده"); return; } try { while (dataGridView1.Rows.Count > 0) { dataGridView1.Rows.RemoveAt(0); } } catch (Exception ex) { } DateTime dateFrom = RMX_TOOLS.date.DateXFormer.persianToGreGorian(txtFromDate.Text); DateTime dateTo = RMX_TOOLS.date.DateXFormer.persianToGreGorian(txtToDate.Text); ReferCountLetterEntity en = _referLetterBL.getReferCount(count, dateFrom, dateTo); ArrayList list = getLetterWithReffereds(en); int currentRowIndex = 0; for (int i = 0; i < list.Count; i++) { currentRowIndex = dataGridView1.Rows.Add(); dataGridView1.Rows[currentRowIndex].Cells[0].Value = ((ArrayList)list[i])[0]; dataGridView1.Rows[currentRowIndex].Cells[1].Value = ((ArrayList)list[i])[1]; dataGridView1.Rows[currentRowIndex].Cells[2].Value = ((ArrayList)list[i])[2]; dataGridView1.Rows[currentRowIndex].Cells[3].Value = ((ArrayList)list[i])[3]; dataGridView1.Rows[currentRowIndex].Cells[4].Value = ((ArrayList)list[i])[4]; } }
private ArrayList getLetterWithReffereds(ReferCountLetterEntity entity) { ArrayList row = null; ArrayList list = new ArrayList(); LetterEntity letterEntity = null; for (int i = 0; i < entity.RowCount(); i++) { row = new ArrayList(); int letterId = int.Parse(entity.get(i, ReferCountLetterEntity.FIELD_LETTER_ID).ToString()); letterEntity = _letterBL.getByLetterId(letterId); row.Add(i + 1 + ""); row.Add(RMX_TOOLS.date.DateXFormer.gregorianToPersianString((DateTime) entity.get(i, ReferCountLetterEntity.FIEL_LETTERDATE))); row.Add(entity.get(i, ReferCountLetterEntity.FIEL_LETTERSUBJECT).ToString()); row.Add(getUsers(letterId)); row.Add(letterId); list.Add(row); } return(list); }