Beispiel #1
0
        protected void DeleteAssocCategory(object sender, GridViewDeleteEventArgs e)
        {
            int  AssocCategoryId = 0;
            int  rowindexval     = e.RowIndex;
            int  count           = 0;
            bool result          = false;
            AdviserAssociateCategorySetupBo AdviserAssociateCategorySetup = new AdviserAssociateCategorySetupBo();
            AdvisorBranchBo advisorBranchBo = new AdvisorBranchBo();

            if (gvAssocCatSetUpBounded.DataKeys[rowindexval].Value != System.DBNull.Value)
            {
                AssocCategoryId = Convert.ToInt32(gvAssocCatSetUpBounded.DataKeys[rowindexval].Value);
            }

            count = advisorBranchBo.CheckAssociateBranchCategory(AssocCategoryId);

            if (count > 0)
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "alert('Sorry, This category cannot be deleted as this is associated with one or more branches !');", true);
            }
            else
            {
                result = AdviserAssociateCategorySetup.DeleteAdviserAssociateCategory(AssocCategoryId);
            }

            if (result)
            {
                //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('AdviserAssociateCategorySetup','login');", true);
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "alert('Deleted Successfully !');", true);
                FillGrid();
            }
        }
Beispiel #2
0
        private void FillGrid()
        {
            DataSet ds;
            int     num = 0;
            AdviserAssociateCategorySetupBo AdviserAssociateCategorySetup = new AdviserAssociateCategorySetupBo();


            ds  = AdviserAssociateCategorySetup.GetAdviserAssociateCategory(adviserVo.advisorId);
            num = ds.Tables[0].Rows.Count;

            //IF num is 0 then load grid with deafult values.
            if (num == 0)
            {
                trAssignNumber.Visible  = true;
                trUnboundedgrid.Visible = true;

                btnSave.Visible = false;
            }
            else
            {
                ds.Tables[0].Columns.Add("RowNumber");
                int i = 1;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    dr["RowNumber"] = i;
                    i++;
                }

                ViewState["CurrentTable"]         = ds.Tables[0];
                trBoundedgrid.Visible             = true;
                gvAssocCatSetUpBounded.DataSource = ds;
                gvAssocCatSetUpBounded.DataBind();
                DataBoundedFromDb = true;
            }
        }
Beispiel #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            AssociateCategoryVo             associatecategory             = new AssociateCategoryVo();
            AdviserAssociateCategorySetupBo AdviserAssociateCategorySetup = new AdviserAssociateCategorySetupBo();


            associatecategory.AdviserId = adviserVo.advisorId;


            if (gvAssocCatSetUpBounded.Rows.Count > 0)
            {
                foreach (GridViewRow dr in gvAssocCatSetUpBounded.Rows)
                {
                    associatecategory.AssociateCategoryCode = ((TextBox)dr.FindControl("TextBox1")).Text;
                    associatecategory.AssociateCategoryName = ((TextBox)dr.FindControl("TextBox2")).Text;

                    if (gvAssocCatSetUpBounded.DataKeys[dr.RowIndex].Value != System.DBNull.Value)
                    {
                        associatecategory.AssociateCategoryId = Convert.ToInt32(gvAssocCatSetUpBounded.DataKeys[dr.RowIndex].Value);
                    }
                    else
                    {
                        associatecategory.AssociateCategoryId = 0;
                        associatecategory.CreatedBy           = userVo.UserId;
                        associatecategory.CreatedOn           = DateTime.Now;
                    }

                    associatecategory.ModifiedBy = userVo.UserId;
                    associatecategory.Modifiedon = DateTime.Now;

                    bool result = AdviserAssociateCategorySetup.UpdateAdviserAssociateCategory(associatecategory);
                }
                FillGrid();
            }
            else if (gvAssocCatSetUp.Rows.Count > 0)
            {
                foreach (GridViewRow dr in gvAssocCatSetUp.Rows)
                {
                    associatecategory.AssociateCategoryCode = ((TextBox)dr.FindControl("TextBox1")).Text;
                    associatecategory.AssociateCategoryName = ((TextBox)dr.FindControl("TextBox2")).Text;
                    associatecategory.CreatedBy             = userVo.UserId;
                    associatecategory.CreatedOn             = DateTime.Now;
                    associatecategory.ModifiedBy            = userVo.UserId;
                    associatecategory.Modifiedon            = DateTime.Now;

                    bool result = AdviserAssociateCategorySetup.InsertAdviserAssociateCategory(associatecategory);
                }
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "pageloadscript", "loadcontrol('AdviserAssociateCategorySetup','login');", true);
                //FillGrid();
            }
        }