protected bool validData() { bool result = true; if (txtDate1.Text.Trim() != "" && StrHlp.CheckDateFormat(txtDate1.Text.Trim()) == false) { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('統計日期格式不正確!');", true); //cls.clsPublic.WebMessageBox(this.Page, "訂單日期格式錯誤!"); txtDate1.Focus(); result = false; } else { if (txtDate2.Text.Trim() != "" && StrHlp.CheckDateFormat(txtDate2.Text.Trim()) == false) { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('統計日期格式不正確!');", true); txtDate2.Focus(); result = false; } } if (txtDep.Text == "") { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('請輸入部門編號!');", true); txtDep.Focus(); result = false; } return(result); }
protected bool validData(int find_type) { bool result = true; if (find_type == 2 && dlOwnType.SelectedIndex == 0) { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('查詢部門不能為空!');", true); return(false); } if (dateStart.Value.Trim() != "" && StrHlp.CheckDateFormat(dateStart.Value.Trim()) == false) { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('日期格式不正確!');", true); //cls.clsPublic.WebMessageBox(this.Page, "訂單日期格式錯誤!"); dateStart.Focus(); result = false; } else { if (dateEnd.Value.Trim() != "" && StrHlp.CheckDateFormat(dateEnd.Value.Trim()) == false) { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('日期格式不正確!');", true); dateEnd.Focus(); result = false; } } return(result); }
protected bool validData() { bool result = true; if (txtDep.Text == "") { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('查詢明細表時,部門編號不能為空!');", true); txtDep.Focus(); result = false; } if (dateStart.Value.Trim() != "" && StrHlp.CheckDateFormat(dateStart.Value.Trim()) == false) { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('批準日期格式不正確!');", true); //cls.clsPublic.WebMessageBox(this.Page, "訂單日期格式錯誤!"); dateStart.Focus(); result = false; } else { if (dateEnd.Value.Trim() != "" && StrHlp.CheckDateFormat(dateEnd.Value.Trim()) == false) { StrHlp.WebMessageBox(this.Page, "批準日期格式錯誤!"); dateEnd.Focus(); result = false; } } return(result); }
protected bool validData() { bool result = true; if (dateStart.Value.Trim() != "" && StrHlp.CheckDateFormat(dateStart.Value.Trim()) == false) { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('發票日期格式不正確!');", true); //cls.clsPublic.WebMessageBox(this.Page, "訂單日期格式錯誤!"); dateStart.Focus(); result = false; } else { if (dateEnd.Value.Trim() != "" && StrHlp.CheckDateFormat(dateEnd.Value.Trim()) == false) { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('發票日期格式不正確!');", true); dateEnd.Focus(); result = false; } } //if (txtAgent1.Text == "" && txtAgent2.Text == "") //{ // ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('請輸入洋行編號!');", true); // txtAgent1.Focus(); // result = false; //} return(result); }
protected bool validData() { bool result = true; if (txtDoc_date1.Text.Trim() != "" && StrHlp.CheckDateFormat(txtDoc_date1.Text.Trim()) == false) { StrHlp.WebMessageBox(this.Page, "日期格式錯誤!"); txtDoc_date1.Focus(); result = false; } else { if (txtDoc_date2.Text.Trim() != "" && StrHlp.CheckDateFormat(txtDoc_date2.Text.Trim()) == false) { StrHlp.WebMessageBox(this.Page, "日期格式錯誤!"); txtDoc_date2.Focus(); result = false; } } return(result); }
protected bool validData() { bool result = true; StrHelper StrHlp = new StrHelper(); //if (orderDateStart.Value.Trim() != "" && StrHlp.CheckDateFormat(orderDateStart.Value.Trim()) == false) //{ // ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('訂單日期格式不正確!');", true); // //cls.clsPublic.WebMessageBox(this.Page, "訂單日期格式錯誤!"); // orderDateStart.Focus(); // result = false; //} //else //{ // if (orderDateEnd.Value.Trim() != "" && StrHlp.CheckDateFormat(orderDateEnd.Value.Trim()) == false) // { // StrHlp.WebMessageBox(this.Page, "訂單日期格式錯誤!"); // orderDateEnd.Focus(); // result = false; // } //} if (dateStart.Value.Trim() != "" && StrHlp.CheckDateFormat(dateStart.Value.Trim()) == false) { StrHlp.WebMessageBox(this.Page, "開單日期格式錯誤!"); dateStart.Focus(); result = false; } else { if (dateEnd.Value.Trim() != "" && StrHlp.CheckDateFormat(dateEnd.Value.Trim()) == false) { StrHlp.WebMessageBox(this.Page, "開單日期格式錯誤!"); dateEnd.Focus(); result = false; } } return(result); }
protected bool validData() { bool result = true; if (dateStart.Value.Trim() != "" && StrHlp.CheckDateFormat(dateStart.Value.Trim()) == false) { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('發票日期格式不正確!');", true); dateStart.Focus(); result = false; } else { if (dateEnd.Value.Trim() != "" && StrHlp.CheckDateFormat(dateEnd.Value.Trim()) == false) { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('發票日期格式不正確!');", true); dateEnd.Focus(); result = false; } } return(result); }
protected bool validData() { bool result = true; if (orderDateStart.Value.Trim() != "" && StrHlp.CheckDateFormat(orderDateStart.Value.Trim()) == false) { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "alert", " alert('訂單日期格式不正確!');", true); orderDateStart.Focus(); result = false; } else { if (orderDateEnd.Value.Trim() != "" && StrHlp.CheckDateFormat(orderDateEnd.Value.Trim()) == false) { StrHlp.WebMessageBox(this.Page, "訂單日期格式錯誤!"); orderDateEnd.Focus(); result = false; } } if (createDateStart.Value.Trim() != "" && StrHlp.CheckDateFormat(createDateStart.Value.Trim()) == false) { StrHlp.WebMessageBox(this.Page, "開單日期格式錯誤!"); createDateStart.Focus(); result = false; } else { if (createDateEnd.Value.Trim() != "" && StrHlp.CheckDateFormat(createDateEnd.Value.Trim()) == false) { StrHlp.WebMessageBox(this.Page, "開單日期格式錯誤!"); createDateEnd.Focus(); result = false; } } return(result); }
protected void BindData() { user_id = getUserName(); string strDat1 = dateStart.Value; string strDat2 = dateEnd.Value; if (!StrHlp.CheckDateFormat(strDat1)) { strDat1 = ""; } if (!StrHlp.CheckDateFormat(strDat2)) { strDat2 = ""; } string sales_group = dlSales_group.SelectedValue.ToString(); string brand = txtBrand.Text; string mat = txtMaterial.Text; string cust_code = txtCust_code.Text; string cust_color = txtCust_color.Text; string cf_code = txtCf_code.Text; string cf_color = txtCf_color.Text; string season = txtSeason.Text; string temp_code = txtTemp_code.Text; string size = txtSize.Text; string sub_mo_id = txtSubMo.Text; string product_desc = txtGood_desc.Text; string plm_code = ""; string reason_edit = ""; string remark = ""; string other_remark = ""; string remark_for_pdd = ""; SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@user_id", user_id), new SqlParameter("@sales_group", sales_group), new SqlParameter("@brand", brand), new SqlParameter("@material", mat), new SqlParameter("@cust_code", cust_code), new SqlParameter("@cust_color", cust_color), new SqlParameter("@cf_code", cf_code), new SqlParameter("@cf_color", cf_color), new SqlParameter("@season", season), new SqlParameter("@temp_code", temp_code), new SqlParameter("@size", size), new SqlParameter("@dat1", strDat1), new SqlParameter("@dat2", strDat2), new SqlParameter("@mo_id", txtMo_id.Text), new SqlParameter("@sub_mo_id", sub_mo_id), new SqlParameter("@plm_code", plm_code), new SqlParameter("@reason_edit", reason_edit), new SqlParameter("@product_desc", product_desc), new SqlParameter("@remark", remark), new SqlParameter("@other_remark", other_remark), new SqlParameter("@remark_for_pdd", remark_for_pdd) }; DataTable dtQuotation = sh.ExecuteProcedure("usp_qoutation_find", paras); if (dtQuotation.Rows.Count == 0) { dtQuotation.Rows.Add(); } gvDetails.DataSource = dtQuotation.DefaultView; gvDetails.DataBind(); }
protected void btnUpload_Click(object sender, EventArgs e) { //這個是JavaScript取值方法 //string[] proSub = Request.Form.GetValues("selDep"); //string prd_dep = proSub[selDep.SelectedIndex]; string now_date = txtDate.Value.ToString(); if (!StrHlp.CheckDateFormat(now_date)) { StrHlp.WebMessageBox(this.Page, "日期無效!"); return; } Boolean fileOk = false; //判断是否已经选取文件 if (fileId.HasFile) { //取得文件的扩展名,并转换成小写 string fileExtension = System.IO.Path.GetExtension(fileId.FileName).ToLower(); //限定只能上传jpg和gif图片 //string[] allowExtension = { ".jpg", ".gif", ".xls" }; string[] allowExtension = { ".xls" }; //对上传的文件的类型进行一个个匹对 for (int i = 0; i < allowExtension.Length; i++) { if (fileExtension == allowExtension[i]) { fileOk = true; break; } } // if (!fileOk) { StrHlp.WebMessageBox(this.Page, "上傳的文件類型不正確!"); } //对上传文件的大小进行检测,限定文件最大不超过1M //if (fileId.PostedFile.ContentLength > 1024000) //{ // fileOk = false; //} } else { StrHlp.WebMessageBox(this.Page, "文件不存在!"); } //Response.Write("<script>alert('弹出的消息')</script>"); //this.Page.RegisterStartupScript(" ", "<script>alert(' 弹出的消息 '); </script> "); if (!fileOk) { return; } string fileName = fileId.FileName; if (fileName == "") { StrHlp.WebMessageBox(this.Page, "文件不存在!"); return; } string savePath = Server.MapPath("~/file/"); FileOperatpr(fileName, savePath); fileId.SaveAs(savePath + fileName); DataSet dsExcel = new DataSet(); dsExcel = ImportExcel(savePath + fileName); DataSetOperator(dsExcel.Tables[0]); //DataOperator(fileName, savePath); }
protected void btnUpload_Click(object sender, EventArgs e) { //這個是JavaScript取值方法 //string[] proSub = Request.Form.GetValues("selDep"); //string prd_dep = proSub[selDep.SelectedIndex]; string now_date = dateArrange.Value; //System.DateTime.Now.ToString("yyyy/MM/dd"); if (dlDep.SelectedIndex == 0) { StrHlp.WebMessageBox(this.Page, "部門不能為空!"); return; } if (!StrHlp.CheckDateFormat(now_date)) { StrHlp.WebMessageBox(this.Page, "日期無效!"); return; } Boolean fileOk = false; //判断是否已经选取文件 if (fileId.HasFile) { //取得文件的扩展名,并转换成小写 string fileExtension = System.IO.Path.GetExtension(fileId.FileName).ToLower(); //限定只能上传jpg和gif图片 //string[] allowExtension = { ".jpg", ".gif", ".xls" }; string[] allowExtension = { ".xls" }; //对上传的文件的类型进行一个个匹对 for (int i = 0; i < allowExtension.Length; i++) { if (fileExtension == allowExtension[i]) { fileOk = true; break; } } // if (!fileOk) { StrHlp.WebMessageBox(this.Page, "要上传的文件类型不对!"); } //对上传文件的大小进行检测,限定文件最大不超过1M //if (fileId.PostedFile.ContentLength > 1024000) //{ // fileOk = false; //} } else { StrHlp.WebMessageBox(this.Page, "文件不存在!"); } if (!fileOk) { return; } string fileName = fileId.FileName; if (fileName == "") { StrHlp.WebMessageBox(this.Page, "文件不存在!"); return; } string savePath = Server.MapPath("~/file/"); FileOperatpr(fileName, savePath); fileId.SaveAs(savePath + fileName); DataOperator(fileName, savePath); //LoadBatchMo(); }