protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime startDate = Cast.DateTime(this.txtDateFrom.Text, new DateTime(1900, 1, 1));
            DateTime endDate   = Cast.DateTime(this.txtDateTo.Text, new DateTime(1900, 1, 1));

            int     count = 0;
            DataSet ds    = null;
            ds = Report.SaleBySetCodeStat(session, startDate, endDate, "%" + this.txtItemCode.Text.Trim() + "%", -1, 0, false, ref count);
            string fileName = DownloadUtil.DownloadXls("Sale_BySet_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_BYSET_",
                                                       new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.Text, "名称", "ItemName"),
                new DownloadFormat(DataType.Number, "销售量", "SaleQty"),
                new DownloadFormat(DataType.Number, "销售金额", "SaleAmt"),
                new DownloadFormat(DataType.Number, "整套退(套)", "RtnQty"),
                new DownloadFormat(DataType.Number, "部分退(套)", "PartRtnQty"),
                new DownloadFormat(DataType.Number, "退货率(%)", "RtnRate"),
                new DownloadFormat(DataType.Number, "换货量(套)", "ExcgQty"),
                new DownloadFormat(DataType.Number, "换货率(%)", "ExcgRate")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
    }
        private IEnumerator DownloadFile()
        {
            if (EBundleLoadState.EState_Error != state)
            {
                using (WWW www = new WWW(SourcePath))
                {
                    yield return(www);

                    if (null != www.error)
                    {
                        Logger.LogError("download file failed!!! source file = " + SourcePath);
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(TargetPath))
                        {
                            DownloadUtil.WriteFile(www, TargetPath);
                        }
                        else
                        {
                            if (null == www.assetBundle)
                            {
                                text = www.text;
                            }

                            bytes  = www.bytes;
                            bundle = www.assetBundle;
                        }
                    }
                }
                this.OnComplete();
            }
        }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime startDate = Cast.DateTime(this.txtDateFrom.Text, new DateTime(1900, 1, 1));
            DateTime endDate   = Cast.DateTime(this.txtDateTo.Text, new DateTime(1900, 1, 1));

            int     count    = 0;
            DataSet ds       = Report.SaleByDateStat(session, startDate, endDate, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("Sale_ByDate_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_BYDATE_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.Text, "日期", "OrdDate"),
                new DownloadFormat(DataType.Number, "订单数", "OrdCount"),
                new DownloadFormat(DataType.Number, "金额(元)", "OrdAmt"),
                new DownloadFormat(DataType.Number, "销售件数合计", "LineCount")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
    }
示例#4
0
    private IEnumerator DownloadAsset(List <ConfResourceItem> updatelist, byte[] serverBytes)
    {
        int  totalCount = 0;
        bool isError    = false;

        for (int index = 0; index < updatelist.Count; ++index)
        {
            var item = updatelist[index];
            AssetBundleManager.Instance.DownloadAssetAsync(GameConstant.RemoteResourcePath + item.file, GameConstant.PersistentDataPath + item.file, (abInfo) =>
            {
                ++totalCount;
                if (Utils.FileToMd5(GameConstant.PersistentDataPath + item.file) != item.md5)
                {
                    isError = true;
                    Logger.LogError("download file " + item.file + " md5 is not matched");
                }
            });
        }

        while (totalCount < updatelist.Count)
        {
            yield return(null);
        }

        if (isError)
        {
            Logger.LogError("some file download failed. please restart application to redownload");
        }
        else
        {
            DownloadUtil.WriteFileToPersistent(serverBytes, GameResourceDefine.ASSET_UPDATE_FILE);
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            int     count    = 0;
            DataSet ds       = this.Query(session, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("PO_Receive_Sum_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_PO_RCV_SUM_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.NumberText, "SKU", "BarCode"),
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.Text, "名称", "ItemName"),
                new DownloadFormat(DataType.Text, "颜色", "ColorCode", "ColorText"),
                new DownloadFormat(DataType.NumberText, "尺码", "SizeCode"),
                new DownloadFormat(DataType.Number, "总收货数量", "TransQty"),
                new DownloadFormat(DataType.Number, "含税总金额", "TaxInAmt"),
                new DownloadFormat(DataType.Number, "税额", "TaxAmt"),
                new DownloadFormat(DataType.Number, "成本金额", "TaxExAmt")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
    }
示例#6
0
    private IEnumerator CheckApkUpdate()
    {
        bool needUpdate = !string.IsNullOrEmpty(currentPlatform.ApkDownloadUrl);

        if (needUpdate)
        {
            string apkPath = string.Format("{0}main_fuck_{1}_{2}.apk", GameConstant.PersistentDataPath, DeviceInfo.GameVersion, SDKManager.Instance.Platform);
            if (File.Exists(apkPath))
            {
                DownloadUtil.InstallAPK(apkPath);
            }
            else
            {
                if (!string.IsNullOrEmpty(currentPlatform.WebDownloadUrl))
                {
                    Application.OpenURL(currentPlatform.WebDownloadUrl);
                }
                else
                {
                    yield return(StartCoroutine(DownLoadApk(currentPlatform.ApkDownloadUrl, apkPath)));
                }
            }
        }
        else
        {
            yield return(StartCoroutine(CheckAsset()));
        }
    }
示例#7
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            int     count    = 0;
            DataSet ds       = Report.StockWarning(session, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("Stock_Warn_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_STO_WARN_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.NumberText, "SKU", "SKU"),
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.Text, "名称", "ItemName"),
                new DownloadFormat(DataType.NumberText, "颜色", "ColorCode", "ColorText"),
                new DownloadFormat(DataType.Text, "尺码", "SizeCode"),
                new DownloadFormat(DataType.Number, "Max.", "MaxQty"),
                new DownloadFormat(DataType.Number, "库存量", "StoQty"),
                new DownloadFormat(DataType.Number, "Safe.", "SafeQty"),
                new DownloadFormat(DataType.Number, "Min.", "MinQty")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
    }
示例#8
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            int     count    = 0;
            DataSet ds       = this.QueryData(session, 65530, 1, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("PO_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_PO_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.Text, "采购订单", "OrderNumber"),
                new DownloadFormat(DataType.NumberText, "行号", "LineNumber"),
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.NumberText, "颜色", "ColorCode"),
                new DownloadFormat(DataType.Text, "尺码", "SizeCode"),
                new DownloadFormat(DataType.Text, "商品名称", "ItemName"),
                new DownloadFormat(DataType.Number, "采购数量", "PurchaseQty"),
                new DownloadFormat(DataType.Number, "单价", "Price"),
                new DownloadFormat(DataType.Number, "金额", "TaxInclusiveAmt"),
                new DownloadFormat(DataType.Date, "收货时间", "ActualDate"),
                new DownloadFormat(DataType.Number, "收货数量", "IQCQty"),
                new DownloadFormat(DataType.Number, "收货金额", "IQCAMT"),
                new DownloadFormat(DataType.Number, "差异数量", "DiffQty")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtStartDate", "txtEndDate");
    }
示例#9
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime defaultDate = new DateTime(1900, 1, 1);
            DateTime startDate   = Cast.DateTime(this.txtDateFrom.Text, defaultDate);
            DateTime endDate     = Cast.DateTime(this.txtDateTo.Text, defaultDate);

            int     count    = 0;
            DataSet ds       = Report.GiftSale(session, startDate, endDate, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("Gift_Sale_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_GIFT_SALE_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.NumberText, "SKU", "BarCode"),
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.Text, "名称", "ItemName"),
                new DownloadFormat(DataType.NumberText, "颜色", "ColorCode", "ColorText"),
                new DownloadFormat(DataType.Text, "尺码", "SizeCode"),
                new DownloadFormat(DataType.Number, "数量", "Qty"),
                new DownloadFormat(DataType.Number, "平均成本", "AvgPrice"),
                new DownloadFormat(DataType.Number, "成本金额", "CostAmt")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
    }
示例#10
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime startDate = Cast.DateTime(this.txtDateFrom.Text, new DateTime(1900, 1, 1));
            DateTime endDate   = Cast.DateTime(this.txtDateTo.Text, new DateTime(1900, 1, 1));

            int     count    = 0;
            DataSet ds       = Report.SaleBySKUStat(session, startDate, endDate, this.txtItemCode.Text, Cast.Enum <Report_SaleByCode_OrderBy>(this.drpSort.SelectedValue), this.chkIncludeNoSale.Checked, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("Sale_BySKU_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_BYSKU_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.Text, "名称", "ItemName"),
                new DownloadFormat(DataType.Text, "颜色", "ColorCode", "ColorText"),
                new DownloadFormat(DataType.Text, "尺码", "SizeCode"),
                new DownloadFormat(DataType.Number, "销售量", "SaleQty"),
                new DownloadFormat(DataType.Number, "销售金额", "SaleAmt"),
                new DownloadFormat(DataType.Number, "总采购", "PurQty"),
                new DownloadFormat(DataType.Number, "销售率(%)", "SaleRate"),
                new DownloadFormat(DataType.Number, "换货量", "ExcgQty"),
                new DownloadFormat(DataType.Number, "换货率(%)", "ExcgRate"),
                new DownloadFormat(DataType.Number, "退货量", "RtnQty"),
                new DownloadFormat(DataType.Number, "退货率(%)", "RtnRate"),
                new DownloadFormat(DataType.Number, "现有库存", "StoQty")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
    }
        public async Task DownLoad2()
        {
            string path   = @"D:\Files\BI_V2.0.zip";
            int    length = path.LastIndexOf(".") - path.LastIndexOf("/") - 1;

            _contextAccessor.HttpContext.Response.Headers["Etag"]          = "ffffff";
            _contextAccessor.HttpContext.Request.Headers["Last-Modified"]  = new DateTime(2018).ToString("r");
            _contextAccessor.HttpContext.Response.Headers["Accept-Ranges"] = "bytes";
            _contextAccessor.HttpContext.Response.ContentType = MimeMappingUtil.GetMimeMapping(path);
            // 分段读取内容

            DownloadUtil download = new DownloadUtil(_contextAccessor.HttpContext);
            await download.WriteFile(path);



            //return await Task.Run(() =>
            //{
            //    string path = @"D:\Files\BI_V2.0.zip";

            //    int length = path.LastIndexOf(".") - path.LastIndexOf("/") - 1;
            //    _contextAccessor.HttpContext.Response.Headers["Etag"] = "ffffff";
            //    _contextAccessor.HttpContext.Request.Headers["Last-Modified"] = new DateTime(2018).ToString("r");
            //    _contextAccessor.HttpContext.Response.Headers["Accept-Ranges"] = "bytes";
            //    _contextAccessor.HttpContext.Response.ContentType = MimeMappingUtil.GetMimeMapping(path);
            //    DownloadRange download = new DownloadRange(_contextAccessor.HttpContext);
            //    download.WriteFile(path);
            //    return new EmptyResult();
            //});
        }
示例#12
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime startDate = Cast.DateTime(this.txtDateFrom.Text, new DateTime(1900, 1, 1));

            int     count    = 0;
            DataSet ds       = Report.SaleByItemCode(session, startDate, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("Sale_ByItem_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_BYITM_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.Text, "名称", "ItemName"),
                new DownloadFormat(DataType.Number, "销售数量", "SaleQty"),
                new DownloadFormat(DataType.Number, "销售金额", "SaleAmt"),
                new DownloadFormat(DataType.Number, "退回数量", "RtnQty"),
                new DownloadFormat(DataType.Number, "退回金额", "RtnAmt")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", null);
    }
示例#13
0
        public void Remove()
        {
            if (downloadFile != null && state == StateType.Queue)
            {
                downloadFile.AsyncRemove();
            }

            if (!isRemove)
            {
                DownloadManager.Install.OnRemove(this);
                isRemove = true;
            }
            else
            {
                if (DownloadManager.Install.GetQueueNum(localPath) <= 0)
                {
                    for (int i = 0; i < DownloadFile.ProcessorCount; i++)
                    {
                        string tmp = DownloadUtil.GetTmpPath(localPath, i);
                        if (File.Exists(tmp))
                        {
                            File.Delete(tmp);
                        }
                    }
                }
                DownloadManager.Install.OnDelete(this);
            }

            state = StateType.None;
        }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            int     count    = 0;
            DataSet ds       = Report.StockSaleDiff(session, Cast.Int(this.drpSort.SelectedValue), this.chkOnlyStoLack.Checked, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("Stock_Sale_Diff_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_STO_SALE_DIFF_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.NumberText, "SKU", "SKU"),
                new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                new DownloadFormat(DataType.Text, "名称", "ItemName"),
                new DownloadFormat(DataType.NumberText, "颜色", "ColorCode", "ColorText"),
                new DownloadFormat(DataType.NumberText, "尺码", "SizeCode"),
                new DownloadFormat(DataType.Number, "当前定购数量", "OrdQty"),
                new DownloadFormat(DataType.Number, "暂存架待发数量", "TempQty"),
                new DownloadFormat(DataType.Number, "库存数量", "StoQty"),
                new DownloadFormat(DataType.Number, "缺货数量", "LackQty")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
    }
示例#15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string snNumber = WebUtil.Param("ordNum");

        if (string.IsNullOrEmpty(snNumber))
        {
            return;
        }

        ExcelTemplate template             = null;
        IDictionary <string, string> items = new Dictionary <string, string>();

        #region 获取数据
        //所有要替换的标签先初始化为空值
        items["$RecipientName$"]    = "";
        items["$RecipientCity$"]    = "";
        items["$RecipientArea$"]    = "";
        items["$RecipientAddress$"] = "";
        items["$RecipientPhone$"]   = "";
        items["$RecipientMobile$"]  = "";
        items["$RecipientZipCode$"] = "";
        items["$AgencyAmt$"]        = "";
        items["$PaidAmt$"]          = "";
        items["$Remark$"]           = "";
        items["$Weight$"]           = "";
        items["$PackageCount$"]     = "";
        using (ISession session = new Session())
        {
            CRMSN sn = CRMSN.Retrieve(session, snNumber);
            if (sn == null)
            {
                return;
            }
            Member mbr = Member.Retrieve(session, sn.MemberID);
            template = ExcelTemplate.Retrieve(session, WebUtil.ParamInt("tid", 0));
            if (template == null)
            {
                return;
            }

            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("(<br.*?>)|(</br>)", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
            items["$RecipientName$"]    = sn.Contact;
            items["$RecipientCity$"]    = sn.City;
            items["$RecipientArea$"]    = Cast.String(sn.Province) + " " + Cast.String(sn.City); //省市区,缺少区
            items["$RecipientAddress$"] = sn.Address;
            items["$RecipientCompany$"] = "";
            items["$RecipientPhone$"]   = "'" + sn.Phone;
            items["$RecipientMobile$"]  = "'" + (string.IsNullOrEmpty(sn.Mobile) || sn.Mobile.Trim().Length <= 0 ? mbr.Mobile : sn.Mobile);
            items["$RecipientZipCode$"] = "'" + sn.PostCode;
            items["$AgencyAmt$"]        = RenderUtil.FormatNumber(sn.AgentAmt, "#0.##", "");
            items["$PaidAmt$"]          = "'" + RenderUtil.FormatNumber(sn.PaidAmt, "#0.##", "");
            items["$Remark$"]           = "'" + regex.Replace(Cast.String(sn.Remark), "\r\n");
            items["$Weight$"]           = sn.PackageWeight <= 0 ? "" : ("'" + sn.PackageWeight.ToString("#0.##"));
            items["$PackageCount$"]     = "'" + RenderUtil.FormatNumber(sn.PackageCount, "#0.##", "");
        }
        #endregion

        this.Response.Redirect(DownloadUtil.DownloadXls("SN_" + snNumber + ".xls", "SN", Server.MapPath(template.FileVirtualPath), items));
    }
示例#16
0
        private void btnDownload1_Click(object sender, EventArgs e)
        {
            try
            {
                DataGridViewSelectedRowCollection selectedRows = this.gvData.SelectedRows;
                if (selectedRows.Count == 0)
                {
                    MessageBox.Show("请选择!");
                    return;
                }
                else if (selectedRows.Count > 1)
                {
                    MessageBox.Show("只能选择一行!");
                    return;
                }
                String type = Util.Util.ConvertObjToString(selectedRows[0].Cells[objTypeStr].Value);
                if (type.Equals(this.directoryType))
                {
                    MessageBox.Show("选择的是文件夹!");
                    return;
                }
                String         bosUri             = Util.Util.ConvertObjToString(selectedRows[0].Cells[this.keyStr].Value);
                String         fileName           = Util.Util.ConvertObjToString(selectedRows[0].Cells[this.objNameStr].Value);
                long           size               = long.Parse(selectedRows[0].Cells["s2"].Value.ToString());
                String         selectedBucketName = lbSelectedBucket.Text.Replace("选中的Bucket:", "");
                BosUtil        bosUtil            = new BosUtil();
                String         uriPath            = bosUtil.getFileUrl(selectedBucketName, bosUri);
                DownloadUtil   downloadUtil       = new DownloadUtil();
                SaveFileDialog sfd = new SaveFileDialog();
                sfd.FileName = fileName;
                DialogResult result = sfd.ShowDialog();
                String       path   = sfd.FileName;

                if (result.Equals(DialogResult.OK))
                {
                    DateTime startTime = DateTime.Now;
                    String   start     = startTime.ToString();
                    this.toolStripStatusLabel2.Text = "开始时间:" + start + "|";
                    bosUtil.Download1(selectedBucketName, bosUri, fileName, path);
                    DateTime endTime = DateTime.Now;
                    String   end     = endTime.ToString();
                    this.toolStripStatusLabel3.Text = "结束时间:" + end + "|";
                    TimeSpan tsStart        = new TimeSpan(startTime.Ticks);
                    TimeSpan tsEnd          = new TimeSpan(endTime.Ticks);
                    TimeSpan ts             = tsEnd.Subtract(tsStart).Duration();
                    int      dateDiffSecond = ts.Days * 24 * 60 * 60 + ts.Hours * 60 * 60 + ts.Minutes * 60 + ts.Seconds;
                    this.toolStripStatusLabel4.Text = "耗时:" + dateDiffSecond.ToString() + "|";
                    //两个时间的秒差
                    long speed = size / 1024 / dateDiffSecond;
                    this.toolStripStatusLabel5.Text = "速度:" + speed.ToString() + "M/s";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 public async Task GetDownloadBigFiles(string path, HttpContext httpContext)
 {
     httpContext.Response.Headers["Etag"]          = "ffffff";
     httpContext.Request.Headers["Last-Modified"]  = new DateTime(2018).ToString("r");
     httpContext.Response.Headers["Accept-Ranges"] = "bytes";
     httpContext.Response.ContentType = MimeMappingUtil.GetMimeMapping(path);
     // 分段读取内容
     DownloadUtil download = new DownloadUtil(httpContext);
     await download.WriteFile(path);
 }
示例#18
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            try
            {
                DateTime fromDate = Cast.DateTime(this.txtDateFrom.Text.Trim(), new DateTime(1900, 1, 1));
                DateTime toDate   = Cast.DateTime(this.txtDateTo.Text.Trim(), new DateTime(1900, 1, 1));
                if (fromDate == new DateTime(1900, 1, 1))
                {
                    WebUtil.ShowError(this, "请输入开始时间");
                    return;
                }
                int     logisId = Cast.Int(this.drpLogis.SelectedValue, 0);
                int     count   = 0;
                DataSet ds      = Report.SaleReturn(session, fromDate, toDate, this.drpReturnType.SelectedValue
                                                    , logisId, this.txtRTNumber.Text, this.txtSNNumber.Text, this.txtSONumber.Text
                                                    , -1, 0, false, ref count);

                //下载到Excel
                string fileName = DownloadUtil.DownloadXls("Sale_Return_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_RTN_SUM",
                                                           new List <DownloadFormat>()
                {
                    new DownloadFormat(DataType.Text, "退货日期", "inner_date"),
                    new DownloadFormat(DataType.Text, "退货单号", "RTNumber"),
                    new DownloadFormat(DataType.NumberText, "发货单号", "SNNumber"),
                    new DownloadFormat(DataType.Text, "订单号", "SONumber"),
                    new DownloadFormat(DataType.Text, "运单号", "ShippingNumber"),
                    new DownloadFormat(DataType.Text, "退货类型", "OrderType"),
                    new DownloadFormat(DataType.Text, "物流公司", "LogisName"),
                    new DownloadFormat(DataType.Number, "销售收入", "SaleAmt"),
                    new DownloadFormat(DataType.Number, "发送费", "TransportAmt"),
                    new DownloadFormat(DataType.Number, "包装费", "PackageAmt"),
                    new DownloadFormat(DataType.Number, "礼券抵扣", "CouponsAmt"),
                    new DownloadFormat(DataType.Number, "销售折扣", "DiscountAmt"),
                    new DownloadFormat(DataType.Number, "退款合计", "ReturnAmt"),
                    new DownloadFormat(DataType.Number, "退回礼金", "EMoneyAmt"),
                    new DownloadFormat(DataType.Number, "退回帐户", "AccountReceivable"),
                    new DownloadFormat(DataType.Number, "POS机收款", "Posreceivable"),
                    new DownloadFormat(DataType.Number, "物流应收款", "LogisReceivable")
                }, ds);
                this.frameDownload.Attributes["src"] = fileName;
                WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
            }
            catch (Exception er)
            {
                WebUtil.ShowError(this, er);
            }
        }
    }
示例#19
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime defaultDate = new DateTime(1900, 1, 1);
            int      periodId    = Cast.Int(this.drpPeriod.SelectedValue, 0);
            if (periodId <= 0)
            {
                return;
            }

            int     count    = 0;
            DataSet ds       = Report.StockBalanceDetail(session, periodId, Cast.Int(this.drpItemCat.SelectedValue), this.txtItemCode.Text, this.txtItemName.Text, this.txtColor.Text, this.txtSize.Text, -1, 0, false, ref count);
            string  fileName = DownloadUtil.DownloadXls("Inv_Balance_Detail_" + DateTime.Now.ToString("yyMMdd") + ".xls"
                                                        , "RPT_INV_DTL", Server.MapPath("/Template/RPT_Stock_Balance_Detail_Download.xls"), null, 3
                                                        , new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.Text, "", "CatName"),
                new DownloadFormat(DataType.Text, "", "ItemCode"),
                new DownloadFormat(DataType.Text, "", "ItemName"),
                new DownloadFormat(DataType.Text, "", "ColorCode", "ColorText"),
                new DownloadFormat(DataType.Text, "", "SizeCode"),
                new DownloadFormat(DataType.Number, "", "BeginQty"),
                new DownloadFormat(DataType.Number, "", "BeginAmt"),
                new DownloadFormat(DataType.Number, "", "PurQty"),
                new DownloadFormat(DataType.Number, "", "PurAmt"),
                new DownloadFormat(DataType.Number, "", "PurReturnQty"),
                new DownloadFormat(DataType.Number, "", "PurReturnAmt"),
                new DownloadFormat(DataType.Number, "", "SaleQty"),
                new DownloadFormat(DataType.Number, "", "SaleAmt"),
                new DownloadFormat(DataType.Number, "", "SaleReturnQty"),
                new DownloadFormat(DataType.Number, "", "SaleReturnAmt"),
                new DownloadFormat(DataType.Number, "", "UsedQty"),
                new DownloadFormat(DataType.Number, "", "UsedAmt"),
                new DownloadFormat(DataType.Number, "", "OtherInQty"),
                new DownloadFormat(DataType.Number, "", "OtherInAmt"),
                new DownloadFormat(DataType.Number, "", "CheckQty"),
                new DownloadFormat(DataType.Number, "", "CheckAmt"),
                new DownloadFormat(DataType.Number, "", "AdjustQty"),
                new DownloadFormat(DataType.Number, "", "AdjustAmt"),
                new DownloadFormat(DataType.Number, "", "ScrapQty"),
                new DownloadFormat(DataType.Number, "", "ScrapAmt"),
                new DownloadFormat(DataType.Number, "", "DiffAmt"),
                new DownloadFormat(DataType.Number, "", "EndQty"),
                new DownloadFormat(DataType.Number, "", "EndAmt")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
    }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime defaultDate = new DateTime(1900, 1, 1);
            DateTime startDate   = Cast.DateTime(this.txtDateFrom.Text, defaultDate);
            DateTime endDate     = Cast.DateTime(this.txtDateTo.Text, defaultDate);
            //如果选择了库存期间,使用库存期间的起始日期
            int periodId = Cast.Int(this.drpPeriod.SelectedValue, 0);
            if (periodId > 0)
            {
                INVPeriod period = INVPeriod.Retrieve(session, periodId);
                if (period != null)
                {
                    startDate = period.StartingDate;
                    endDate   = period.EndDate;
                }
            }
            if (startDate <= defaultDate || endDate <= defaultDate)
            {
                WebUtil.ShowError(this, "请选择时间范围或库存期间");
                return;
            }

            int     count = 0;
            DataSet ds    = Report.MbrAccountDetail(session, startDate, endDate
                                                    , Cast.Int(this.drpFlush.SelectedValue), Cast.Int(this.drpPayment.SelectedValue)
                                                    , this.txtOrder.Text, this.txtMbrID.Text, this.txtMbrName.Text, this.txtUser.Text
                                                    , -1, 0, false, ref count);
            string fileName = DownloadUtil.DownloadXls("Member_Account_Detail_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_MBR_ACC_",
                                                       new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.Date, "日期", "FlushDate"),
                new DownloadFormat(DataType.Text, "变动原因", "FlushType"),
                new DownloadFormat(DataType.Text, "支付方式", "PaymentType"),
                new DownloadFormat(DataType.NumberText, "会员号", "MbrNum"),
                new DownloadFormat(DataType.Text, "姓名", "MbrName"),
                new DownloadFormat(DataType.NumberText, "凭证号", "OrderNumber"),
                new DownloadFormat(DataType.Number, "变动金额", "FlushAmt"),
                new DownloadFormat(DataType.Text, "操作人", "UserName"),
                new DownloadFormat(DataType.Text, "操作备注", "comments")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
            WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
        }
    }
示例#21
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime defaultDate = new DateTime(1900, 1, 1);
            DateTime startDate   = Cast.DateTime(this.txtDateFrom.Text, defaultDate);
            DateTime endDate     = Cast.DateTime(this.txtDateTo.Text, defaultDate);
            //如果选择了库存期间,使用库存期间的起始日期
            int periodId = Cast.Int(this.drpPeriod.SelectedValue, 0);
            if (periodId > 0)
            {
                INVPeriod period = INVPeriod.Retrieve(session, periodId);
                if (period != null)
                {
                    startDate = period.StartingDate;
                    endDate   = period.EndDate;
                }
            }
            if (startDate <= defaultDate || endDate <= defaultDate)
            {
                WebUtil.ShowError(this, "请选择时间范围或库存期间");
                return;
            }

            DataSet ds       = Report.SaleAmtSum(session, startDate, endDate);
            string  fileName = DownloadUtil.DownloadXls("Sale_Sum_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_SALE_AMT_SUM_",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.Text, "物流公司", "LogisName"),
                new DownloadFormat(DataType.Number, "销售收入", "SaleAmt"),
                new DownloadFormat(DataType.Number, "发送费", "TransportAmt"),
                new DownloadFormat(DataType.Number, "包装费", "PackageAmt"),
                new DownloadFormat(DataType.Number, "礼券抵扣", "CouponsAmt"),
                new DownloadFormat(DataType.Number, "销售折扣", "DiscountAmt"),
                new DownloadFormat(DataType.Number, "订单金额合计", "OrderAmt"),
                new DownloadFormat(DataType.Number, "礼金支付", "EMoneyAmt"),
                new DownloadFormat(DataType.Number, "帐户支付", "AccountReceivable"),
                new DownloadFormat(DataType.Number, "POS机收款", "PosReceivable"),
                new DownloadFormat(DataType.Number, "物流应收款", "LogisReceivable")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
        WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
    }
示例#22
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            try
            {
                //获取数据
                DateTime fromDate = Cast.DateTime(this.txtDateFrom.Text.Trim(), new DateTime(1900, 1, 1));
                DateTime toDate   = Cast.DateTime(this.txtDateTo.Text.Trim(), new DateTime(1900, 1, 1));
                if (fromDate == new DateTime(1900, 1, 1))
                {
                    WebUtil.ShowError(this, "请输入开始时间");
                    return;
                }
                DataSet ds = Report.PurchaseReceiveDetail(session, Cast.Int(this.drpVendor.SelectedValue)
                                                          , this.txtRcvNumber.Text, this.txtPONumber.Text, fromDate, toDate);

                //下载到Excel
                string fileName = DownloadUtil.DownloadXls("RCV_Detail_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_RCV_DTL",
                                                           new List <DownloadFormat>()
                {
                    new DownloadFormat(DataType.Text, "收货单", "RCVNumber"),
                    new DownloadFormat(DataType.Text, "采购单", "PONumber"),
                    new DownloadFormat(DataType.NumberText, "行号", "RCVLine"),
                    new DownloadFormat(DataType.NumberText, "PO行号", "POLine"),
                    new DownloadFormat(DataType.NumberText, "SKU", "BarCode"),
                    new DownloadFormat(DataType.NumberText, "货号", "ItemCode"),
                    new DownloadFormat(DataType.Text, "商品名称", "ItemName"),
                    new DownloadFormat(DataType.Text, "颜色", "ColorCode", "ColorText"),
                    new DownloadFormat(DataType.Text, "尺码", "SizeCode"),
                    new DownloadFormat(DataType.Number, "收货数量", "RCVQty"),
                    new DownloadFormat(DataType.Number, "单价", "Price"),
                    new DownloadFormat(DataType.Number, "金额", "RCVAmt")
                }, ds);
                this.frameDownload.Attributes["src"] = fileName;
                WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
            }
            catch (Exception er)
            {
                WebUtil.ShowError(this, er);
            }
        }
    }
示例#23
0
    private IEnumerator DownLoadApk(string sourcePath, string destPath)
    {
        using (WWW www = new WWW(sourcePath))
        {
            yield return(www);

            if (null != www.error)
            {
                Logger.LogError("down load apk failed source path = " + sourcePath);
                yield break;
            }

            DownloadUtil.WriteFile(www.bytes, destPath);
        }

        DownloadUtil.InstallAPK(destPath);
    }
示例#24
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime defaultDate = new DateTime(1900, 1, 1);
            DateTime startDate   = Cast.DateTime(this.txtDateFrom.Text, defaultDate);
            DateTime endDate     = Cast.DateTime(this.txtDateTo.Text, defaultDate);
            //如果选择了库存期间,使用库存期间的起始日期
            int periodId = Cast.Int(this.drpPeriod.SelectedValue, 0);
            if (periodId > 0)
            {
                INVPeriod period = INVPeriod.Retrieve(session, periodId);
                if (period != null)
                {
                    startDate = period.StartingDate;
                    endDate   = period.EndDate;
                }
            }
            if (startDate <= defaultDate || endDate <= defaultDate)
            {
                WebUtil.ShowError(this, "请选择时间范围或库存期间");
                return;
            }

            DataSet ds       = Report.LogisticDeliverySum(session, startDate, endDate);
            string  fileName = DownloadUtil.DownloadXls("Logis_Deliver_Sum_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_IC_Sum",
                                                        new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.Text, "物流公司", "LogisName"),
                new DownloadFormat(DataType.Number, "发单数量", "OrderCount"),
                new DownloadFormat(DataType.Number, "包裹数量", "PackageCount"),
                new DownloadFormat(DataType.Number, "代收款金额", "AgentAmt"),
                new DownloadFormat(DataType.Number, "物流退货订单数量", "RtnOrdCount"),
                new DownloadFormat(DataType.Number, "退货订单代收款金额", "RtnAgentAmt"),
                new DownloadFormat(DataType.Number, "代收款差额", "DiffAmt")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
            WebUtil.DownloadHack(this, "txtDateFrom", "txtDateTo");
        }
    }
示例#25
0
 public void OnClickOpen()
 {
     if (fileInfo != null)
     {
         if (File.Exists(fileInfo.localPath))
         {
             RevealInFinder(fileInfo.localPath);
         }
         else if (File.Exists(DownloadUtil.GetTmpPath(fileInfo.localPath, 0)))
         {
             RevealInFinder(DownloadUtil.GetTmpPath(fileInfo.localPath, 0));
         }
         else
         {
             RevealInFinder(Path.GetDirectoryName(fileInfo.localPath));
         }
     }
 }
示例#26
0
    public void Start(string httpRoot, string versionPath, string outDir)
    {
        string  json = File.ReadAllText(versionPath);
        JObject jo   = (JObject)JsonConvert.DeserializeObject(json);
        IEnumerable <JProperty> properties = jo.Properties();

        count = jo.Count;
        foreach (JProperty item in properties)
        {
            string url       = httpRoot + "/" + item.Value.ToString();
            string localPath = outDir + "/" + item.Name.ToString();

            if (Path.GetExtension(localPath) != ".js")
            {
                completeNum++;
                continue;
            }

            DownloadUtil.CheckDir(localPath);
            new HttpDldFile().Download(url, localPath);


            Console.WriteLine(url);

            //DownloadFile downloadFile = new DownloadFile(url, localPath);
            //downloadFile.completeCallback = OnFileComplete;
            //downloadFileList.Add(downloadFile);
            //downloadFile.Load();

            //break;
        }

        Console.WriteLine("完成");
        Console.Read();

        //while (true)
        //{
        //    if (completeNum >= count)
        //        break;
        //    Thread.Sleep(1000);
        //}
    }
示例#27
0
 private void btnDownload_Click(object sender, EventArgs e)
 {
     try
     {
         DataGridViewSelectedRowCollection selectedRows = this.gvData.SelectedRows;
         if (selectedRows.Count == 0)
         {
             MessageBox.Show("请选择!");
             return;
         }
         else if (selectedRows.Count > 1)
         {
             MessageBox.Show("只能选择一行!");
             return;
         }
         String type = Util.Util.ConvertObjToString(selectedRows[0].Cells[objTypeStr].Value);
         if (type.Equals(this.directoryType))
         {
             MessageBox.Show("选择的是文件夹!");
             return;
         }
         String         bosUri             = Util.Util.ConvertObjToString(selectedRows[0].Cells[this.keyStr].Value);
         String         fileName           = Util.Util.ConvertObjToString(selectedRows[0].Cells[this.objNameStr].Value);
         String         selectedBucketName = lbSelectedBucket.Text.Replace("选中的Bucket:", "");
         BosUtil        bosUtil            = new BosUtil();
         String         uriPath            = bosUtil.getFileUrl(selectedBucketName, bosUri);
         DownloadUtil   downloadUtil       = new DownloadUtil();
         SaveFileDialog sfd = new SaveFileDialog();
         sfd.FileName = fileName;
         DialogResult result = sfd.ShowDialog();
         String       path   = sfd.FileName;
         if (result.Equals(DialogResult.OK))
         {
             downloadUtil.DownloadFile(uriPath, path, pbProcess);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
示例#28
0
        private void Init()
        {
            OptionalUpdate = _localRelease.Compare(_remoteRelease.MinVersion) >= 0;
            lblTitle.Text  = string.Format(
                lblTitle.Text,
                _localRelease.ReleaseVersion,
                _remoteRelease.ReleaseVersion,
                _remoteRelease.ReleaseDate);
            try
            {
                if (_updateProxy != null)
                {
                    boxDes.Text = _updateProxy.GetUpdateLogBetweenVersion(_localRelease.ReleaseVersion,
                                                                          _remoteRelease.ReleaseVersion);
                }
                else
                {
                    boxDes.Text = _remoteRelease.UpdateDescription;
                }
            }
            catch
            {
                boxDes.Text = _remoteRelease.UpdateDescription;
            }
            _diff          = _localRelease.GetDifferences(_remoteRelease, out _totalSize);
            _totalSizeDesc = DownloadUtil.FormatFileSizeDescription(_totalSize);
            if (_diff == null || _totalSize == 0)
            {
                btnUpgrade.Text = _finishText;
                return;
            }

            progressBar1.Maximum = 100;
            if (!btnUpgrade.Enabled)
            {
                DoUpgrade();
            }
        }
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            int         periodId = Cast.Int(this.drpPeriod.SelectedValue, 0);
            ObjectQuery query    = session.CreateObjectQuery(@"
select m.MemberNumber as MemberNumber,m.Name as MemberName,ca.BeginAmt as BeginAmt,ca.EndAmt as EndAmt
from MbrCashAccountBalance ca
left join Member m on m.MemberID=ca.MemberID
order by m.MemberNumber")
                                   .Attach(typeof(MbrCashAccountBalance)).Attach(typeof(Member))
                                   .Where(Exp.Eq("ca.PeriodID", periodId));
            if (!string.IsNullOrEmpty(this.txtMbrID.Text) && this.txtMbrID.Text.Trim().Length > 0)
            {
                query.And(Exp.Eq("m.MemberNumber", this.txtMbrID.Text.Trim()));
            }
            if (!string.IsNullOrEmpty(this.txtMbrName.Text) && this.txtMbrName.Text.Trim().Length > 0)
            {
                query.And(Exp.Like("m.Name", "%" + this.txtMbrName.Text.Trim() + "%"));
            }
            DataSet ds = query.DataSet();

            string fileName = DownloadUtil.DownloadXls("Member_Account_Balance_" + DateTime.Now.ToString("yyMMdd") + ".xls", "RPT_MBR_ACC_",
                                                       new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.NumberText, "会员号", "MemberNumber"),
                new DownloadFormat(DataType.Text, "会员姓名", "MemberName"),
                new DownloadFormat(DataType.Number, "期初余额", "BeginAmt"),
                new DownloadFormat(DataType.Number, "期末余额", "EndAmt")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
    }
示例#30
0
    protected void MagicItemCommand(object sender, MagicItemEventArgs e)
    {
        if (e.CommandName != "Download")
        {
            return;
        }

        using (ISession session = new Session())
        {
            DateTime from = Cast.DateTime(this.txtDateFrom.Text), to = Cast.DateTime(this.txtDateTo.Text);
            DataSet  ds       = Report.SaleByPaymentMethod(session, from, to);
            string   fileName = DownloadUtil.DownloadXls("Sale_By_Payment_" + DateTime.Now.ToString("yyMMdd") + ".xls", "Sale_By_Payment",
                                                         new List <DownloadFormat>()
            {
                new DownloadFormat(DataType.Text, "支付方式", "PayName"),
                new DownloadFormat(DataType.Number, "订单总数量", "TotalCount"),
                new DownloadFormat(DataType.Text, "所占比例", "CountText"),
                new DownloadFormat(DataType.Number, "订单总金额", "TotalAmt"),
                new DownloadFormat(DataType.Text, "所占比例", "AmtText")
            }, ds);
            this.frameDownload.Attributes["src"] = fileName;
        }
    }