/// <summary> /// 打开弹窗(修改) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void LinkButton1_Click(object sender, EventArgs e) { try { //获取button 控件 LinkButton lb = (LinkButton)sender; //获取传过来的commwntid int id = Convert.ToInt32(lb.CommandArgument); Model.Commoditytab hom = hot.GetModel(id); Label1.Text = hom.id.ToString(); ListBox2.Text = hom.category.ToString(); TextBox4.Text = hom.Name; TextBox7.Text = hom.Beizhu; ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>javascript:showDiv2();</script>"); } catch (Exception ee) { //Response.Write("<script>alert('确定异常 " + ee.Message + "')</script>"); ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('修改弹窗异常 " + ee.Message + "');</script>"); } }
/// <summary> /// 选择外购商品赋值(餐桌) /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void Repeater3_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "add") { Model.Commoditytab hod = com.GetModel(Convert.ToInt32(e.CommandArgument)); if (Label3.Text == "1") { if (TextBox14.Text.Trim() != "") { TextBox14.Text += " + " + hod.Name; } else { TextBox14.Text = hod.Name; } } else if (Label3.Text == "2") { if (TextBox15.Text.Trim() != "") { TextBox15.Text += " + " + hod.Name; } else { TextBox15.Text = hod.Name; } } else if (Label3.Text == "3") { if (TextBox16.Text.Trim() != "") { TextBox16.Text += " + " + hod.Name; } else { TextBox16.Text = hod.Name; } } else if (Label3.Text == "4") { if (TextBox17.Text.Trim() != "") { TextBox17.Text += " + " + hod.Name; } else { TextBox17.Text = hod.Name; } } else if (Label3.Text == "5") { if (TextBox18.Text.Trim() != "") { TextBox18.Text += " + " + hod.Name; } else { TextBox18.Text = hod.Name; } } else if (Label3.Text == "6") { if (TextBox19.Text.Trim() != "") { TextBox19.Text += " + " + hod.Name; } else { TextBox19.Text = hod.Name; } } else if (Label3.Text == "7") { if (TextBox20.Text.Trim() != "") { TextBox20.Text += " + " + hod.Name; } else { TextBox20.Text = hod.Name; } } else { } } }
/// <summary> /// 添加外购商品(确定按钮) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ImageButton1_Click(object sender, EventArgs e) { try { if (TextBox1.Text.Trim() != "") { //string t = Convert.ToString("ZZSP" + DateTime.Now.ToString("yyyyMMddhhmmss")); Model.Commoditytab ho = new Model.Commoditytab(); //if (FileUpload1.FileName != "") //{ // string name1 = FileUpload1.FileName;//上传文件名字 // string type1 = FileUpload1.PostedFile.ContentType; // string type11 = name1.Substring(name1.LastIndexOf(".") + 1); // //string path1 = HttpContext.Current.Request.MapPath("~/") + "picture\\" + FileUpload1.FileName; // if (type11 == "jpg" || type11 == "gif" || type11 == "bmp" || type11 == "png") // { // string ming1 = name1.Substring(name1.Length - 4, 4); // string wj1 = "D1" + t + ming1; // string path = HttpContext.Current.Request.MapPath("~/") + "picture\\"; // FileUpload1.SaveAs(path + wj1); // ho.Photourl = "../picture/" + wj1; // ho.Name = TextBox1.Text; // ho.Comment = TextBox6.Text; // ho.Beizhu = TextBox2.Text; // int a = hot.Add(ho); // if (a > 0) // { // ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('添加成功!');</script>"); // bind(sql); // } // else // { // ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('添加失败!');</script>"); // bind(sql); // } // } // else // { // ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('图片格式不正确请传(.jpg/.gif/.bmp/.png)!');</script>"); // } //} //else //{ ho.category = Convert.ToInt32(ListBox1.Text); ho.Name = TextBox1.Text; ho.Beizhu = TextBox2.Text; int a = hot.Add(ho); if (a > 0) { ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('添加成功!');</script>"); bind(sql); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('添加失败!');</script>"); bind(sql); } // } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('自制商品名称不能为空!');</script>"); ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>javascript:showDiv1();</script>"); } } catch (Exception ee) { //Response.Write("<script>alert('确定异常 " + ee.Message + "')</script>"); ClientScript.RegisterClientScriptBlock(this.GetType(), "this", "<script language=javascript>alert('确定异常 " + ee.Message + "');</script>"); } }