Разработка информационной подсистемы для работы с вкладами от частных лиц, страница 6

dataGridViewBasic.Rows[e.RowIndex].ErrorText = err;

foreach (DataGridViewCell c in dataGridViewBasic.Rows[e.RowIndex].Cells)

if (c.ErrorText == "")

{

e.Cancel = false;

return;

}

}

private void sumDepositMonth_Click(object sender, EventArgs e)

{

Sum = 0;

askMonthTypeForm.ShowDialog();       

int searchMonth = askMonthTypeForm.Month;

string searchType = askMonthTypeForm.Type;

if ((!(searchType.Length == 0)) && (!(searchMonth == 0)))

{

for (int i = 0; i < dataGridViewBasic.RowCount; i++)

{

DateTime date = Convert.ToDateTime(dataGridViewBasic[0, i].Value);

string type = Convert.ToString(dataGridViewBasic[2, i].Value);

if ((type == searchType) && (date.Month == searchMonth))

Sum = Sum + Convert.ToDouble(dataGridViewBasic[3, i].Value);

}

resultOfAskForm.TypeValue = searchType;

resultOfAskForm.SumValue = Sum;

resultOfAskForm.ShowDialog();

}

else return;

}

private void infDepositMonth_Click(object sender, EventArgs e)

{

askMonthForm.ShowDialog();

secondresultForm.SumSroch = 0;

secondresultForm.SumSber = 0;

secondresultForm.SumDoVostr = 0;

secondresultForm.Sort = false;

int searchMonth = askMonthForm.Month;

if (!(searchMonth == 0))

{

for (int i = 0; i < dataGridViewBasic.RowCount; i++)

{

DateTime date = Convert.ToDateTime(dataGridViewBasic[0, i].Value);

string type = Convert.ToString(dataGridViewBasic[2, i].Value);

if (date.Month == searchMonth)

if (type == "срочный")

secondresultForm.SumSroch = secondresultForm.SumSroch + Convert.ToDouble(dataGridViewBasic[3, i].Value);

else if (type == "до востребования")

secondresultForm.SumDoVostr = secondresultForm.SumDoVostr + Convert.ToDouble(dataGridViewBasic[3, i].Value);

else secondresultForm.SumSber = secondresultForm.SumSber + Convert.ToDouble(dataGridViewBasic[3, i].Value);

}

secondresultForm.Month = searchMonth;

secondresultForm.ShowDialog();

}

else return;

}

private void sizeDepositMonth_Click(object sender, EventArgs e)

{

askMonthForm.ShowDialog();

secondresultForm.SumSroch = 0;

secondresultForm.SumSber = 0;

secondresultForm.SumDoVostr = 0;

secondresultForm.Sort = true;

int searchMonth = askMonthForm.Month;

if (!(searchMonth == 0))

{

for (int i = 0; i < dataGridViewBasic.RowCount; i++)

{

DateTime date = Convert.ToDateTime(dataGridViewBasic[0, i].Value);

string type = Convert.ToString(dataGridViewBasic[2, i].Value);

if (date.Month == searchMonth)

if (type == "срочный")

secondresultForm.SumSroch = secondresultForm.SumSroch + Convert.ToDouble(dataGridViewBasic[3, i].Value);

else if (type == "до востребования")

secondresultForm.SumDoVostr = secondresultForm.SumDoVostr + Convert.ToDouble(dataGridViewBasic[3, i].Value);

else secondresultForm.SumSber = secondresultForm.SumSber + Convert.ToDouble(dataGridViewBasic[3, i].Value);

}

secondresultForm.Month = searchMonth;

secondresultForm.ShowDialog();

}

else return;

}

private void changeDepositYearMonth_Click(object sender, EventArgs e)

{

double[] sroch = new double[12];

double[] sber = new double[12];

double[] dovostr = new double[12];           

for (int i = 0; i < dataGridViewBasic.RowCount; i++)

{

DateTime date = Convert.ToDateTime(dataGridViewBasic[0, i].Value);

string type = Convert.ToString(dataGridViewBasic[2, i].Value);

switch (type)

{

case "срочный":

sroch[date.Month - 1] = sroch[date.Month - 1] + Convert.ToDouble(dataGridViewBasic[3, i].Value);

break;

case "до востребования":

dovostr[date.Month - 1] = dovostr[date.Month - 1] + Convert.ToDouble(dataGridViewBasic[3, i].Value);

break;

case "сберегательный":

sber[date.Month - 1] = sber[date.Month - 1] + Convert.ToDouble(dataGridViewBasic[3, i].Value);

break;

}

}

graphic.SumSber = sber;

graphic.SumSroch = sroch;

graphic.SumDoVostr = dovostr;

graphic.ShowDialog();

}

private void partDepositYear_Click(object sender, EventArgs e)

{

double[] sroch = new double[1];

double[] sber = new double[1];