/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { string id = Request.QueryString["id"].ToString(); Model.cost_type frmtype = new Model.cost_type(); frmtype.ct_number = txtBH.Value; frmtype.ct_name = txtName.Value; frmtype.ct_iftype = 1; frmtype.ct_money = Convert.ToDecimal(txtPrice.Value); frmtype.ct_categories = Convert.ToInt32(DDlfylb.SelectedValue); if (id == "") { int Result = fmcost.Add(frmtype); if (Result > 0) { //Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", ""); ScriptManager.RegisterStartupScript(this, this.GetType(), "click", "alert('保存成功');parent.Window_Close();", true); } } else { frmtype.id = Convert.ToInt32(id); if (fmcost.Update(frmtype)) { ScriptManager.RegisterStartupScript(this, this.GetType(), "click", "alert('更新成功');parent.Window_Close();", true); } } }
/// <summary> /// 修改类型 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { Model.Goods modl = new Model.Goods(); Model.cost_type models = new Model.cost_type(); string types = (Request.QueryString["type"].ToString()); bool result; if (types == "0") { modl.Goods_name = txt_name.Value; modl.id = Convert.ToInt32(Request.QueryString["id"].ToString()); modl.Goods_number = fmshif.GetModel(Convert.ToInt32(Request.QueryString["id"].ToString())).Goods_number; modl.Goods_ifType = 0; result = fmshif.Update(modl); } else { models.ct_name = txt_name.Value; models.id = Convert.ToInt32(Request.QueryString["id"].ToString()); models.ct_iftype = 0; models.ct_number = fmcost.GetModel(Convert.ToInt32(Request.QueryString["id"].ToString())).ct_number; result = fmcost.Update(models); } if (result) { ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript' defer>alert('修改成功!');parent.Window_Close();</script>"); } else { ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript' defer>alert('修改失败!');</script>"); } }
/// <summary> /// 费用大类录入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { //string id = ""; Model.cost_type frmfysz = new Model.cost_type(); frmfysz.ct_name = txt_name.Value; string MaxNumber = fmcost.GetMaxNumber(" where ct_iftype=0").ToString().Trim(); if (MaxNumber == "1") { frmfysz.ct_number = "0001"; } else { frmfysz.ct_number = "000" + (Convert.ToInt32(MaxNumber) + 1); } frmfysz.ct_iftype = 0; if (ids == "") { int Result = fmcost.Add(frmfysz); if (Result > 0) { ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript' defer>alert('保存成功');parent.Window_Close();</script>"); // alert('保存成功');parent.document.getElementById('btnsercher').click();parent.Window_Close(); Bind(); BindGv(pageSize, pageIndex); } } else { frmfysz.id = Convert.ToInt32(ids); if (fmcost.Update(frmfysz)) { ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript' defer>alert('更新成功');parent.Window_Close();</script>"); } } }