public static IsSpRemark CreateForm(DataBind bind) { bind1 = bind; if (_danli == null) { _danli = new IsSpRemark(); } return(_danli); }
private void IsSpRemark_FormClosing(object sender, FormClosingEventArgs e) { _danli = null; }
private void button2_Click(object sender, EventArgs e) { //dataBind bool IsHuaKa = false; shInfoList model = new shInfoList(); double money = 0; if (radioButton1.Checked) { DialogResult result = MessageBox.Show("确认赠送", "提示信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.Cancel) { return; } model.CountMoney = money; //赠送 } else if (radioButton2.Checked) { try { //指定单价 double mm = Convert.ToDouble(textBox2.Text.Trim()); money = Convert.ToDouble(numericUpDown2.Value) * mm; model.CountMoney = money; } catch { MessageBox.Show("单价请输入数字!"); return; } } else if (radioButton3.Checked) { if (dataGridView1.SelectedRows.Count != 1) { MessageBox.Show("请选择一条数据!"); return; } double price = Convert.ToDouble(dataGridView1.SelectedRows[0].Cells["spPrice"].Value); //指定折扣spPrice try { int zk = Convert.ToInt32(numericUpDown1.Value); money = price * Convert.ToInt32(numericUpDown2.Value) * zk / 100; model.CountMoney = money; } catch { MessageBox.Show("信息错误!"); return; } } else//直接以指定价格出售 { try { double price = Convert.ToDouble(dataGridView1.SelectedRows[0].Cells["spPrice"].Value); //指定单价 //double mm = Convert.ToDouble(textBox2.Text.Trim()); money = Convert.ToDouble(numericUpDown2.Value) * price; model.CountMoney = money; } catch { MessageBox.Show("单价请输入数字!"); return; } } model.JiCun = false; model.FuWuName = "购买商品[" + dataGridView1.SelectedRows[0].Cells["spName"].Value.ToString().Trim(); model.YMoney = 0; model.FuKuan = false; model.Count = Convert.ToInt32(numericUpDown2.Value); model.Type = dataGridView1.SelectedRows[0].Cells["spType"].Value.ToString(); model.CiCount = 0; model.PaiNumber = ""; model.CJQuestion = ""; model.Remark = ""; model.PinPai = ""; model.Color = ""; model.ImgUrl = dataGridView1.SelectedRows[0].Cells["Gid"].Value.ToString(); model.YMPerson = ""; //model.TCMoney = Convert.ToDouble(textBox3.Text.Trim() == "" ? "0" : textBox3.Text.Trim()); if (radioButton1.Checked) { //赠送 } else { DialogResult huaka = MessageBox.Show("是否划卡?(划卡即消费用户的卡里的余额,否则用户支付现金。)", "提示信息", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); IsHuaKa = true; if (huaka == DialogResult.No) { model.YMoney = money; IsHuaKa = false; } else if (huaka == DialogResult.Cancel) { return; } } fhmodel = model; ishk = IsHuaKa; IsSpRemark from = IsSpRemark.CreateForm(AddRemark); from.Show(); }