Esempio n. 1
0
        //选择
        private void btnSelect_Click(object sender, EventArgs e)
        {
            List <SelectClientOrderDetail> alt = new List <SelectClientOrderDetail>();

            if (gridView1.RowCount > 0)
            {
                //客户订单guid
                int    intRow             = gridView1.GetSelectedRows()[0];
                string strClientOrderGuid = gridView1.GetRowCellValue(intRow, gridClientOrderGuid).ToString();

                //客户订单id
                string strClientOrderID = gridView1.GetRowCellValue(intRow, gridClientOrderID).ToString();

                SelectClientOrderDetail SelectClientOrderDetail = new SelectClientOrderDetail();
                //采购订单明细
                for (int i = 0; i < gridView2.RowCount; i++)
                {
                    if (gridView2.GetRowCellValue(i, gridCheckBox).ToString() == "True")
                    {
                        SelectClientOrderDetail = new SelectClientOrderDetail();
                        SelectClientOrderDetail.ClientOrderGuid       = strClientOrderGuid;
                        SelectClientOrderDetail.ClientOrderID         = strClientOrderID;
                        SelectClientOrderDetail.ClientOrderDetailGuid = gridView2.GetRowCellValue(i, gridClientOrderDetailGuid).ToString();
                        //SelectClientOrderDetail.ClientOrderDate = DateTime.Parse(gridView2.GetRowCellValue(i, gridClientOrderDate).ToString());
                        SelectClientOrderDetail.MaterialGuID  = gridView2.GetRowCellValue(i, gridMaterialGuid).ToString();
                        SelectClientOrderDetail.MaterialID    = gridView2.GetRowCellValue(i, gridMaterialID).ToString();
                        SelectClientOrderDetail.MaterialName  = gridView2.GetRowCellValue(i, gridMaterialName).ToString();
                        SelectClientOrderDetail.Unit          = gridView2.GetRowCellValue(i, gridUnit).ToString();
                        SelectClientOrderDetail.Spec          = gridView2.GetRowCellValue(i, gridSpec).ToString();
                        SelectClientOrderDetail.Price         = decimal.Parse(gridView2.GetRowCellValue(i, gridPrice).ToString());
                        SelectClientOrderDetail.MaterialSum   = decimal.Parse(gridView2.GetRowCellValue(i, gridMaterialSum).ToString());
                        SelectClientOrderDetail.OutStorageSum = decimal.Parse(gridView2.GetRowCellValue(i, gridOutStorageSum).ToString());
                        SelectClientOrderDetail.CanOutSum     = decimal.Parse(gridView2.GetRowCellValue(i, gridCanOutSum).ToString());

                        alt.Add(SelectClientOrderDetail);
                    }
                }

                if (alt.Count <= 0)
                {
                    //请选择记录
                    ShowMessage("请选择客户订单数据!");
                    return;
                }

                this.Tag = alt;
                this.Close();
            }
        }
        private void btnAddDetail_Click(object sender, EventArgs e)
        {
            frmSelectClientOrder2 frmSelectClientOrder2 = new frmSelectClientOrder2();

            frmSelectClientOrder2.ShowDialog();

            if (frmSelectClientOrder2.Tag != null)
            {
                //取出选择的料件Guid
                List <SelectClientOrderDetail> lstGuid = frmSelectClientOrder2.Tag as List <SelectClientOrderDetail>;
                SelectClientOrderDetail        SelectClientOrderDetail = new SelectClientOrderDetail();

                //选择的品名填充
                if (lstGuid.Count > 0)
                {
                    //得到料件的信息
                    for (int i = 0; i < lstGuid.Count; i++)
                    {
                        SelectClientOrderDetail = lstGuid[i] as SelectClientOrderDetail;

                        //填充数据
                        gridView1.AddNewRow();
                        gridView1.SetFocusedRowCellValue(gridClientOrderGuid, SelectClientOrderDetail.ClientOrderGuid);
                        gridView1.SetFocusedRowCellValue(gridClientOrderID, SelectClientOrderDetail.ClientOrderID);
                        gridView1.SetFocusedRowCellValue(gridClientOrderDetailGuid, SelectClientOrderDetail.ClientOrderDetailGuid);
                        gridView1.SetFocusedRowCellValue(gridMaterialGuID, SelectClientOrderDetail.MaterialGuID);
                        gridView1.SetFocusedRowCellValue(gridMaterialID, SelectClientOrderDetail.MaterialID);
                        gridView1.SetFocusedRowCellValue(gridMaterialName, SelectClientOrderDetail.MaterialName);
                        gridView1.SetFocusedRowCellValue(gridUnit, SelectClientOrderDetail.Unit);
                        gridView1.SetFocusedRowCellValue(gridSpec, SelectClientOrderDetail.Spec);
                        gridView1.SetFocusedRowCellValue(gridPrice, SelectClientOrderDetail.Price.ToString("g0"));
                        gridView1.SetFocusedRowCellValue(gridMaterialSum, SelectClientOrderDetail.MaterialSum.ToString("g0"));
                    }
                }
            }
        }