private bool DoAdd() { bool result = false; Model.Goods model = new Model.Goods(); BLL.Goods bll = new BLL.Goods(); model.CustomerId = int.Parse(ddlCustomer.SelectedValue); model.StoreModeId = int.Parse(ddlStoreMode.SelectedValue); model.HandlingModeId = int.Parse(ddlHandlingMode.SelectedValue); model.UnitId = int.Parse(ddlUnit.SelectedValue); model.Name = txtName.Text; string[] attributeNames = Request.Form.GetValues("AttributeName"); string[] attributeValues = Request.Form.GetValues("AttributeValue"); string[] attributeRemarks = Request.Form.GetValues("AttributeRemark"); if (attributeNames != null && attributeValues != null && attributeRemarks != null && attributeNames.Length > 0 && attributeValues.Length > 0 && attributeRemarks.Length > 0) { for (int i = 0; i < attributeNames.Length; i++) { model.AddAttributeValues(new GoodsAttributeValues(attributeNames[i], attributeValues[i], attributeRemarks[i])); } } if (bll.Add(model)) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加客户:" + model.Name); //记录日志 result = true; } return(result); }
/// <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.Goods frmtype = new Model.Goods(); frmtype.Goods_number = txtBH.Value; frmtype.Goods_name = txtName.Value; frmtype.Goods_ifType = 1; frmtype.Goods_unit = txt_unit.Value; if (txt_Jf.Value == "") { frmtype.Goods_jf = 0; } else { frmtype.Goods_jf = Convert.ToInt32(txt_Jf.Value); } frmtype.Goods_categories = Convert.ToInt32(DDlfylb.SelectedValue); frmtype.Goods_price = Convert.ToDecimal(txtPrice.Value); if (radStatu.Checked == true) { frmtype.Goods_state = radStatu.Value; } else { frmtype.Goods_state = radStatus.Value; } // frmtype.Goods_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); } } }
private bool DoAdd() { bool result = false; Model.Goods model = new Model.Goods(); BLL.Goods bll = new BLL.Goods(); model.Name = txtName.Text.Trim(); model.CategoryName = txtCategroy.Text.Trim(); model.Code = string.IsNullOrEmpty(txtCode.Text.Trim()) ? "" : txtCode.Text.Trim(); model.Unit = txtUnit.Text.Trim(); if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加客户:" + model.Name); //记录日志 result = true; } return(result); }
private void btConfirm_Click(object sender, EventArgs e) { if (tbID.Text.Trim() == "" || tbName.Text.Trim() == "" || tbPrice.Text.Trim() == "" || tbRoomType.Text.Trim() == "") { MessageBox.Show("输入信息不完整!", "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); flag = 1; } if (flag == 0) { if (tbRoomType.Text.Trim() == "单人间" || tbRoomType.Text.Trim() == "双人间" || tbRoomType.Text.Trim() == "套房") { Maticsoft.BLL.Goods go = new BLL.Goods(); Model.Goods gmodel = new Model.Goods(); string str1 = string.Format("goodsID = '{0}' and roomTypeID = '{1}'", tbID.Text.Trim(), tbRoomType.Text.Trim()); if (go.GetRecordCount(str1) > 0) { MessageBox.Show("当前物品已存在!", "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { gmodel.goodsID = tbID.Text.Trim(); gmodel.goodsName = tbName.Text.Trim(); gmodel.goodsPrice = Convert.ToDecimal(tbPrice.Text.Trim()); gmodel.roomTypeID = tbRoomType.Text.Trim(); if (go.Add(gmodel) == true) { MessageBox.Show("添加成功!"); ((Main_Admin)this.Owner).RoomGoodsLoad(); this.Close(); } else { MessageBox.Show("添加失败!"); } } } else { MessageBox.Show("添加房型不存在!", "添加失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
/// <summary> /// 费用大类录入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { //string id = ""; Model.Goods frmfysz = new Model.Goods(); frmfysz.Goods_name = txt_name.Value; string MaxNumber = fmcost.GetMaxNumber(" where Goods_ifType=0").ToString().Trim(); if (MaxNumber == "1") { frmfysz.Goods_number = "0001"; } else { frmfysz.Goods_number = "000" + (Convert.ToInt32(MaxNumber) + 1); } frmfysz.Goods_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>"); } } }
private bool DoAdd() { bool result = false; Model.Goods model = new Model.Goods(); BLL.Goods bll = new BLL.Goods(); model.CustomerId = int.Parse(ddlCustomer.SelectedValue); model.StoreModeId = int.Parse(ddlStoreMode.SelectedValue); model.HandlingModeId = int.Parse(ddlHandlingMode.SelectedValue); model.UnitId = int.Parse(ddlUnit.SelectedValue); model.Name = txtName.Text; string[] attributeNames = Request.Form.GetValues("AttributeName"); string[] attributeValues = Request.Form.GetValues("AttributeValue"); string[] attributeRemarks = Request.Form.GetValues("AttributeRemark"); if (attributeNames != null && attributeValues != null && attributeRemarks != null && attributeNames.Length > 0 && attributeValues.Length > 0 && attributeRemarks.Length > 0) { for (int i = 0; i < attributeNames.Length; i++) { model.AddAttributeValues(new GoodsAttributeValues(attributeNames[i], attributeValues[i], attributeRemarks[i])); } } if (bll.Add(model)) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加客户:" + model.Name); //记录日志 result = true; } return result; }
private bool DoAdd() { bool result = false; Model.Goods model = new Model.Goods(); BLL.Goods bll = new BLL.Goods(); model.Name = txtName.Text.Trim(); model.CategoryName = txtCategroy.Text.Trim(); model.Code = string.IsNullOrEmpty(txtCode.Text.Trim()) ? "" : txtCode.Text.Trim(); model.Unit = txtUnit.Text.Trim(); model.Variety = txtVariety.Text.Trim(); if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加客户:" + model.Name); //记录日志 result = true; } return result; }