zoukankan      html  css  js  c++  java
  • datagridview添加行

    添加明细按钮

    DataRow dRow = DtDetail.NewRow();

    dRow["PriceId"] = ConvertUtil.GetIntFromObject(dr.Cells["PriceId"].Value);
    dRow["FlowerId"] = ConvertUtil.GetIntFromObject(dr.Cells["FlowerId"].Value);
    dRow["FlowerCode"] = ConvertUtil.GetStringFromObject(dr.Cells["FlowerCode"].Value);
    dRow["TNumber"] = ConvertUtil.GetStringFromObject(dr.Cells["TNumber"].Value);
    dRow["IsValid"] =1;
    dRow["Larghezza"] = ConvertUtil.GetStringFromObject(dr.Cells["Larghezza"].Value);

    DtDetail.Rows.InsertAt(dRow, 0);

    DtDetail增加行

    确定按钮

    if (FormState.Equals(SoyErpConstants.FormEditableMode.New))
    {
    DataRow row = null;
    if (DtDetail.Rows.Count > 0)
    {
    for (int i = 0; i < DtDetail.Rows.Count; i++)
    {
    iSD_FLOWERPRICE_DATA = new SDsvc.SP_ECN_DATA_I.SD_FLOWERPRICE_DATA();
    row = DtDetail.Rows[i];
    iSD_FLOWERPRICE_DATA.DATA_STATE = SoyErpConstants.DataStateAdded;

    if (row["FlowerCode"] != null && ConvertUtil.GetStringFromObject(row["FlowerCode"]) != "")
    {
    iSD_FLOWERPRICE_DATA.FlowerCode = row["FlowerCode"].ToString();
    }
    else
    {
    continue;
    }

    iSD_FLOWERPRICE_DATA.PriceId = ConvertUtil.GetIntFromObject(row["PriceId"]);
    iSD_FLOWERPRICE_DATA.FlowerCode = ConvertUtil.GetStringFromObject(row["FlowerCode"]);
    iSD_FLOWERPRICE_DATA.TNumber = ConvertUtil.GetStringFromObject(row["TNumber"]);
    iSP_ECN_DATA_I.lstSD_FLOWERPRICE_DATA.Add(iSD_FLOWERPRICE_DATA);
    }
    }


    SDsvc.CreateFlowerPriceOrderRequest request = new SDsvc.CreateFlowerPriceOrderRequest(iSP_ECN_DATA_I);
    SDsvc.CreateFlowerPriceOrderResponse response = oSDsvc.CreateFlowerPriceOrder(request);
    string strPriceOrderID = response.CreateFlowerPriceOrderResult.Code;

    if (!string.IsNullOrEmpty(strPriceOrderID))
    {
    txtPriceOrderID.Text = strPriceOrderID;
    lblSysMsg.Message = "保存成功!";
    this.FormState = SoyErpConstants.FormEditableMode.Read;
    loadData();
    }
    else
    {
    lblSysMsg.Message = "保存失败!" + response.CreateFlowerPriceOrderResult.ErrorMessage;
    }
    }
    else if (FormState.Equals(SoyErpConstants.FormEditableMode.Edit))
    {

    iECN_DATA.Code = txtPriceOrderID.Text;

    DataRow row = null;
    for (int i = 0; i < DtDetail.Rows.Count; i++)
    {
    row = DtDetail.Rows[i];
    if (row.RowState == DataRowState.Unchanged)
    {

    continue;
    }
    iSD_FLOWERPRICE_DATA = new SDsvc.SP_ECN_DATA_I.SD_FLOWERPRICE_DATA();
    iSD_FLOWERPRICE_DATA.ECNId = txtPriceOrderID.Text;
    if (row.RowState == DataRowState.Deleted)
    {
    iSD_FLOWERPRICE_DATA.DATA_STATE = SoyErpConstants.DataStateDeleted;
    if (row["PriceId", DataRowVersion.Original] != null && row["PriceId", DataRowVersion.Original].ToString() != "")
    {
    iSD_FLOWERPRICE_DATA.PriceId = ConvertUtil.GetIntFromObject(row["PriceId", DataRowVersion.Original]);
    }
    }
    else
    {
    if (row.RowState == DataRowState.Added)
    {
    iSD_FLOWERPRICE_DATA.DATA_STATE = SoyErpConstants.DataStateAdded;
    }
    if (row.RowState == DataRowState.Modified)
    {
    iSD_FLOWERPRICE_DATA.DATA_STATE = SoyErpConstants.DataStateChanged;
    }
    if (row["FlowerCode"] != null && ConvertUtil.GetStringFromObject(row["FlowerCode"]) != "")
    {
    iSD_FLOWERPRICE_DATA.FlowerCode = row["FlowerCode"].ToString();
    }
    iSD_FLOWERPRICE_DATA.PriceId = ConvertUtil.GetIntFromObject(row["PriceId"]);
    iSD_FLOWERPRICE_DATA.FlowerCode = ConvertUtil.GetStringFromObject(row["FlowerCode"]);
    iSD_FLOWERPRICE_DATA.TNumber = ConvertUtil.GetStringFromObject(row["TNumber"]); }
    if (string.IsNullOrEmpty(iSD_FLOWERPRICE_DATA.FlowerCode))
    {
    break;
    }

    }

    iSP_ECN_DATA_I.lstSD_FLOWERPRICE_DATA.Add(iSD_FLOWERPRICE_DATA);

    SDsvc.UpdateECNRequest request = new SDsvc.UpdateECNRequest(iSP_ECN_DATA_I);
    SDsvc.UpdateECNResponse response=oSDsvc.UpdateECN(request);
    bool flag = response.UpdateECNResult.ExecutedSuccess;
    if (flag)
    {
    lblSysMsg.Message = "修改成功!";
    this.FormState = SoyErpConstants.FormEditableMode.Read;
    loadData();
    }
    else
    {
    lblSysMsg.Message = "修改失败!" + response.UpdateECNResult.ErrorMessage;
    }
    }
    }
    catch (Exception ex)
    {

    MessageBox.Show(ex.Message);

    }

  • 相关阅读:
    dp uva1025
    dp uva10003
    dp最优矩阵相乘poj1651
    dp uva11584
    动态规划uva11400
    流形学习 (Manifold Learning)
    tf.nn.embedding_lookup
    word2vec
    word2vec 细节解析1
    collections-Counter
  • 原文地址:https://www.cnblogs.com/ChineseMoonGod/p/3723285.html
Copyright © 2011-2022 走看看