//-----------------Insert /// <summary> /// 如有同名返回-1,否则返回被插入ID; /// </summary> public int Insert(M_IDC_DomPrice model) { if (CheckIsExist(model.DomName) != null) { return(-1); } return(Sql.insert(strTableName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model))); }
//---- private void BindEditData(string id) { viewDiv.Visible = false; addDiv.Visible = true; tab2AddBtn.Text = "修改"; domPriceModel = domPriceBll.SelByID(id); if (domPriceModel != null) { addSpan.Visible = false; domNameL.Visible = true; domNameL.Text = domPriceModel.DomName; tab2DomPrice.Text = domPriceModel.DomPrice.ToString(); detailText.Text = domPriceModel.ProDetail; statusChk.Checked = domPriceModel.Status.ToString().Equals("1") ? true : false; } else { function.WriteErrMsg("域名信息不存在"); } }
//添加与修改 protected void tab2AddBtn_Click(object sender, EventArgs e) { string name = domNameDP.SelectedValue; string price = tab2DomPrice.Text.Trim(); string id = Request.QueryString["ID"]; if (name.IndexOf(".") != 0) { name = "." + name; } if (!IsNumber(price)) { function.WriteErrMsg("价格不正确,必须为数字"); } if (string.IsNullOrEmpty(id))//添加 { domPriceModel.DomName = name; domPriceModel.DomPrice = Convert.ToDecimal(price); domPriceModel.ProDetail = detailText.Text.Trim(); domPriceModel.IFSupplier = 1; domPriceModel.Status = statusChk.Checked ? 1 : 0; domPriceModel.CreateDate = DateTime.Now; if (domPriceBll.Insert(domPriceModel) < 0) { function.WriteErrMsg("有同名商品存在,取消添加!!"); } } else//修改 { domPriceModel = domPriceBll.SelByID(id); domPriceModel.DomPrice = Convert.ToDecimal(price); domPriceModel.ProDetail = detailText.Text.Trim(); domPriceModel.IFSupplier = 1; domPriceModel.Status = statusChk.Checked ? 1 : 0; domPriceBll.UpdateByID(domPriceModel); } Response.Redirect("DomPrice.aspx"); }
//-----------------Update public bool UpdateByID(M_IDC_DomPrice model) { return(Sql.UpdateByIDs(strTableName, PK, model.ID.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters())); }