private void btnUpdatePic_Click(object sender, EventArgs e) { if (this.picTip.Image != null && m_modc != null) { Bitmap bp = (Bitmap)this.picTip.Image; MemoryStream ms = new MemoryStream(); bp.Save(ms, ImageFormat.Png); byte[] b = new byte[ms.Length]; b = ms.ToArray(); if (m_modc != null) { m_modc.tipPic = b; if (m_bllc.Update(m_modc)) { MessageBox.Show("更新成功!"); } } } }
private void btnUpdate_Click(object sender, EventArgs e) { int hourc = int.Parse(this.lblHourc.Text); int minc = int.Parse(this.lblMinc.Text); int secc = int.Parse(this.lblSecc.Text); int timespan = hourc * 3600 + minc * 60 + secc; if (timespan == 0) { MessageBox.Show("持续时间不能为 0 ", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ALS.BLL.customactions bllcustom = new ALS.BLL.customactions(); ALS.Model.customactions modelcustom = bllcustom.GetModel(this._method, this.cmbAction.Text.Trim()); //CustomActions.BLL.actions bllaction = new CustomActions.BLL.actions(); //DataSet dsaction = bllaction.GetList("customID='"+ modelcustom.ID+"'"); //先查询该时间点是否有重复的 if (modelcustom != null) { //m_modc = new CustomActions.Model.customactions(); modelcustom.timeString = Cls.utils.SecondsToTime(0); modelcustom.actionName = this.cmbAction.Text.Trim(); modelcustom.methodName = _method; modelcustom.timeCount = 0; modelcustom.timeSpan = timespan; modelcustom.timeSpanString = Cls.utils.SecondsToTime(timespan); m_bllc = new ALS.BLL.customactions(); if (m_bllc.Update(modelcustom)) { //刷新列表,sort by timecount ShowCustomActions(_method); UnEnableControl(); } } }