protected void showData()
 {
     string year, month, day;
     if (Request["yy"] != null) year = Request["yy"];
     else year = DateTime.Today.Year.ToString();
     if (Request["mm"] != null) month = Request["mm"];
     else month = DateTime.Today.Month.ToString();
     if (Request["dd"] != null) day = Request["dd"];
     else day = "32";
     try
     {
         mobileClass mob = new mobileClass();
         DataSet ds = mob.fillDataset(string.Format("EXEC mobile_getCV_CongVan {0}, {1}, {2}, {3}", UserId, year, month, day));
         DataColumn dc = new DataColumn("fileName");
         ds.Tables[0].Columns.Add(dc);
         dc = new DataColumn("fileLink");
         ds.Tables[0].Columns.Add(dc);
         dc = new DataColumn("bpPhongBan");
         ds.Tables[0].Columns.Add(dc);
         DataSet dsTemp;
         ds.Tables[0].AcceptChanges();
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             dr.BeginEdit();
             try
             {
                 dsTemp = mob.fillDataset(string.Format("EXEC mobile_getCV_Shared {0}, {1}, {2}", UserId, dr[0], dr[1]));
                 dr["fileName"] = dsTemp.Tables[0].Rows[0][2].ToString();
                 dr["fileLink"] = string.Format("{0}?ID={1}&CV={2}", ResolveUrl("viewfile.aspx"), dsTemp.Tables[0].Rows[0][0], dsTemp.Tables[0].Rows[0][1]);
                 dr["bpPhongBan"] = dsTemp.Tables[1].Rows[0][0].ToString();
             }
             catch { }
             if (dr["ButPheLD"].ToString() != "") dr["ButPheLD"] = "<img src='/ICT/images/icon_hostusers_16px.gif' /> " + dr["ButPheLD"];
             if (dr["bpPhongBan"].ToString() != "") dr["bpPhongBan"] = "<img src='/ICT/images/edit.gif' /> " + dr["bpPhongBan"];
             if (dr["TenNoiTHChinh"].ToString() != "") dr["TenNoiTHChinh"] = "<img src='/ICT/images/icon_solutions_16px.gif' /> " + dr["TenNoiTHChinh"];
             dr.EndEdit();
         }
         dataCongVan.DataSource = ds;
         dataCongVan.DataBind();
     }
     catch
     {
         dataCongVan.DataSource = null;
         dataCongVan.DataBind();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack) return;
     if (Request["ID"] == null) return;
     if (Request["CV"] == null) return;
     try
     {
         mobileClass ob = new mobileClass();
         DataSet ds = ob.fillDataset(string.Format("EXEC mobile_getCV_Files {0}, {1}", Request["ID"], Request["CV"]));
         Response.Buffer = true;
         Response.Clear();
         Response.ClearHeaders();
         Response.ClearContent();
         if (Request.UserAgent.Contains("Android")) Response.AddHeader("content-disposition", "attachment; filename=" + ds.Tables[0].Rows[0]["FileName"].ToString());
         Response.ContentType = ds.Tables[0].Rows[0]["FileType"].ToString();
         Byte[] pdfData = (byte[])ds.Tables[0].Rows[0]["FileData"];
         Response.BinaryWrite(pdfData);
         Response.End();
     }
     catch (Exception ex) { Response.Write(ex.Message); }
 }