private bool SaveData()
    {
        objClsCommon = new clsCommon();
        if (objClsCommon.IsRecordExists("tblMenuType", tblMenuType.ColumnNames.AppMenuTypeName, tblMenuType.ColumnNames.AppMenuTypeId, txtMenuTypeName.Text, hdnPKID.Value))
        {
            DInfo.ShowMessage("MenuType Name already exists.", Enums.MessageType.Error);
            return(false);
        }
        objClsCommon = null;

        objMenuType = new tblMenuType();

        if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
        {
            objMenuType.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value));
        }
        else
        {
            objMenuType.AddNew();
            objMenuType.AppCreatedDate = System.DateTime.Now;
            objMenuType.AppCreatedBy   = Convert.ToInt32(Session[appFunctions.Session.UserID.ToString()]);
        }
        objMenuType.AppMenuTypeName = txtMenuTypeName.Text;
        objMenuType.s_AppNoOfLevel  = txtNoLevel.Text;
        objMenuType.AppIsActive     = ChkIsActive.Checked;
        objMenuType.s_AppBlockId    = ddlBlock.SelectedValue;
        objMenuType.Save();
        iMenuTypeid  = objMenuType.AppMenuTypeId;
        objMenuType  = null;
        objClsCommon = null;
        return(true);
    }
 protected void dgvGridView_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.CommandArgument.ToString()))
     {
         hdnPKID.Value = e.CommandArgument.ToString();
         if (e.CommandName == "IsActive")
         {
             objMenuType = new tblMenuType();
             if (objMenuType.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)))
             {
                 if (objMenuType.AppIsActive == true)
                 {
                     objMenuType.AppIsActive = false;
                 }
                 else if (objMenuType.AppIsActive == false)
                 {
                     objMenuType.AppIsActive = true;
                 }
             }
             objMenuType.Save();
         }
         objMenuType = null;
         LoadDataGrid(false, false, "", "");
     }
 }
    private bool Delete(int intPKID)
    {
        bool retval = false;

        objMenuType = new tblMenuType();
        if (objMenuType.LoadByPrimaryKey(intPKID))
        {
            objMenuType.MarkAsDeleted();
            objMenuType.Save();
        }
        retval      = true;
        objMenuType = null;
        return(retval);
    }
    private void SetValuesToControls()
    {
        if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
        {
            objMenuType = new tblMenuType();
            if (objMenuType.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)))
            {
                txtMenuTypeName.Text   = objMenuType.AppMenuTypeName;
                ddlBlock.SelectedValue = objMenuType.s_AppBlockId;

                if (objMenuType.AppIsActive)
                {
                    ChkIsActive.Checked = true;
                }
                else
                {
                    ChkIsActive.Checked = false;
                }

                txtNoLevel.Text = objMenuType.s_AppNoOfLevel;
            }
            objMenuType = null;
        }
    }
Пример #5
0
    public void SetUpBlocks()
    {
        tblBlock      objBlock     = new tblBlock();
        StringBuilder blockContent = new StringBuilder();

        objBlockDt = objBlock.GetBlockByControlId();
        if (Cache["SiteName"] == null)
        {
            tblSettings objSettings = new tblSettings();
            objSettings.Query.AddResultColumn(tblSettings.ColumnNames.AppSiteName);
            objSettings.Query.AddResultColumn(tblSettings.ColumnNames.AppSiteTagLine);
            objSettings.Query.AddResultColumn(tblSettings.ColumnNames.AppSiteFavicon);
            objSettings.LoadAll();
            if (objSettings.RowCount > 0)
            {
                Cache["SiteName"] = objSettings.AppSiteName;
            }
        }

        for (int i = 0; i <= objBlockDt.Rows.Count - 1; i++)
        {
            blockContent = new StringBuilder();
            DataRow dr = objBlockDt.Rows[i];

            if (dr["appMenuTypeId"].ToString() != DBNull.Value.ToString() & (bool)dr["appIsShowContent"] == false)
            {
                objMenuItem = new tblMenuItem();
                objMenuDt   = new DataTable();
                objMenuDt   = objMenuItem.GetChildMenus((int)dr["appMenuTypeId"]);

                if (string.Compare(dr["appControlId"].ToString(), "divTopMenu") == 0)
                {
                    blockContent.Append(" <div style=\"background-color: #ED258F;\">");
                    blockContent.Append(" <div class=\"wrap\">");
                    blockContent.Append(" <div class=\"menu\">");
                    blockContent.Append("<ul class=\"megamenu skyblue\">");
                    LoadTopMenu(ref blockContent, 0);
                    blockContent.Append("</ul></div></div></div>");
                }
                else if (string.Compare(dr["appControlId"].ToString(), "divFooterBlock1") == 0)
                {
                    objMenuType = new tblMenuType();
                    if (objMenuType.LoadByPrimaryKey((int)dr["appMenuTypeId"]))
                    {
                        LoadFooterMenu(ref blockContent, 0, objMenuType.AppMenuTypeName);
                    }
                    objMenuType = null;
                }
                else if (string.Compare(dr["appControlId"].ToString(), "divFooterBlock2") == 0)
                {
                    objMenuType = new tblMenuType();
                    if (objMenuType.LoadByPrimaryKey((int)dr["appMenuTypeId"]))
                    {
                        LoadCategory(ref blockContent);
                    }
                    objMenuType = null;
                }
                else if (string.Compare(dr["appControlId"].ToString(), "divCategoryFooter") == 0)
                {
                    LoadCategoryFooter(ref blockContent);
                }
                else if (dr["appMenuTypeId"].ToString() != DBNull.Value.ToString())
                {
                    blockContent.Append("<ul>");
                    SetUpMenu(ref blockContent, 0);
                    blockContent.Append("</ul>");
                }
            }
            else if ((bool)dr["appIsShowContent"] == true)
            {
                blockContent.Append(dr["appContent"]);
            }

            StringBuilder strContent = new StringBuilder();
            strContent.Append(blockContent);
            blockContent = new StringBuilder();
            blockContent.Append(strContent.ToString().Replace("~GetServerURL()~", PageBase.GetServerURL() + "/"));


            if ((this.Master.FindControl("ContentPlaceHolder1").FindControl(dr["appControlId"].ToString()) != null))
            {
                ((HtmlContainerControl)this.Master.FindControl("ContentPlaceHolder1").FindControl(dr["appControlId"].ToString())).InnerHtml = blockContent.ToString();
            }
            else if ((this.Master.FindControl(dr["appControlId"].ToString()) != null))
            {
                ((HtmlContainerControl)this.Master.FindControl(dr["appControlId"].ToString())).InnerHtml = blockContent.ToString();
            }
        }
    }