You must Sign In to post a response.
  • Category: .NET

    How to send the complete gridview row data to that particular user using c# and asp .net

    In my application i have many users and finally one client who is the head for that users.If a particular user logins with his credentials he is able to view the page in this way [![this is the page that user can see when he logins with his user id and password and on clicking the link button which is under below the file name he can see a audio file and below to it a ckeditor with a button finally on clicking that submit button it gets submitted and saved in database][1]][1]


    Now when the head gets logged in with his credentials he can see the page in this way[![this is the first image he can see][2]][2] and on selecting a link button he can see this one[![here we have a third radio button named Re work when user selects this radio button and click on submit we should be able to view again that one when the particular user login again][3]][3]

    that is if head selects the first one Lakshmi the he will get audio and ckeditor as seen in third image in that if we select third radio button and click on submit the complete row except worked by should go to that particular user again when user login with his credentails he should be able to view this entire data.this should be done only if he is a transcriber if he is a proofer it should not go to that particular user.


    [1]: https://i.stack.imgur.com/WfGqw.png
    [2]: https://i.stack.imgur.com/NocI9.png
    [3]: https://i.stack.imgur.com/f8s20.png

    Admin adm;
    protected void Page_Load(object sender, EventArgs e)
    {
    if (Session.Count > 0) { if (Session["uid"] != null) lblUser.Text = Session["uid"].ToString(); else Response.Redirect("Login.aspx?i=1"); } else Response.Redirect("Login.aspx?i=1");
    adm = new Admin();
    if (!IsPostBack)
    {
    ViewState["id"] = Request.QueryString["id"].ToString();
    GetAudio(Request.QueryString["id"].ToString());
    }
    }

    private void GetAudio(string ID)
    {
    DataSet ds = adm.MTGGetAudioForClientQC(ID, Session["uid"].ToString());
    if (ds.Tables.Count == 0)
    {
    btnCompleteTranscription.Visible = false;
    lblMessage.Text = "Transcription for selected fiel is not possible...";
    ViewState["id"] = "0";
    ViewState["dt"] = "";
    }
    else
    {
    lblMessage.Text = string.Empty;
    btnCompleteTranscription.Visible = true;
    if (ds.Tables[0].Rows.Count > 0)
    {
    ViewState["dt"] = ds.Tables[0];
    //ddlTemplates.DataSource = ds.Tables[0];
    //ddlTemplates.DataTextField = "TemplateName";
    //ddlTemplates.DataValueField = "TemplateName";
    //ddlTemplates.DataBind();
    //ShowTemplate((byte[])ds.Tables[0].Rows[0]["Template"]);
    }
    else
    {
    //ddlTemplates.Items.Clear();
    //ddlTemplates.DataBind();
    }
    if (ds.Tables[1].Rows.Count > 0)
    {
    DataTable dt = ds.Tables[1];
    string path = Server.MapPath("~/GT" + "/" + dt.Rows[0]["Filename"].ToString());
    //ViewState["af"] = dt.Rows[0]["ZipFileName"].ToString();
    ViewState["af"] = dt.Rows[0]["ZipFileName"].ToString().Substring(dt.Rows[0]["ZipFileName"].ToString().LastIndexOf(@"\") + 1).Replace(".gz", "");
    path = AudioFilename(dt.Rows[0]["ZipFileName"].ToString(), dt.Rows[0]["FileName"].ToString());
    dt.Columns.Add("audio", typeof(string));
    foreach (DataRow row in dt.Rows)
    {
    row["audio"] = path;
    }
    dt.AcceptChanges();

    GridView1.DataSource = dt;
    GridView1.DataBind();
    }
    else
    {
    GridView1.DataSource = null;
    GridView1.DataBind();
    }
    if (ds.Tables[2].Rows.Count > 0)
    {
    //CKEditor1.Text = ds.Tables[2].Rows[0]["ProofingData"].ToString();
    CKEditor1.Text = ds.Tables[2].Rows[0]["TranscribedData"].ToString();
    //ViewState["mtd"] = ds.Tables[2].Rows[0]["ProofingData"].ToString();
    ViewState["mtd"] = ds.Tables[2].Rows[0]["TranscribedData"].ToString();
    //ViewState["templatecharcount"] = ds.Tables[2].Rows[0]["TemplateLineCount"].ToString();
    }
    else
    {
    CKEditor1.Text = string.Empty;
    }
    }
    }
    private string AudioFilename(string AudioFullPath, string OnlyFileName)
    {
    string APath = AudioFullPath;
    APath = "GT" + APath.Replace(@"C:\Eliscription\ToEliscription", "").Replace(@"\", "/");
    string OnlyAudioName = APath.Substring(APath.LastIndexOf("/") + 1);
    string OFName = OnlyFileName.Replace(".wav", "");
    string OnlyAudioName1 = OnlyAudioName.Replace(OFName, "");
    string DateFolder = OnlyAudioName1.Substring(0, 8);
    APath = APath.Substring(0, APath.LastIndexOf("/") + 1);
    APath = APath + DateFolder + "/" + OnlyAudioName.Replace(".gz", "") + ".wav";
    return APath;
    }
    protected void btnCompleteTranscription_Click(object sender, EventArgs e)
    {
    ViewState["pd"] = CKEditor1.Text;
    string Text = "<html><body>" + CKEditor1.Text + "</body></html>";
    Text = Text.Replace("<", "<");
    Text = Text.Replace(">", ">");
    Text = Text.Replace(">style=", "><span style=");
    Text = Text.Replace("<span <", "<span></span> <");
    Text = Text.Replace("<p <", "<p> <");
    Text = Text.Replace("<del", "<s><span");
    Text = Text.Replace("</del", "</s></span");
    Text = Text.Replace(" ", " ");
    Text = Text.Replace("<s style=", "<s><span style=");
    Text = Text.Replace("<p <", "<p style=\"text-align:justify\"><span><");
    string datefolder = DateTime.Today.Month.ToString().Length < 2 ? "0" + DateTime.Today.Month.ToString() : DateTime.Today.Month.ToString(); datefolder += DateTime.Today.Day.ToString().Length < 2 ? "0" + DateTime.Today.Day.ToString() : DateTime.Today.Day.ToString(); datefolder += DateTime.Today.Year.ToString();
    string QCPath = Server.MapPath("~/GDocs/" + Session["uid"].ToString().ToUpper() + "/QC/" + datefolder);
    if (!System.IO.Directory.Exists(QCPath))
    {
    System.IO.Directory.CreateDirectory(QCPath);
    }
    using (System.IO.StreamWriter file = new System.IO.StreamWriter(QCPath + @"\" + ViewState["af"].ToString().Replace(".wav", "") + ".Doc"))
    {
    file.Write(Text);
    }

    //get prof doc char count.
    string text = CKEditor1.Text;
    text = Regex.Replace(text, @"<[^>]+>| | ", "");
    text = Regex.Replace(text, @"\s+", " ");
    text = text.Replace("–", "–");
    text = text.Replace("’", "'");

    string status = "8";
    if (rbQCNotDone.Checked)
    status = "9";

    //int lineCount = text.Length - Int32.Parse(ViewState["templatecharcount"].ToString());
    //decimal lc = (decimal)(lineCount / 65f);
    //Compare();
    //ViewState["templatecharcount"]
    adm.MTGSaveClientQCWork(ViewState["id"].ToString(), CKEditor1.Text, Session["uid"].ToString(), "", status);
    Response.Redirect("MTGReadyToClientQCWorks.aspx");
    }

    public void Compare()
    {
    string firstDocument = CKEditor1.Text.ToString();
    string secondDocument = ViewState["mtd"].ToString();
    string secondDocumentFinal = Regex.Replace(secondDocument, @"<[^>]+>| ", "").Trim();
    secondDocument = secondDocument.Replace("<span>", "<div>");
    diff_match_patch dmp = new diff_match_patch();
    var diffs = dmp.diff_lineMode(secondDocument, firstDocument);
    dmp.diff_cleanupSemanticLossless(diffs);
    var FinalDocument = dmp.diff_prettyHtml(diffs);
    CKEditor1.Text = "";
    string secondDocumentFinal1 = Regex.Replace(FinalDocument, @" |¶|''", "").Trim();
    string Text = "<html><body>" + FinalDocument + "</body></html>";
    Text = Text.Replace("<", "<");
    Text = Text.Replace(">", ">");
    Text = Text.Replace(">style=", "><span style=");
    Text = Text.Replace("<span <", "<span></span> <");
    Text = Text.Replace("<p <", "<p> <");
    Text = Text.Replace("<del", "<s><span");
    Text = Text.Replace("</del", "</s></span");
    Text = Text.Replace(" ", " ");
    Text = Text.Replace("<s style=", "<s><span style=");
    Text = Text.Replace("<p <", "<p style=\"text-align:justify\"><span><");
    CKEditor1.Text = Text;

    string datefolder = DateTime.Today.Month.ToString().Length < 2 ? "0" + DateTime.Today.Month.ToString() : DateTime.Today.Month.ToString(); datefolder += DateTime.Today.Day.ToString().Length < 2 ? "0" + DateTime.Today.Day.ToString() : DateTime.Today.Day.ToString(); datefolder += DateTime.Today.Year.ToString();
    string ComparePath = Server.MapPath("~/GDocs/" + Session["uid"].ToString() + "/Compared/" + datefolder);
    if (!System.IO.Directory.Exists(ComparePath))
    {
    System.IO.Directory.CreateDirectory(ComparePath);
    }
    using (System.IO.StreamWriter file = new System.IO.StreamWriter(ComparePath + @"\" + ViewState["af"].ToString().Replace(".wav", "") + ".Doc"))
    {
    file.Write(Text);
    }
    }

    there is no need to insert this into database just what i need is when the head selects Rework radio button and clicks on submit if the selected user by the head is a transcriber the it should get displayed there when that user logins with his credentials can any one help me out
  • #768098
    Hai Kavita,
    If you are using ASP.Net, then it better to make use of the RowDataBound event handler where you can have a link to send all the data for the row.
    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com


Sign In to post your comments