public AddUpdateCityExLogisticsAmountFrm(MaintainType type, CityExLogisticsAmountModel model) { InitializeComponent(); this.advModel = model; this.maintainType = type; InitControls(); }
private void btnAd_Click(object sender, EventArgs e) { CityExLogisticsAmountModel newBrandModel = new CityExLogisticsAmountModel(); using (AddUpdateCityExLogisticsAmountFrm newBrand = new AddUpdateCityExLogisticsAmountFrm(MaintainType.New, newBrandModel)) { var dialogResult = newBrand.ShowDialog(); if (dialogResult == DialogResult.OK) { InitControls(); } } }
public bool InsertCityExLogisticsAmount(string cityExLogisticModelStr) { CityExLogisticsAmountModel model = JsonUtil.Deserialize <CityExLogisticsAmountModel>(cityExLogisticModelStr); string sql = $"INSERT INTO CityExLogisticsAmount(CityId,ExId,Amount) VALUES(?cityId,?exId,?amount)"; Dictionary <string, object> p = new Dictionary <string, object>(); p["cityId"] = model.CityId; p["exId"] = model.ExId; p["amount"] = model.Amount; int num = DbUtil.Master.ExecuteNonQuery(sql, p); if (num > 0) { return(true); } else { return(false); } }
public bool UpdateCityExLogisticAmount(int id, string cityExLogisticsAmountModelStr) { CityExLogisticsAmountModel model = JsonUtil.Deserialize <CityExLogisticsAmountModel>(cityExLogisticsAmountModelStr); string sql = $"UPDATE CityExLogisticsAmount set CityId=?cityId,ExId=?exId,Amount=?amount WHERE Id=?id"; Dictionary <string, object> p = new Dictionary <string, object>(); p["cityId"] = model.CityId; p["exId"] = model.ExId; p["Amount"] = model.Amount; p["id"] = id; int num = DbUtil.Master.ExecuteNonQuery(sql, p); if (num > 0) { return(true); } else { return(false); } }