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

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



                              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
                              return "t";   }
   285   286   287   288   289   290   291   292   293   294   295