Exemplo n.º 1
0
        private void DeleteItem(object sender, EventArgs e)
        {
            try
            {
                var    element = sender as Label;
                string id      = element.Name.Substring(1, element.Name.Length - 1);
                GlobalVariable.comiteID = id;



                List <komite> markazlist = dbcontext.komites.Where(x => x.markazID == id).ToList();
                if (markazlist.Count == 0)
                {
                    komite delitem = dbcontext.komites.SingleOrDefault(x => x.ID == GlobalVariable.comiteID);
                    dbcontext.komites.Remove(delitem);
                    dbcontext.SaveChanges();
                    Komite_List form2 = new Komite_List();
                    this.Hide();
                    //form2.Show();
                }
            }
            catch (Exception errror)
            {
                message.Text = errror.InnerException.Message;
            }
        }
Exemplo n.º 2
0
        private void bakhshList_Click(object sender, EventArgs e)
        {
            Komite_List form = new Komite_List();

            form.Show();
            this.Hide();
        }
Exemplo n.º 3
0
        private void filter_Click(object sender, EventArgs e)
        {
            string komiteID = GlobalVariable.comiteID;

            using (var dbcontext = new Model.Context())
            {
                komite marz = dbcontext.komites.SingleOrDefault(x => x.ID == komiteID);

                if (marz.final != 1)
                {
                    string parentID = marz.parent;
                    marz.title    = title.Text;
                    marz.masoul   = masool.Text;
                    marz.janeshin = janeshin.Text;
                    marz.markazID = bakhsh.SelectedValue.ToString();


                    List <komite> lst = dbcontext.komites.Where(x => x.parent == parentID).ToList();
                    foreach (komite item in lst)
                    {
                        item.master = "0";
                    }
                    ;
                    marz.isDone = true;
                    marz.master = "1";
                    marz.final  = 1;
                    dbcontext.SaveChanges();
                }
                GlobalVariable.comiteID = marz.parent;
            }

            this.Hide();
            Komite_List form5 = new Komite_List();

            form5.Show();
        }