Пример #1
0
        private void cmdadd_Click(object sender, EventArgs e)
        {
            newapartementforoshiform bbf = new newapartementforoshiform(0);

            bbf.ShowDialog();
            BindData();
        }
Пример #2
0
        private void cmdedit_Click(object sender, EventArgs e)
        {
            if (grid1.SelectedRows.Count == 0)
            {
                MessageBox.Show("یک سطر را انتخاب کنید");
            }
            else
            {
                DataRowView drv = (DataRowView)grid1.SelectedRows[0].DataBoundItem;
                newapartementforoshiform bbf = new newapartementforoshiform(1);

                bbf.id     = (int)drv.Row["id"];
                bbf.adress = (drv.Row["adress"] != System.DBNull.Value ? (string)drv.Row["adress"] : "");

                bbf.gheymat  = (drv.Row["gheymat"] != System.DBNull.Value ? (string)drv.Row["gheymat"] : "");
                bbf.kharidar = (drv.Row["namekharidar"] != System.DBNull.Value ? (string)drv.Row["namekharidar"] : "");
                bbf.saheb    = (drv.Row["namesaheb"] != System.DBNull.Value ? (string)drv.Row["namesaheb"] : "");
                bbf.tarikh   = (drv.Row["tarikh"] != System.DBNull.Value ? (string)drv.Row["tarikh"] : "");
                bbf.ShowDialog();

                BindData();
            }
        }