Ejemplo n.º 1
0
        public static int InsertUpdateResources(GroupPages grp)
        {
            int res = 0;
            List <SqlParameter> parm = new List <SqlParameter>();

            try
            {
                using (DbManager db = DbManager.GetDbManager())
                {
                    if (grp.intResourceID == 0)
                    {
                        parm.Add(db.MakeInParam("@intResourceId", SqlDbType.Int, 0, 0));
                        parm.Add(db.MakeInParam("@dtmDateModified", SqlDbType.DateTime, 0, DBNull.Value));
                        parm.Add(db.MakeInParam("@intModifiedBy", SqlDbType.Int, 0, 0));
                        parm.Add(db.MakeInParam("@bitIsDeleted", SqlDbType.Bit, 0, 0));
                    }
                    else
                    {
                        parm.Add(db.MakeInParam("@intResourceId", SqlDbType.Int, 0, grp.intResourceID));
                        parm.Add(db.MakeInParam("@dtmDateModified", SqlDbType.DateTime, 0, DateTime.Now));
                        parm.Add(db.MakeInParam("@intModifiedBy", SqlDbType.Int, 0, 1));
                        parm.Add(db.MakeInParam("@bitIsDeleted", SqlDbType.Bit, 0, 0));
                    }
                    parm.Add(db.MakeInParam("@vchName", SqlDbType.VarChar, 250, grp.vchName));
                    parm.Add(db.MakeInParam("@intCreatedBy", SqlDbType.Int, 0, grp.intCreatedBy));

                    parm.Add(db.MakeInParam("@vchPath", SqlDbType.VarChar, 500, grp.vchPath));
                    parm.Add(db.MakeInParam("@intparentid", SqlDbType.Int, 0, grp.intParentID));

                    res = db.RunProc("up_InsertUpdateResources", parm.ToArray());
                    return(res);
                }
            }
            catch (Exception exp)
            {
                new SqlLog().InsertSqlLog(0, "GroupPages.Insert", exp);
                return(0);
            }
        }
Ejemplo n.º 2
0
    protected void gvPages_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "Edit")
            {
                pageid = Convert.ToInt32(e.CommandArgument);
            }

            else if (e.CommandName == "Delete")
            {
                if (Convert.ToBoolean(hdfactive.Value) == true)
                    GroupPages.ActiveDeactiveGroupPage(Convert.ToInt32(e.CommandArgument), false);
                else
                    GroupPages.ActiveDeactiveGroupPage(Convert.ToInt32(e.CommandArgument), true);
                loadPages();
            }
            else if (e.CommandName == "AddMore")
            {
                LinkButton lnkbtnAddMorePage = gvPages.FooterRow.FindControl("lnkbtnAddMore") as LinkButton;
                LinkButton lnkbtnAddPage = gvPages.FooterRow.FindControl("lnkbtnAddPage") as LinkButton;
                LinkButton lnkbtnCancelPage = gvPages.FooterRow.FindControl("lnkbtnCancelPage") as LinkButton;
                lnkbtnAddPage.Visible = true;
                lnkbtnAddMorePage.Visible = false;
                lnkbtnCancelPage.Visible = true;

                TextBox txtPageNamefoot = gvPages.FooterRow.FindControl("txtPageNamefooter") as TextBox;
                DropDownList ddlDomainNamefoot = gvPages.FooterRow.FindControl("ddlTypeFooter") as DropDownList;
                TextBox txtPagePathfoot = gvPages.FooterRow.FindControl("txtPagePathfooter") as TextBox;

                txtPageNamefoot.Visible = true;
                ddlDomainNamefoot.Visible = true;
                txtPagePathfoot.Visible = true;

                ddlDomainNamefoot.Items.Insert(0, new ListItem("--Select Domain--", "0"));
                Utils.GetLookUpData<DropDownList>(ref ddlDomainNamefoot, LookUps.MainResources, true);

            }
            else if (e.CommandName == "CancelPage")
            {
                gvPages.EditIndex = -1;
                loadPages();
            }
            else if (e.CommandName == "Insert")
            {
                TextBox txtPageName = gvPages.FooterRow.FindControl("txtPageNamefooter") as TextBox;
                DropDownList ddlDomainName = gvPages.FooterRow.FindControl("ddlTypeFooter") as DropDownList;
                TextBox txtPagePath = gvPages.FooterRow.FindControl("txtPagePathfooter") as TextBox;

                GroupPages grp = new GroupPages();
                grp.vchName = txtPageName.Text;
                grp.vchPath = txtPagePath.Text;
                grp.intParentID = Convert.ToInt32(ddlDomainName.SelectedItem.Value);
                grp.intResourceID = 0;

                GroupPages.InsertUpdateResources(grp);

                loadPages();
            }
        }
        catch (Exception ex)
        {
            new SqlLog().InsertSqlLog(0, "Addpages.aspx.gvPages_RowCommand", ex);
        }
    }
Ejemplo n.º 3
0
    protected void lnkbtnAddPage_Click(object sender, EventArgs e)
    {
        try
        {
            GroupPages grp = new GroupPages();
            grp.intResourceID = 0;
            grp.vchName = txtPageNamefooter.Text + "(" + ddlTypeFooter.SelectedItem.Text + ")";
            grp.intParentID = Convert.ToInt32(ddlTypeFooter.SelectedItem.Value);
            grp.vchPath = txtPagePathfooter.Text;

            GroupPages.InsertUpdateResources(grp);

            loadPages();
        }
        catch (Exception ex)
        {
            new SqlLog().InsertSqlLog(0, "Addpages.aspx.lnkbtnAddPage_Click", ex);
        }
    }
Ejemplo n.º 4
0
    protected void gvPages_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            TextBox txtPageName = (TextBox)gvPages.Rows[e.RowIndex].FindControl("txtPageName");
            DropDownList ddlDomainName = gvPages.Rows[e.RowIndex].FindControl("ddlType") as DropDownList;
            TextBox txtPagePath = (TextBox)gvPages.Rows[e.RowIndex].FindControl("txtPagePath");

            GroupPages grp = new GroupPages();
            grp.intResourceID = Convert.ToInt32(gvPages.DataKeys[e.RowIndex].Values[0].ToString());
            grp.vchName = txtPageName.Text + "(" + ddlDomainName.SelectedItem.Text + ")";
            grp.intParentID = Convert.ToInt32(ddlDomainName.SelectedItem.Value);
            grp.vchPath = txtPagePath.Text;

            GroupPages.InsertUpdateResources(grp);

            gvPages.EditIndex = -1;
            loadPages();
        }
        catch (Exception ex)
        {
            new SqlLog().InsertSqlLog(0, "Addpages.aspx.gvPages_RowUpdating", ex);
        }
    }
Ejemplo n.º 5
0
        public static int InsertUpdateResources(GroupPages grp)
        {
            int res = 0;
            List<SqlParameter> parm = new List<SqlParameter>();
            try
            {
                using (DbManager db = DbManager.GetDbManager())
                {
                    if (grp.intResourceID == 0)
                    {
                        parm.Add(db.MakeInParam("@intResourceId", SqlDbType.Int, 0, 0));
                        parm.Add(db.MakeInParam("@dtmDateModified", SqlDbType.DateTime, 0, DBNull.Value));
                        parm.Add(db.MakeInParam("@intModifiedBy", SqlDbType.Int, 0, 0));
                        parm.Add(db.MakeInParam("@bitIsDeleted", SqlDbType.Bit, 0, 0));
                    }
                    else
                    {
                        parm.Add(db.MakeInParam("@intResourceId", SqlDbType.Int, 0, grp.intResourceID));
                        parm.Add(db.MakeInParam("@dtmDateModified", SqlDbType.DateTime, 0, DateTime.Now));
                        parm.Add(db.MakeInParam("@intModifiedBy", SqlDbType.Int, 0, 1));
                        parm.Add(db.MakeInParam("@bitIsDeleted", SqlDbType.Bit, 0, 0));
                    }
                    parm.Add(db.MakeInParam("@vchName", SqlDbType.VarChar, 250, grp.vchName));
                    parm.Add(db.MakeInParam("@intCreatedBy", SqlDbType.Int, 0, grp.intCreatedBy));

                    parm.Add(db.MakeInParam("@vchPath", SqlDbType.VarChar, 500, grp.vchPath));
                    parm.Add(db.MakeInParam("@intparentid", SqlDbType.Int, 0, grp.intParentID));

                    res = db.RunProc("up_InsertUpdateResources", parm.ToArray());
                    return res;
                }
            }
            catch (Exception exp)
            {
                new SqlLog().InsertSqlLog(0, "GroupPages.Insert", exp);
                return 0;
            }
        }