Page 282 - ระบบบริหารจัดการงบประมาณด้านเทคโนโลยีสารสนเทศและการสื่อสาร กรมพัฒนาที่ดิน
P. 282

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



                          if (!fu01.HasFile)
                          return sAlertNotExisted;
                          try

                          {
                              string sFileName; //ชื่อไฟล์ abc.txt
                              string sFileExt; //ชนิดไฟล์ .txt
                              sFileName = Request.QueryString["FormID"] + fu01.FileName;

                              sFileExt = Path.GetExtension(sFileName).ToLower();
                              Boolean bValidExt = false;
                              for (int i = 0; i < sValidExt.Length; i++)
                              {  if (sValidExt[i] == sFileExt)

                                  {   bValidExt = true;
                                      break;
                                  }
                                  sAlertInvalidFileType += " " + sValidExt[i];

                              }
                                  if (bValidExt == false)
                                  return sAlertInvalidFileType;
                              if (fu01.PostedFile.ContentLength > iMaxFileSize)

                                  return sAlertSizeTooBig;
                              string sCurrentPath = Server.MapPath("~/" + sFolderName + "/");
                              sCurrentPath += sFileName;

                              fu01.SaveAs(sCurrentPath);
                              return sAlertSuccess + "|" + sFileName;
                          }
                          catch (Exception ex)
                          { return sAlertFail + ex.Message;

                          }
                      }
                      protected string checkVersion(string sItemStandardID, string sFiscalYear, string sVersion)

                      {   string sSql;
                          DbMgt table = new DbMgt(str);
                          sSql = "select count(*) from ActiveItemVersion where ItemStandardID = '" +
                  sItemStandardID + "' and FiscalYear = '" + sFiscalYear + "' and Version = " + sVersion;

                          if (table.exScalar(sSql) == "0")
                              return "f";
                          else
   277   278   279   280   281   282   283   284   285   286   287