Ejemplo n.º 1
0
        private void cmdadd_Click(object sender, EventArgs e)
        {
            newapartementrahniform ddf = new newapartementrahniform(0);

            ddf.ShowDialog();
            BindData();
        }
Ejemplo n.º 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;
                newapartementrahniform ddf = new newapartementrahniform(1);

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

                BindData();
            }
        }