Beispiel #1
0
 protected void btnImport_Click(object sender, EventArgs e)
 {
     try
     {
         IList <OrderLocationTransaction> orderLoctransList = TheImportMgr.ReadOrderLocationTransactionFromXls(fileUpload.PostedFile.InputStream, OrderNo);
         TheOrderMgr.AddOrderLocationTransaction(orderLoctransList, this.CurrentUser);
         ShowSuccessMessage("Import.Result.Successfully");
         if (BtnImportEvent != null)
         {
             this.Visible = false;
             BtnImportEvent(sender, e);
         }
     }
     catch (BusinessErrorException ex)
     {
         ShowErrorMessage(ex);
     }
 }
    protected void lbtnAdd_Click(object sender, EventArgs e)
    {
        int                    rowIndex    = ((GridViewRow)(((DataControlFieldCell)(((LinkButton)(sender)).Parent)).Parent)).RowIndex;
        GridViewRow            row         = this.GV_List.Rows[rowIndex];
        RequiredFieldValidator rfvItem     = (RequiredFieldValidator)(row.FindControl("rfvItem"));
        RequiredFieldValidator rfvLocation = (RequiredFieldValidator)(row.FindControl("rfvLocation"));

        if (!rfvItem.IsValid || !rfvLocation.IsValid)
        {
            return;
        }
        if (checkItemExists())
        {
            ShowErrorMessage("MasterData.Order.OrderDetail.Item.Exists");
            return;
        }
        OrderLocationTransaction orderLocTrans = new OrderLocationTransaction();



        orderLocTrans.Operation   = int.Parse(((TextBox)row.FindControl("tbOperation")).Text.Trim());
        orderLocTrans.OrderDetail = TheOrderDetailMgr.LoadOrderDetail(int.Parse(((DropDownList)row.FindControl("tbKitItem")).SelectedValue));

        orderLocTrans.UnitQty = decimal.Parse(((TextBox)row.FindControl("tbUnitQty")).Text.Trim());
        Item item = TheItemMgr.LoadItem(((Controls_TextBox)row.FindControl("tbItem")).Text.Trim());

        if (item != null)
        {
            orderLocTrans.Item = item;
            orderLocTrans.Uom  = item.Uom;
        }
        orderLocTrans.OrderedQty = decimal.Parse(((TextBox)row.FindControl("tbOrderdQty")).Text.Trim());

        if (orderLocTrans.OrderedQty == 0)
        {
            orderLocTrans.OrderedQty = orderLocTrans.UnitQty * orderLocTrans.OrderDetail.OrderedQty;
        }
        if (!this.IsReuse && this.IsScrap)
        {
            orderLocTrans.Location = orderLocTrans.OrderDetail.DefaultLocationFrom;
        }
        else
        {
            Controls_TextBox tbLocation = (Controls_TextBox)row.FindControl("tbLocation");
            if (tbLocation.Text.Trim() != string.Empty)
            {
                orderLocTrans.Location = TheLocationMgr.LoadLocation(tbLocation.Text.Trim());
            }
        }

        orderLocTrans.NeedPrint = ((CheckBox)row.FindControl("cbNeedPrint")).Checked;

        orderLocTrans.IsAssemble      = true;
        orderLocTrans.IOType          = this.IOType;
        orderLocTrans.IsBlank         = false;
        orderLocTrans.TransactionType = BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_WO;

        try
        {
            TheOrderMgr.AddOrderLocationTransaction(orderLocTrans, this.CurrentUser);
            ShowSuccessMessage("MasterData.Order.LocTrans.Add.Successfully");
            UpdateRoutingEvent(this.OrderNo, e);
            UpdateView();
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage(ex);
        }
    }