Esempio n. 1
0
    public static string GetPickInfoCount(string st_accept_date, string pick_date, string pick_batch, string v_type)
    {
       

        CGDModel.ProcessPickBackUpFile BCO = new CGDModel.ProcessPickBackUpFile(ConntionDB);

        ParameterList.Clear();

        ParameterList.Add(st_accept_date);
        ParameterList.Add(pick_date);
        ParameterList.Add(pick_batch);
        ParameterList.Add(v_type);

        DataTable Dt = BCO.CountPickInfo(ParameterList);
        string count = "";
        if (Dt != null && Dt.Rows.Count > 0)
        {
            count = Convert.ToString(Dt.Rows[0]["count"]);
        }

        
        return v_type + "|" + count ;
        

    }
Esempio n. 2
0
    /// <summary>
    /// 商品儲位檔下載
    /// </summary>
    protected void btnDownLoad3_Click(object sender, EventArgs e)
    {
        if (VerifyFormData() == true)
        {
            try
            {
                CGDModel.ProcessPickBackUpFile BCO = new CGDModel.ProcessPickBackUpFile(ConntionDB);

                DataTable Dt;
                ParameterList.Clear();

                ParameterList.Add(SLP_SLPDate1.Text.Trim());
                ParameterList.Add(txtPickBatch.Text.Trim());

                Dt = BCO.QuerySwitch(CGDModel.CGDCommon.QueryType.QueryPickLocate, ParameterList);

                if (Dt.Rows.Count == 0)
                {
                    ErrorMsgLabel.Text = "查無資料";
                    //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD221.aspx", "alert(' 查無資料 ');", true);
                    return;
                }

                //show出筆數
                this.txtCount3.Text = Convert.ToString(Dt.Rows.Count);

                //寫檔
                //string VDSCGD221TXTFILE = "";

                //for (int i = 0; i <= Dt.Rows.Count - 1; i++)
                //{
                //    VDSCGD221TXTFILE = Dt.Rows[i][0].ToString().Trim();

                //    WriteTXT(VDSCGD221TXTFILE, txtFilePath3.Text.Trim());
                //}

                //---輸出至文字檔
                System.Text.StringBuilder sb_Out_String = new System.Text.StringBuilder();
                Response.Clear();
                Response.Buffer = true;
                Response.Charset = "BIG5";
                Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(txtFilePath3.Text.Trim()));
                Response.ContentEncoding = System.Text.Encoding.GetEncoding("BIG5");
                Response.ContentType = "application/ms-txt";
                this.EnableViewState = false;

                System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
                System.Web.UI.HtmlTextWriter oHtmlTextWriter = new HtmlTextWriter(oStringWriter);


                foreach (DataRow dRow in Dt.Rows)
                {
                    sb_Out_String.Remove(0, sb_Out_String.Length);

                    sb_Out_String.Append(dRow["DATA"].ToString());

                    Response.Write(sb_Out_String.ToString());

                    Response.Write(oHtmlTextWriter.NewLine);
                }

                Response.End();

                ErrorMsgLabel.Text = "儲存完畢";
                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD221.aspx", "alert(' 儲存完畢 ');", true);
            }

            catch (System.UnauthorizedAccessException a)
            {
                ErrorMsgLabel.Text = "儲存失敗,對該路徑無寫入權限";
                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD221.aspx", "alert(' 儲存失敗,對該路徑無寫入權限 ');", true);
            }
            catch (System.IO.DirectoryNotFoundException b)
            {
                ErrorMsgLabel.Text = "儲存失敗,請確認儲存路徑正確";
                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGD221.aspx", "alert(' 儲存失敗,請確認儲存路徑正確 ');", true);
            }
            catch (Exception ex)
            {
                ErrorMsgLabel.Text = ex.Message;
            }
        }

    }