示例#1
0
 private void btnsave_Click_1(object sender, EventArgs e)
 {
     UIL.album f = new UIL.album();
     f.FormClosed += new FormClosedEventHandler(f_FormClosed);
     f.mode        = type_mode.mode.insert;
     f.MdiParent   = this.ParentForm;
     f.Show();
 }
示例#2
0
        private void btnview_Click(object sender, EventArgs e)
        {
            albumclass ac = new albumclass();
            DataTable  dt = new DataTable();

            UIL.album f = new UIL.album();
            f.mode = type_mode.mode.view;


            if ((dataGridView1.Rows.Count == 0) || (dataGridView1.CurrentRow.Index == -1))
            {
                MessageBox.Show("سطری انتخاب نشده است");
                return;
            }
            //eeeeeeeee
            int cr = dataGridView1.CurrentRow.Index;

            if (cr >= 0)
            {
                f.btnsave.Enabled = false;

                string id = dataGridView1[0, cr].Value.ToString();

                dt = ac.Search(id);

                if (dt.Rows.Count > 0)
                {
                    f.txtid.Text              = dt.Rows[0]["id"].ToString();
                    f.txtonvan.Text           = dt.Rows[0]["title"].ToString();
                    f.txtmantaghe.Text        = dt.Rows[0]["zone"].ToString();
                    f.cbnoe.Text              = dt.Rows[0]["type"].ToString();
                    f.txtghete.Text           = dt.Rows[0]["part"].ToString();
                    f.txtmasahat_tozihat.Text = dt.Rows[0]["area_describe"].ToString();
                    f.txtnam_taiekonande.Text = dt.Rows[0]["provider_name"].ToString();

                    f.txtyear.Text  = dt.Rows[0]["provide_year"].ToString().Substring(0, 4);
                    f.txtmonth.Text = dt.Rows[0]["provide_year"].ToString().Substring(5, 2);
                    f.txtday.Text   = dt.Rows[0]["provide_year"].ToString().Substring(8, 2);

                    f.txtmahale_negahdari.Text = dt.Rows[0]["place_keeping"].ToString();
                    f.txtsaere_tozihat.Text    = dt.Rows[0]["others_describetions"].ToString();

                    f.MdiParent = this.ParentForm;
                    f.Show();
                }
                else
                {
                    MessageBox.Show("!این سطر حذف شده است، لطفا از دکمه بازآوری استفاده نمایید");
                }
            }
        }