private string CheckNeeded()
    {
        string rtn         = "";
        string dealDate    = DealDate.Text.Trim();
        string num         = Num.Text.Trim();
        string storge      = Storage.Text.Trim();
        string useType     = UseType.SelectedValue.ToString();
        string updateReson = UpdateReson.SelectedValue.ToString();

        if (dealDate.Length == 0)
        {
            rtn += "領用日期:必填!\\n";
        }
        else if (RegularExpressions.IsDate((Convert.ToInt32(DealDate.Text.Substring(0, 3)) + 1911).ToString() + "-" + DealDate.Text.Substring(3, 2) + "-" + DealDate.Text.Substring(5, 2)) == false)
        {
            rtn += "領用日期:日期有誤!\\n";
        }

        if (num.Length == 0)
        {
            rtn += "領用數量:必填!\\n";
        }
        else if (RegularExpressions.IsPlusInt(num) == false)
        {
            rtn += "領用數量:請輸入正整數!\\n";
        }

        if (useType == "0")
        {
            rtn += "領用用途:必填!\\n";
        }

        if (updateReson == "0")
        {
            rtn += "修改原因:必填!\\n";
        }

        return(rtn);
    }
Esempio n. 2
0
    private string CheckNeeded()
    {
        string rtn              = "";
        string dealDate         = DealDate.Text.Trim();
        string dealHospitalName = DealHospitalName.Text.Trim();
        string dealHospitalID   = DealHospitalID.Value.Trim();
        string num              = Num.Text.Trim();
        string tempHigh         = TempHigh.Text.Trim();
        string tempLow          = TempLow.Text.Trim();
        string dealType         = DealType.SelectedValue.ToString();

        if (dealDate.Length == 0)
        {
            rtn += "撥入日期:必填!\\n";
        }
        else if (RegularExpressions.IsDate((Convert.ToInt32(DealDate.Text.Substring(0, 3)) + 1911).ToString() + "-" + DealDate.Text.Substring(3, 2) + "-" + DealDate.Text.Substring(5, 2)) == false)
        {
            rtn += "撥入日期:日期有誤!\\n";
        }

        if (dealType == "4")
        {
            if (dealHospitalName.Length == 0 && dealHospitalID.Length == 0)
            {
                rtn += "撥入類別:合約醫院:必填!\\n";
            }
        }

        if (num.Length == 0)
        {
            rtn += "撥入數量:必填!\\n";
        }
        else if (RegularExpressions.IsPlusInt(num) == false)
        {
            rtn += "撥入數量:請輸入正整數!\\n";
        }

        if (tempHigh.Length == 0)
        {
            rtn += "運送期間溫度:最高:必填!\\n";
        }
        else if (RegularExpressions.IsFloatTo1(tempHigh) == false)
        {
            rtn += "運送期間溫度:最高:正整數或至小數點後一位!\\n";
        }

        if (tempLow.Length == 0)
        {
            rtn += "運送期間溫度:最低:必填!\\n";
        }
        else if (RegularExpressions.IsFloatTo1(tempLow) == false)
        {
            rtn += "運送期間溫度:最低:正整數或至小數點後一位!\\n";
        }

        if (tempHigh.Length != 0 && tempLow.Length != 0 && RegularExpressions.IsFloatTo1(tempHigh) == true && RegularExpressions.IsFloatTo1(tempLow) == true)
        {
            if (float.Parse(tempHigh) < float.Parse(tempLow) || float.Parse(tempHigh) > 8.0)
            {
                rtn += "運送期間溫度:最高:低於最低溫度或大於8°C!\\n";
            }

            if (float.Parse(tempLow) > float.Parse(tempHigh) || float.Parse(tempLow) < 2.0)
            {
                rtn += "運送期間溫度:最低:高於最高溫度或小於2°C!\\n";
            }
        }

        if (TempFile.HasFile == true)
        {
            HttpFileCollection multipleFiles = Request.Files;
            for (int fileCount = 0; fileCount < multipleFiles.Count; fileCount++)
            {
                HttpPostedFile uploadedFile = multipleFiles[fileCount];
                byte[]         fileData     = null;
                using (var binaryReader = new BinaryReader(uploadedFile.InputStream))
                {
                    fileData = binaryReader.ReadBytes(uploadedFile.ContentLength);
                }
                if (fileData.Length > 3145728)
                {
                    rtn += "上傳溫度資料檔案:此檔案" + uploadedFile.FileName + "超過3M!\\n";
                }
            }
        }

        return(rtn);
    }