Ejemplo n.º 1
0
    protected void bindgrid()
    {
        try
        {
            DataTable Dt = new DataTable();
            if (string.IsNullOrEmpty(Strsearch) == false)
            {
                Dt        = objAreaInterest.GetAreaInterest(Strsearch);
                Strsearch = "";
                if (Dt == null || Dt.Rows.Count == 0)
                {
                    no_data.Visible = true;
                    NoDatalbl.Text  = "No data found";
                    d.Columns.Clear();
                    d.Rows.Clear();
                    EntGridView.DataSource = d;
                    EntGridView.DataBind();
                    return;
                }
            }

            Dt = objAreaInterest.GetAreaInterest(" order by  AreaInterestName");

            l = Dt.Rows.Count;
            EntGridView.DataSource = Dt;
            EntGridView.DataBind();
            EntGridView.Visible = true;
            no_data.Visible     = false;
            upCrudGrid.Update();
        }
        catch (Exception ex)
        {
            if (this.global_success.Visible)
            {
                this.global_success.Visible = false;
            }
            this.global_error.Visible  = true;
            this.global_error_msg.Text = Mains.Constant.GENERAL_ERR;
        }
    }
Ejemplo n.º 2
0
    protected void bindAreaInterest()
    {
        DataTable dt = objAreaInterest.GetAreaInterest("  order by AreaInterestName ");

        DataRow dr = dt.NewRow();

        dr[1] = "Choose an Area";
        dt.Rows.InsertAt(dr, 0);
        dt.AcceptChanges();

        ddlAreaInterest.DataSource     = dt;
        ddlAreaInterest.DataTextField  = "AreaInterestName";
        ddlAreaInterest.DataValueField = "AreaInterestID";
        ddlAreaInterest.DataBind();
    }
Ejemplo n.º 3
0
    protected void EntGridView_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            int    index = Convert.ToInt32(e.CommandArgument) % EntGridView.PageSize;
            string HDnID = ((HiddenField)EntGridView.Rows[index].FindControl("FocalPointsID")).Value;
            string SectorInterestName       = ((Label)EntGridView.Rows[index].FindControl("SectorInterestName")).Text;
            string AreaInterestName         = ((Label)EntGridView.Rows[index].FindControl("AreaInterestName")).Text;
            string UserMail                 = ((Label)EntGridView.Rows[index].FindControl("UserMail")).Text;
            string FocalPointsNotifications = ((Label)EntGridView.Rows[index].FindControl("FocalPointsNotifications")).Text;
            Session[RunningCache.FocalPointsID] = HDnID;

            if (e.CommandName.Equals("view"))
            {
                try
                {
                    bindSectorInterest();
                    bindAreaInterest();

                    DataTable dtSector = objSectorInterest.GetSectorInterest(" where SectorInterestName='" + SectorInterestName + "'");
                    if (dtSector.Rows.Count > 0)
                    {
                        ddlSectorInterest.SelectedValue = dtSector.Rows[0]["SectorInterestID"].ToString();
                    }

                    DataTable dtArea = objAreaInterest.GetAreaInterest(" where AreaInterestName='" + AreaInterestName + "'");
                    if (dtArea.Rows.Count > 0)
                    {
                        ddlAreaInterest.SelectedValue = dtArea.Rows[0]["AreaInterestID"].ToString();
                    }

                    DataTable dtUsers = objUsers.GetUsers(" where UserMail='" + UserMail + "'");
                    if (dtUsers.Rows.Count > 0)
                    {
                        ddlUsers.SelectedValue = dtUsers.Rows[0]["UserID"].ToString();
                    }

                    if (FocalPointsNotifications == "No")
                    {
                        RadioButtonNo.Checked = true;
                    }
                    else if (FocalPointsNotifications == "Yes")
                    {
                        RadioButtonYes.Checked = true;
                    }

                    BtnSave.Text = "Update";
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(@"<script type='text/javascript'>");
                    sb.Append("$('#addEdiModal').modal('show');");
                    sb.Append(@"</script>");
                    ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "addEdiModalScript", sb.ToString(), false);
                    upEdit.Update();
                }
                catch (Exception ex)
                {
                }
            }

            if (e.CommandName.Equals("deleting"))
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#deleteModal').modal('show');");
                sb.Append(@"</script>");
                ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "DeleteModalScript", sb.ToString(), false);
                upDel.Update();
            }
        }
        catch (Exception ex)
        {
        }
    }