예제 #1
0
        private void Btn3_4_Click(object sender, EventArgs e)
        {
            frm34 frm = new frm34();

            this.Hide();
            frm.ShowDialog();
            this.Show();
            this.BringToFront();
        }
예제 #2
0
        private void openAnotherForm(string form)
        {
            #region CheckSelectedRow
            int status     = 0;
            int index      = 0;
            int foundindex = 0;
            foreach (DataGridViewRow row in dgvList.Rows)
            {
                if (row.Cells["colCheck"].Value == null ? false : bool.Parse(row.Cells["colCheck"].Value.ToString()))
                {
                    if (status >= 1) //if already found
                    {
                        status = 2;
                    }
                    else //first selected
                    {
                        status     = 1;
                        foundindex = index;
                    }
                }
                index++;
            }
            #endregion

            if (status == 0) //if no row selected
            {
                MetroMessageBox.Show(this, "\n" + Messages.ConfirmationOfBankTransferInformationResult.NoSelectedRow, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (status == 2) //if multirow selected
            {
                MetroMessageBox.Show(this, "\n" + Messages.ConfirmationOfBankTransferInformationResult.MultipleRowSelected, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                //open another form and pass parameter
                string strDateTimeID, strDate, strTime, strCount;
                if (form == "3-2") //if 3-2 form
                {
                    strCount = dgvList.Rows[foundindex].Cells["colAmigodata"].Value.ToString();
                    if (strCount != "0")
                    {
                        strDateTimeID = dgvList.Rows[foundindex].Cells["colDateTimeID"].Value.ToString();
                        strDate       = dgvList.Rows[foundindex].Cells["colDate"].Value.ToString();
                        strTime       = dgvList.Rows[foundindex].Cells["colTime"].Value.ToString();

                        this.Hide();
                        frm32 frm = new frm32(strDateTimeID, strDate, strTime, strCount);
                        frm.ShowDialog();
                        this.Show();
                        BindGrid(fromDate, toDate);
                        this.BringToFront();
                    }
                    else
                    {
                        MetroMessageBox.Show(this, "\n" + Messages.ConfirmationOfBankTransferInformationResult.DataWithZeroValueSelected, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else if (form == "3-3")  // 3-3 form
                {
                    strCount = dgvList.Rows[foundindex].Cells["colNonAmigodata"].Value.ToString();

                    if (strCount != "0")
                    {
                        strDateTimeID = dgvList.Rows[foundindex].Cells["colDateTimeID"].Value.ToString();
                        strDate       = dgvList.Rows[foundindex].Cells["colDate"].Value.ToString();
                        strTime       = dgvList.Rows[foundindex].Cells["colTime"].Value.ToString();

                        this.Hide();
                        frm33 frm = new frm33(strDateTimeID, strDate, strTime, strCount);
                        frm.ShowDialog();
                        this.Show();
                        BindGrid(fromDate, toDate);
                        this.BringToFront();
                    }
                    else
                    {
                        MetroMessageBox.Show(this, "\n" + Messages.ConfirmationOfBankTransferInformationResult.DataWithZeroValueSelected, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    strCount = dgvList.Rows[foundindex].Cells["colAmigodata"].Value.ToString();
                    if (strCount != "0")
                    {
                        string payment_day;
                        try
                        {
                            payment_day = DateTime.ParseExact(dgvList.Rows[foundindex].Cells["colPayment"].Value.ToString(), "yyyy/MM/dd", CultureInfo.InvariantCulture, DateTimeStyles.None).ToString("yyyy/MM/dd");
                        }
                        catch (Exception)
                        {
                            payment_day = DateTime.Now.ToString("yyyy/MM/dd");
                        }
                        this.Hide();
                        if (payment_day == new DateTime().ToString())
                        {
                            frm34 frm = new frm34(DateTime.Now.ToString("yyyy/MM/dd"));
                            frm.ShowDialog();
                        }
                        else
                        {
                            frm34 frm = new frm34(payment_day); //rundate time also
                            frm.ShowDialog();
                        }
                        this.Show();
                    }
                    else
                    {
                        MetroMessageBox.Show(this, "\n" + Messages.ConfirmationOfBankTransferInformationResult.DataWithZeroValueSelected, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }