Example #1
0
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        HSSFWorkbook excel = new HSSFWorkbook(fileUpload.PostedFile.InputStream);
        Sheet        sheet = excel.GetSheetAt(0);
        IEnumerator  rows  = sheet.GetRowEnumerator();

        ImportHelper.JumpRows(rows, 1);
        IList <TransportationActBill> tactbillList = new List <TransportationActBill>();
        IList <string> orderNos = new List <string>();
        string         supply   = string.Empty;

        while (rows.MoveNext())
        {
            Row    curow   = (HSSFRow)rows.Current;
            string orderNo = curow.GetCell(0).StringCellValue;
            // decimal cur = decimal.Parse(curow.GetCell(1).NumericCellValue.ToString());
            if (string.IsNullOrEmpty(orderNo))
            {
                break;
            }
            else
            {
                if (orderNos.Contains(orderNo))
                {
                    continue;//避免重复
                }
                else
                {
                    orderNos.Add(orderNo);
                }
            }
        }
        string successMessage = "计价成功的单号:";
        string errorMessage   = "计价失败的单号:";

        if (orderNos.Count > 0)
        {
            foreach (var orderNo in orderNos)
            {
                try
                {
                    TheTransportationOrderMgr.ValuateTransportationOrder(orderNo, this.CurrentUser);
                    successMessage += orderNo + ",";
                }
                catch (Exception ex)
                {
                    errorMessage += orderNo + ",";
                }
            }

            ShowErrorMessage(successMessage + " </br> " + errorMessage);
        }
        else
        {
            ShowErrorMessage(" 导入的有效数据为0行!");
        }
    }
Example #2
0
    public void ValuateOrder(IList <TransportationOrder> transportationOrderList)
    {
        try
        {
            if (transportationOrderList != null && transportationOrderList.Count > 0)
            {
                TheTransportationOrderMgr.ValuateTransportationOrder(transportationOrderList, this.CurrentUser);

                DoSearch();

                ShowSuccessMessage("Transportation.TransportationOrder.ValuateTransportationOrder.Successfully");
            }
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }
Example #3
0
 protected void btnValuate_Click(object sender, EventArgs e)
 {
     try
     {
         ds = needCaluate();
         if (onlyWSNFlag == false)
         {
             TheTransportationOrderMgr.ValuateTransportationOrder(this.OrderNo, this.CurrentUser);
         }
         else
         {
             createTBill();
         }
         if (ds != null)//djin
         {
             Caluate();
         }
         ShowSuccessMessage("Transportation.TransportationOrder.ValuateTransportationOrder.Successfully", this.OrderNo);
         if (ds != null)
         {
             Restore(ds);
         }
         UpdateView();
         UpdateViewButton();
         TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(OrderNo);
         to.Status     = "Close";
         to.Remark     = ((TextBox)(this.FV_Order.FindControl("tbRemark"))).Text.Trim();
         to.IsValuated = true;
         TheTransportationOrderMgr.UpdateTransportationOrder(to);
     }
     //BusinessErrorException
     catch (BusinessErrorException ex)
     {
         Restore(ds);
         ShowErrorMessage(ex);
     }
 }