Page 144 - ระบบสารสนเทศเพื่อการบริหารจัดการเอกสารอิเล็กทรอนิกส์ (e-Document)
P. 144

ห้องสมุดกรมพัฒนาที่ดิน
                                                                                                        ค- 31




                          lblPermission.Text = ddl.createDDL("ddlPermission", sSql11, "ID",
                  "Value", Request.Form["ddlPermission"], "na", "--กลุ่มผู้เรียกดูข้อมูล--", false);

                          txtOtherOff.Visible = false;
                          if (Request.Form["ddlBureau"] == "9999")
                          {
                              txtOtherOff.Visible = true;
                          }

                          string sSqll = "SELECT Bureau FROM BureauIntra WHERE BureauID = N'"
                  + sBureau + "'";
                          DbMgt table = new DbMgt(str);
                          MyDataSet ds = new MyDataSet(table.exReader(sSqll));
                          lblsBureau.Text = "หน่วยงาน :" + ds.showFieldValue("Bureau", 0);
                      }

                      protected string upload(string sFilename)
                      {
                          {
                              try
                              {
                                  string[] sValidExt = { ".pdf", ".zip", ".rar" };
                                  string sFolderName = "Letter";
                                  string sAlertInvalidFileType = "กรุณาเลือกไฟล์ชนิด";
                                  string sAlertSuccess = "Upload ไฟล์เรียบร้อยแล้ว";
                                  string sAlertFailure = "เกิดความผิดพลาด ไม่สามารถ Upload ไฟล์ได้";
                                  Boolean bValidExt;
                                  string sFileName;
                                  string sFileExt;
                                  sFileName = upBrowse.FileName;
                                  sFileExt = Path.GetExtension(sFileName).ToLower();
                                  #region Check bValidExt (failure => terminate program)
                                  bValidExt = false;
                                  for (int i = 0; i < sValidExt.Length; i++)
                                  {
                                      sAlertInvalidFileType += " " + sValidExt[i];

                                      if (sValidExt[i] == sFileExt)
                                      {
                                          bValidExt = true;
                                      }
                                  }
                                  if (bValidExt == false)
                                  {
                                      return sAlertInvalidFileType;
                                  }
                                  #endregion

                                  #region Check file size (optional)
                                  if (upBrowse.PostedFile.ContentLength > 3145728)
                                  {
                                      return "ไม่สามารถแนบไฟล์ที่มีขนาดเกินกว่า 3 MB ได้";
                                  }
                                  #endregion

                                  #region Change name of uploaded file (optional)
                                  sFileName = sFilename + sFileExt;
                                  #endregion
   139   140   141   142   143   144   145   146   147   148   149