Exemplo n.º 1
0
    protected void imgbtn_Edit_Click(object sender, ImageClickEventArgs e)
    {
        GridViewRow gv_row = (GridViewRow)((sender as ImageButton).NamingContainer);
        long        prjid  = Convert.ToInt64(gv_projects.DataKeys[gv_row.RowIndex].Value);

        ds_analytics.projectsDataTable thisprj_dt = projects.getProjectByPrjid(prjid);
        if (thisprj_dt.Rows.Count > 0)
        {
            ds_analytics.projectsRow prj_row = thisprj_dt[0];

            tb_prj_name.Text               = prj_row.projectname;
            ddl_prj_type.SelectedValue     = prj_row.projecttype;
            ddl_prj_category.SelectedValue = prj_row.projectcategory;
            ddl_prj_brand.SelectedValue    = prj_row.projectbrand;
            if (prj_row.IscreatedateNull())
            {
                tb_prj_start.Text = "";
            }
            else
            {
                tb_prj_start.Text = prj_row.createdate.ToString("dd/MM/yyyy");
            }
            if (prj_row.IscompletiondateNull())
            {
                tb_prj_end.Text = "";
            }
            else
            {
                tb_prj_end.Text = prj_row.completiondate.ToString("dd/MM/yyyy");
            }
            if (prj_row.IsbudgetNull())
            {
                tb_prj_budget.Text = "";
            }
            else
            {
                tb_prj_budget.Text = Convert.ToString(prj_row.budget);
            }
            cb_isactive.Checked = prj_row.isactive;

            ViewState["prj_row"] = prj_row;

            btn_add.Visible    = false;
            btn_update.Visible = true;
            btn_cancel.Visible = true;
        }
        else
        {
            ClientScript.RegisterStartupScript(this.GetType(), "error", "<script>alert('Error in reading project details.');</script>");
        }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Encryption64 e64 = new Encryption64();

        if (!IsPostBack)
        {
            ((MenuItem)((Menu)Master.FindControl("Menu1")).FindItem("Projects")).Selected = true;
            ViewState["SortOrder"] = " ASC";

            long prjid = Convert.ToInt64(e64.Decrypt(Request.QueryString.Get("prj").Replace(" ", "+")));

            //Header Bound
            ds_analytics.projectsRow prj_row = projects.getProjectByPrjid(prjid)[0];
            lbl_name.Text     = prj_row.projectname;
            lbl_type.Text     = prj_row.projecttype;
            lbl_category.Text = prj_row.projectcategory;
            lbl_brand.Text    = prj_row.projectbrand;
            if (!prj_row.IscreatedateNull())
            {
                lbl_start.Text = prj_row.createdate.ToString("dd/MM/yyyy");
            }
            if (!prj_row.IscompletiondateNull())
            {
                lbl_end.Text = prj_row.completiondate.ToString("dd/MM/yyyy");
            }
            if (!prj_row.IsbudgetNull())
            {
                lbl_budget.Text = Convert.ToString(prj_row.budget);
            }
            cb_active.Checked = prj_row.isactive;

            //GridView
            ds_analytics.requestsDataTable req_dt = requests.getAllRequestsByProjID(prjid);
            gv_requests.DataSource = req_dt;
            gv_requests.DataBind();
            ViewState["dtStored"] = req_dt;
        }
        else
        {
        }
    }