示例#1
0
        private void cmdadd_Click(object sender, EventArgs e)
        {
            newapartementejarei aaf = new newapartementejarei(0);

            aaf.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;
                newapartementejarei aaf = new newapartementejarei(1);

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

                BindData();
            }
        }