Exemplo n.º 1
0
 void CustomizeControl1_UpdateClick(SortedDictionary <string, Control> controls)
 {
     try
     {
         if (!string.IsNullOrEmpty(Request.QueryString["mdl"]) & !string.IsNullOrEmpty(((TextBox)controls["Adi"]).Text))
         {
             using (Lib.Kategori m = Lib.KategoriMethods.GetKategori(Request.QueryString["mdl"], BAYMYO.UI.Converts.NullToString(((TreeView)controls["Kategoriler"]).SelectedNode.DataPath)))
             {
                 if (!string.IsNullOrEmpty(m.ID))
                 {
                     m.Adi = ((TextBox)controls["Adi"]).Text;
                     //m.Dil = ((DropDownList)controls["Dil"]).SelectedValue;
                     //m.Sira = (byte)((DropDownList)controls["Sira"]).SelectedIndex;
                     //m.Tab = ((CheckBox)controls["Tab"]).Checked;
                     m.Menu  = ((CheckBox)controls["Menu"]).Checked;
                     m.Aktif = ((CheckBox)controls["Aktif"]).Checked;
                     if (Lib.KategoriMethods.Update(m) > 0)
                     {
                         ((TreeView)controls["Kategoriler"]).DataBind();
                         CreateKategoriMaps(Request.QueryString["mdl"]);
                         ScriptManager.RegisterStartupScript(Page, typeof(Page), "x", "alert('Güncelleme işleminiz başarılı bir şekilde tamamlandı!');", true);
                     }
                 }
             }
         }
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 2
0
 public void Remove(Kategori obj)
 {
     this.List.Remove(obj);
 }
Exemplo n.º 3
0
 public int IndexOf(Kategori obj)
 {
     return(this.List.IndexOf(obj));
 }
Exemplo n.º 4
0
 public bool Contains(Kategori obj)
 {
     return(this.List.Contains(obj));
 }
Exemplo n.º 5
0
 public void Insert(int index, Kategori obj)
 {
     this.List.Insert(index, obj);
 }
Exemplo n.º 6
0
 public int Add(Kategori obj)
 {
     return(this.List.Add(obj));
 }
Exemplo n.º 7
0
    void CustomizeControl1_SubmitClick(SortedDictionary <string, Control> controls)
    {
        try
        {
            TreeView TW_Kategori = ((TreeView)controls["Kategoriler"]);
            if (TW_Kategori.SelectedNode.DataPath.Split(',').Length >= 5)
            {
                CustomizeControl1.MessageText = MessageBox.Show(DialogResult.Stop, "Alt kategori ekleme limitini doldurdurunuz, bu bölümde daha fazla alt kategori oluşturamazsınız.");
                return;
            }
            if (!string.IsNullOrEmpty(Request.QueryString["mdl"]) & !string.IsNullOrEmpty(((TextBox)controls["Adi"]).Text))
            {
                using (Lib.Kategori m = new Lib.Kategori())
                {
                    string orjinalID = null, parentID = TW_Kategori.SelectedNode.DataPath + ',';
                    int    index        = TW_Kategori.SelectedNode.ChildNodes.Count - 1;
                    bool   parentActive = Settings.ParentKategori(Request.QueryString["mdl"]);
                    if (!parentActive)
                    {
                        parentID = "0";
                        if (TW_Kategori.SelectedNode.Parent != null)
                        {
                            if (TW_Kategori.SelectedNode.Parent.ChildNodes.Count > 0)
                            {
                                orjinalID = (BAYMYO.UI.Converts.NullToInt(TW_Kategori.SelectedNode.Parent.ChildNodes[TW_Kategori.SelectedNode.Parent.ChildNodes.Count - 1].DataPath) + 1).ToString("000#");
                            }
                        }
                        else if (TW_Kategori.SelectedNode.ChildNodes.Count > 0)
                        {
                            orjinalID = (BAYMYO.UI.Converts.NullToInt(TW_Kategori.SelectedNode.ChildNodes[TW_Kategori.SelectedNode.ChildNodes.Count - 1].DataPath) + 1).ToString("000#");
                        }
                        else
                        {
                            orjinalID = 1.ToString("000#");
                        }
                    }
                    else if (parentID.Equals("0,"))
                    {
                        if (index >= 0)
                        {
                            orjinalID = (BAYMYO.UI.Converts.NullToInt(TW_Kategori.SelectedNode.ChildNodes[index].DataPath) + 1).ToString("000#");
                        }
                        else
                        {
                            orjinalID = 1.ToString("000#");
                        }
                    }
                    else if (TW_Kategori.SelectedNode.ChildNodes.Count > 0)
                    {
                        if (index >= 0)
                        {
                            if (TW_Kategori.SelectedNode.ChildNodes[index].DataPath.Contains(","))
                            {
                                string[] kategoriler = new string[] { };
                                kategoriler = TW_Kategori.SelectedNode.ChildNodes[index].DataPath.Split(',');
                                orjinalID   = parentID + (BAYMYO.UI.Converts.NullToInt(kategoriler[kategoriler.Length - 1]) + 1).ToString("000#");
                            }
                            else
                            {
                                orjinalID = parentID + (BAYMYO.UI.Converts.NullToInt(TW_Kategori.SelectedNode.ChildNodes[index].DataPath) + 1).ToString("000#");
                            }
                        }
                    }
                    else
                    {
                        if (index >= 0)
                        {
                            orjinalID = parentID + (BAYMYO.UI.Converts.NullToInt(TW_Kategori.SelectedNode.ChildNodes[index].DataPath) + 1).ToString("000#");
                        }
                        else
                        {
                            orjinalID = parentID + 1.ToString("000#");
                        }
                    }

                    m.ID = orjinalID;
                    if (!string.IsNullOrEmpty(m.ID))
                    {
                        if (parentID.Length > 1)
                        {
                            m.ParentID = parentID.Remove(parentID.Length - 1);
                        }
                        else
                        {
                            m.ParentID = "0";
                        }
                        m.ModulID = Request.QueryString["mdl"];
                        m.Adi     = ((TextBox)controls["Adi"]).Text;
                        m.Dil     = "tr-TR";
                        //m.Dil = ((DropDownList)controls["Dil"]).SelectedValue;
                        //m.Sira = (byte)((DropDownList)controls["Sira"]).SelectedIndex;
                        //m.Tab = ((CheckBox)controls["Tab"]).Checked;
                        m.Menu  = ((CheckBox)controls["Menu"]).Checked;
                        m.Aktif = ((CheckBox)controls["Aktif"]).Checked;
                        if (Lib.KategoriMethods.Insert(m) > 0)
                        {
                            TW_Kategori.DataBind();
                            CreateKategoriMaps(Request.QueryString["mdl"]);
                            ScriptManager.RegisterStartupScript(Page, typeof(Page), "x", "alert('Kayıt ekleme işleminiz başarılı bir şekilde tamamlandı!');", true);
                            Settings.ClearControls(controls);
                        }
                    }
                }
            }
        }
        catch (Exception)
        {
        }
    }