private void LoadIssueData()
    {
        try
        {
            string    query   = "select * from tbl_Issue_Master where Application_Id='" + resAppl + "'";
            DataTable dtIssue = DBUtils.SQLSelect(new SqlCommand(query));
            DrpIssueType.DataSource     = dtIssue;
            DrpIssueType.DataTextField  = "Issue_Name";
            DrpIssueType.DataValueField = "Issue_Id";
            DrpIssueType.Items.Insert(0, new ListItem("--Select Issue--", "Select"));
            DrpIssueType.DataBind();

            DrpPriority.Items.Clear();

            DrpPriority.Items.Insert(0, new ListItem("--Select Priority--", "Select"));
            DrpPriority.Items.Insert(1, new ListItem("High", "High"));
            DrpPriority.Items.Insert(2, new ListItem("Medium", "Medium"));
            DrpPriority.Items.Insert(3, new ListItem("Low", "Low"));
            DrpPriority.DataBind();

            drpStatus.Items.Clear();
            drpStatus.Items.Insert(1, new ListItem("Open", "1"));
            drpStatus.Items.Insert(0, new ListItem("Close", "0"));
            drpStatus.DataBind();
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert(" + ex.Message + ")", true);
        }
        finally
        {
            constr.Close();
        }
    }
Exemplo n.º 2
0
    private void LoadIssueData()
    {
        try
        {
            string     query = "select * from tbl_Issue_Master where Application_Id='" + resAppl + "'";
            SqlCommand cmd   = new SqlCommand(query, constr);
            dt = DBUtils.SQLSelect(cmd);
            DrpIssueType.DataSource     = dt;
            DrpIssueType.DataTextField  = "Issue_Name";
            DrpIssueType.DataValueField = "Issue_Id";
            if (CultureInfo.CurrentCulture.Name == "es-ES")
            {
                DrpIssueType.Items.Insert(0, new ListItem("--Seleccionar problema--", "Seleccionar"));
            }
            else
            {
                DrpIssueType.Items.Insert(0, new ListItem("--Select Issue--", "Select"));
            }
            DrpIssueType.DataBind();

            DrpPriority.Items.Clear();
            if (CultureInfo.CurrentCulture.Name == "es-ES")
            {
                DrpPriority.Items.Insert(0, new ListItem("--Seleccionar prioridad--", "Seleccionar"));
                DrpPriority.Items.Insert(1, new ListItem("Alto", "Alto"));
                DrpPriority.Items.Insert(2, new ListItem("Medio", "Medio"));
                DrpPriority.Items.Insert(3, new ListItem("Bajo", "Bajo"));
            }
            else
            {
                DrpPriority.Items.Insert(0, new ListItem("--Select Priority--", "Select"));
                DrpPriority.Items.Insert(1, new ListItem("High", "High"));
                DrpPriority.Items.Insert(2, new ListItem("Medium", "Medium"));
                DrpPriority.Items.Insert(3, new ListItem("Low", "Low"));
            }
            DrpPriority.DataBind();

            drpStatus.Items.Clear();
            if (CultureInfo.CurrentCulture.Name == "es-ES")
            {
                drpStatus.Items.Insert(1, new ListItem("Abierto", "1"));
                drpStatus.Items.Insert(0, new ListItem("Cerrar", "0"));
            }
            else
            {
                drpStatus.Items.Insert(1, new ListItem("Open", "1"));
                drpStatus.Items.Insert(0, new ListItem("Close", "0"));
            }
            drpStatus.DataBind();
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert(" + ex.Message + ")", true);
        }
        finally
        {
            constr.Close();
        }
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string Id = Request.QueryString["id"];

        if (Id == null)
        {
            Response.Redirect("Login.aspx");
            return;
        }
        else if (DBNulls.StringValue(Session[PublicMethods.ConstUserEmail]).Equals(""))
        {
            Response.Redirect("Login.aspx");
            return;
        }

        string query = "select * from fnGetTicketDetail('" + Id + "')";

        table = DBUtils.SQLSelect(new SqlCommand(query));
        if (table.Rows.Count < 1)
        {
            ClientScript.RegisterClientScriptBlock(this.GetType(), "No Data Found", "alert('No Data Found...'); ", true);
            return;
        }


        drpStatus.DataSource = table;
        string dt = table.Rows[0]["Created Time"].ToString();

        lblCreatedAt.Text       = " Created Time : " + Convert.ToDateTime(dt).ToString("dd/MMM/yyyy HH:mm:ss tt", CultureInfo.InvariantCulture);
        drpStatus.DataTextField = "Status";
        drpStatus.DataBind();
        lblStatus.Text = DBNulls.StringValue(table.Rows[0]["Status"].ToString());
        if (lblStatus.Text.Equals("Open"))
        {
            btn_Edit_Details.Visible = true;
        }
        txt_Comments.Enabled      = true;
        btn_UpdateComment.Enabled = true;

        lblStatus.ForeColor = System.Drawing.Color.Green;
        //}
        //else
        //{
        //lblStatus.ForeColor = System.Drawing.Color.Red;
        //txt_Comments.Enabled = false;
        //btn_UpdateComment.Enabled = false;

        //}

        TicketID.Text          = table.Rows[0]["Ticket No"].ToString();
        drpDownType.DataSource = table;



        drpDownType.DataTextField = "Type Name";
        drpDownType.DataBind();
        drpDownApplication.DataSource    = table;
        drpDownApplication.DataTextField = "Application Name";
        drpDownApplication.DataBind();
        DrpIssueType.DataSource    = table;
        DrpIssueType.DataTextField = "Issue Name";
        DrpIssueType.DataBind();
        IssueDetail.Text          = table.Rows[0]["Issue Details"].ToString();
        DrpPriority.DataSource    = table;
        DrpPriority.DataTextField = "Priority";
        DrpPriority.DataBind();

        query = "select * from tbl_Attachment_Master where Ticket_Id='" + Id + "'";
        table = DBUtils.SQLSelect(new SqlCommand(query));
        if (table.Rows.Count > 0)
        {
            FileDownload.Enabled = true;
            txtFileName.Text     = table.Rows[0]["File_Name"].ToString();
        }
        else
        {
            FileDownload.Enabled = false;
        }
        if (!IsPostBack)
        {
            fillData();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string Id = Request.QueryString["id"];

        if (Id == null)
        {
            Response.Redirect("Login.aspx");
            return;
        }
        else if (DBNulls.StringValue(Session[PublicMethods.ConstUserEmail]).Equals(""))
        {
            Response.Redirect("Login.aspx");
            return;
        }


        if (!IsPostBack)
        {
            LoadTypeData();
            string    queryToFetchAllData = "SELECT tbl_Issue_Master.Issue_Name, tbl_Ticket_Master.*,tbl_Type_Master.Type_Name, tbl_Application_Master.Application_Name FROM  tbl_Ticket_Master INNER JOIN tbl_Type_Master ON tbl_Ticket_Master.Type_Id = tbl_Type_Master.Type_Id INNER JOIN tbl_Application_Master ON tbl_Ticket_Master.Application_Id =tbl_Application_Master.Application_Id INNER JOIN tbl_Issue_Master ON tbl_Ticket_Master.Issue_Id = tbl_Issue_Master.Issue_Id where tbl_Ticket_Master.Ticket_Id='" + Id + "' ";
            DataTable dtAllData           = DBUtils.SQLSelect(new SqlCommand(queryToFetchAllData));
            drpDownType.SelectedValue = dtAllData.Rows[0]["Type_Id"].ToString();
            resType = dtAllData.Rows[0]["Type_Id"].ToString();
            LoadApplicationData();
            drpDownApplication.SelectedValue = dtAllData.Rows[0]["Application_Id"].ToString();
            resAppl = dtAllData.Rows[0]["Application_Id"].ToString();
            LoadIssueData();
            DrpIssueType.SelectedValue = dtAllData.Rows[0]["Issue_Id"].ToString();
        }
        else
        {
            resType = drpDownType.SelectedValue;
        }

        createdBy = DBNulls.StringValue(Session[PublicMethods.ConstUserEmail]);

        //Query to prevent changes in URL
        //User can change query string and access other tickets so this query prevent this condition
        string queryToGetUserId = "SELECT [User_Id] FROM [tbl_User_Master] where [User_Email]='" + DBNulls.StringValue(Session[PublicMethods.ConstUserEmail]) + "'";
        string userId           = DBUtils.SqlSelectScalar(new SqlCommand(queryToGetUserId));


        string query = "select * from fnGetTicketDetail('" + Id + "')  where User_Id='" + userId + "'";

        table = DBUtils.SQLSelect(new SqlCommand(query));

        foreach (DataRow drDetails in table.Rows)
        {
            typeName        = drDetails["Type Name"].ToString();
            applicationName = drDetails["Application Name"].ToString();
            issueName       = drDetails["Issue Name"].ToString();
        }



        drpStatus.DataSource    = table;
        drpStatus.DataTextField = "Status";
        drpStatus.DataBind();
        lblStatus.Text = DBNulls.StringValue(table.Rows[0]["Status"].ToString());
        if (lblStatus.Text.Equals("Open"))
        {
            btn_Edit_Details.Visible = true;
        }


        lblStatus.ForeColor = System.Drawing.Color.Green;


        TicketID.Text          = table.Rows[0]["Ticket No"].ToString();
        drpDownType.DataSource = table;



        if (!IsPostBack)
        {
            IssueDetail.Text = table.Rows[0]["Issue Details"].ToString();
        }
        DrpPriority.DataSource    = table;
        DrpPriority.DataTextField = "Priority";
        DrpPriority.DataBind();

        query = "select * from tbl_Attachment_Master where Ticket_Id='" + Id + "'";
        table = DBUtils.SQLSelect(new SqlCommand(query));
        if (table.Rows.Count > 0)
        {
            FileDownload.Enabled = true;
            txtFileName.Text     = table.Rows[0]["File_Name"].ToString();
        }
        else
        {
            FileDownload.Enabled = false;
        }
    }