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

            wwf.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;
                newapartementmelkform wwf = new newapartementmelkform(1);

                wwf.id      = (int)drv.Row["id"];
                wwf.adress  = (drv.Row["adress"] != System.DBNull.Value ? (string)drv.Row["adress"] : "");
                wwf.metraj  = (drv.Row["metraj"] != System.DBNull.Value ? (string)drv.Row["metraj"] : "");
                wwf.gheymat = (drv.Row["pish"] != System.DBNull.Value ? (string)drv.Row["pish"] : "");
                wwf.keraye  = (drv.Row["keraye"] != System.DBNull.Value ? (string)drv.Row["keraye"] : "");
                wwf.forosh  = (drv.Row["forosh"] != System.DBNull.Value ? (string)drv.Row["forosh"] : "");
                wwf.rahni   = (drv.Row["rahn"] != System.DBNull.Value ? (string)drv.Row["rahn"] : "");
                wwf.tabaghe = (drv.Row["tabaghe"] != System.DBNull.Value ? (string)drv.Row["tabaghe"] : "");
                wwf.otagh   = (drv.Row["otagh"] != System.DBNull.Value ? (string)drv.Row["otagh"] : "");


                wwf.ShowDialog();

                BindData();
            }
        }