Пример #1
0
    protected void ImageButtonAnswer_Click(object sender, ImageClickEventArgs e)
    {
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);
        SqlCommand    sqlCmd  = new SqlCommand("sp_supportRequestAnswer", sqlConn);

        sqlCmd.CommandType = CommandType.StoredProcedure;
        sqlCmd.Parameters.Add("@RequestId", SqlDbType.Int).Value         = GridViewRequests.SelectedDataKey.Value;
        sqlCmd.Parameters.Add("@Conversation", SqlDbType.NVarChar).Value = "پاسخ پشتیبانی:\n" + TextBoxAnswer.Text + "\n\n------------------------------\n\n" + TextBoxConversation.Text;
        sqlCmd.Parameters.Add("@Status", SqlDbType.Int).Value            = 2;

        sqlConn.Open();
        sqlCmd.ExecuteNonQuery();

        SqlCommand sqlCmd2 = new SqlCommand("sp_supportRequestUnread", sqlConn);

        sqlCmd2.CommandType = CommandType.StoredProcedure;
        sqlCmd2.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(LabelRequestUserId.Text);

        sqlCmd2.ExecuteNonQuery();

        sqlCmd.Dispose();
        sqlConn.Dispose();

        GridViewRequests.DataBind();
        PanelRequest.Visible = false;
    }
Пример #2
0
    protected void ImageButtonArchive_Click(object sender, ImageClickEventArgs e)
    {
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);
        SqlCommand    sqlCmd  = new SqlCommand("sp_supportRequestArchive", sqlConn);

        sqlCmd.CommandType = CommandType.StoredProcedure;
        sqlCmd.Parameters.Add("@RequestId", SqlDbType.Int).Value = GridViewRequests.SelectedDataKey.Value;

        sqlConn.Open();
        sqlCmd.ExecuteNonQuery();

        sqlCmd.Dispose();
        sqlConn.Dispose();

        GridViewRequests.DataBind();
        PanelRequestInfo.Visible = false;
    }
Пример #3
0
    protected void ImageButtonDelete_Click(object sender, ImageClickEventArgs e)
    {
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);
        SqlCommand    sqlCmd  = new SqlCommand("sp_supportRequestDelete", sqlConn);

        sqlCmd.CommandType = CommandType.StoredProcedure;
        sqlCmd.Parameters.Add("@RequestId", SqlDbType.Int).Value = GridViewRequests.SelectedDataKey.Value;

        sqlConn.Open();
        sqlCmd.ExecuteNonQuery();

        DataTable dt = new DataTable();
        DataSet   ds = new DataSet();

        SqlDataAdapter sda = new SqlDataAdapter("sp_userMenuRemindersCount", sqlConn);

        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);
        sda.Fill(ds);
        dt = ds.Tables[0];

        if (Convert.ToInt32(dt.Rows[0]["SupportRequestsCount"].ToString()) != 0)
        {
            LabelRequestsNewCount.Visible = true;
            LabelRequestsNewCount.Text    = "(" + dt.Rows[0]["SupportRequestsCount"].ToString() + " درخواست پاسخ داده شده)";
        }
        else
        {
            LabelRequestsNewCount.Visible = false;
        }

        sda.Dispose();
        sqlCmd.Dispose();
        sqlConn.Dispose();

        GridViewRequests.DataBind();
        PanelRequestInfo.Visible = false;
    }