protected void btn_AddDetail_Click(object sender, EventArgs e) { int RTcount = 0; decimal flbase = 0; if (!decimal.TryParse(tbx_Amount.Text.Trim(), out flbase)) { MessageBox.Show(this, "请正确填写金额数!"); tbx_Amount.Focus(); return; } CM_FLApply_BaseBLL bll; if (gv_List.SelectedIndex >= 0) { bll = new CM_FLApply_BaseBLL(int.Parse(gv_List.DataKeys[gv_List.SelectedIndex][0].ToString())); bll.Model.FLBase = flbase; bll.Model.FLType = int.Parse(ddl_FLTypeDetail.SelectedValue); bll.Model.ISMYD = int.Parse(rbl_IsMYD.SelectedValue); if (rbl_IsMYD.SelectedValue == "1") { bll.Model.RTCount = RTcount; } bll.Update(); btn_AddDetail.Text = "新 增"; } else { if (select_OrgSupplier.SelectValue == "" || select_OrgSupplier.SelectValue == "0") { MessageBox.Show(this, "请选择对应的零售商!"); return; } if (CM_FLApply_BaseBLL.GetModelList("Client=" + select_OrgSupplier.SelectValue + " AND ISNULL(AccountMonth," + ddl_Month.SelectedValue + ")=" + ddl_Month.SelectedValue).Count > 0) { MessageBox.Show(this, "对不起,该门店的已在列表中存在,请重新选择门店!"); return; } bll = new CM_FLApply_BaseBLL(); bll.Model.AccountMonth = int.Parse(ddl_Month.SelectedValue); bll.Model.Client = int.Parse(select_OrgSupplier.SelectValue); bll.Model.FLBase = flbase; bll.Model.FLType = int.Parse(ddl_FLTypeDetail.SelectedValue); bll.Model.ISMYD = int.Parse(rbl_IsMYD.SelectedValue); if (rbl_IsMYD.SelectedValue == "1") { bll.Model.RTCount = RTcount; } bll.Add(); } select_OrgSupplier.SelectText = ""; select_OrgSupplier.SelectValue = ""; tbx_Amount.Text = "0"; select_OrgSupplier.Enabled = true; btn_AddDetail.Text = "新 增"; gv_List.SelectedIndex = -1; BindGrid(); }