예제 #1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int    iSelectedGridIndex = dataGridView1.CurrentCell.ColumnIndex;
            int    rowindex           = dataGridView1.CurrentCell.RowIndex;
            string rowID = dataGridView1.Rows[rowindex].Cells[1].Value.ToString();

            if (iSelectedGridIndex == 0)
            {
                using (Context dbcontext = new Context())
                {
                    GlobalVariable.comiteID = rowID;
                    Komite_Add form2 = new Komite_Add();
                    form2.Show();
                }
            }
            else if (iSelectedGridIndex == 0)
            {
                GlobalVariable.bakhshID = rowID;
                Bakhsh_add form2 = new Bakhsh_add();
                form2.Show();
            }
            else
            {
                return;
            }
        }
예제 #2
0
        private void viewDetail(object sender, EventArgs e)
        {
            var    element = sender as Label;
            string id      = element.Name;

            GlobalVariable.comiteID = id;
            Komite_Add form2 = new Komite_Add();

            form2.Show();
        }
예제 #3
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int    iSelectedGridIndex = dataGridView1.CurrentCell.ColumnIndex;
            int    rowindex           = dataGridView1.CurrentCell.RowIndex;
            string rowID = dataGridView1.Rows[rowindex].Cells[2].Value.ToString();

            if (iSelectedGridIndex == 1)
            {
                using (Context dbcontext = new Context())
                {
                    komite selecteditem = dbcontext.komites.SingleOrDefault(x => x.ID == rowID);
                    if (selecteditem.master != "1")
                    {
                        return;
                    }
                    DateTime date = DateTime.Now;
                    TimeSpan time = DateTime.Now.TimeOfDay;

                    string ID    = RandomString(10);
                    komite model = new komite()
                    {
                        masoul   = selecteditem.masoul,
                        markazID = selecteditem.markazID,
                        changer  = selecteditem.changer,
                        date     = date,
                        time     = time,
                        ID       = ID,
                        parent   = selecteditem.parent,
                        final    = 0,
                        isDone   = false,
                        janeshin = selecteditem.janeshin,
                        master   = "0",
                        title    = selecteditem.title
                    };

                    dbcontext.komites.Add(model);
                    dbcontext.SaveChanges();
                    GlobalVariable.comiteID = ID;
                    Komite_Add form2 = new Komite_Add();
                    form2.Show();
                }
            }
            else if (iSelectedGridIndex == 0)
            {
                GlobalVariable.comiteID = rowID;
                Komite_Add form2 = new Komite_Add();
                form2.Show();
            }
            else
            {
                return;
            }
        }
예제 #4
0
        private void bakhshAdd_Click(object sender, EventArgs e)
        {
            using (Context dbcontext = new Context())
            {
                string   id          = RandomString(10);
                komite   model       = new komite();
                DateTime nowdatetime = DateTime.Now;
                model.master  = "1";
                model.ID      = id;
                model.parent  = id;
                model.date    = nowdatetime;
                model.time    = nowdatetime.TimeOfDay;
                model.changer = "admin";
                dbcontext.komites.Add(model);
                dbcontext.SaveChanges();
                GlobalVariable.comiteID = id;

                Komite_Add form = new Komite_Add();

                form.Show();
            }
            this.Hide();
        }