//保存 private void btnSave_Click(object sender, EventArgs e) { try { string message = ""; bool validateResult = uCCommonNoteInfo.ValidateCommonNote(); if (validateResult == false) { return; } CommonNoteEntity commonNoteEntityNew = uCCommonNoteInfo.SaveCommonNote(); bool saveResult = commonNoteBiz.SaveCommonNoteAll(commonNoteEntityNew, ref message); CommonNoteCountEntity commonNoteCountEntity = uCCommonNoteInfo.SaveCommonCount(); commonNoteCountEntity.CommonNoteFlow = commonNoteEntityNew.CommonNoteFlow; CommonNoteBiz.AddOrModCommonNoteEntity(commonNoteCountEntity); if (saveResult) { m_app.CustomMessageBox.MessageShow("保存成功"); //从数据库中取对象 为了确保对象数据的完整 commonNoteEntityNew = commonNoteBiz.GetDetailCommonNote(commonNoteEntityNew.CommonNoteFlow); Search(); //RefreshTabpage(commonNoteEntityNew); } else { m_app.CustomMessageBox.MessageShow(message); } } catch (Exception ex) { m_app.CustomMessageBox.MessageShow(ex.Message); } }
/// <summary> /// 添加或修改通用单据统计 /// </summary> /// <param name="commonNoteCountEntity"></param> public static void AddOrModCommonNoteEntity(CommonNoteCountEntity commonNoteCountEntity) { try { if (string.IsNullOrEmpty(commonNoteCountEntity.CommonNoteCountFlow)) { commonNoteCountEntity.CommonNoteCountFlow = Guid.NewGuid().ToString(); } SqlParameter[] sqlParams = new SqlParameter[] { new SqlParameter("@CommonNoteCountFlow", SqlDbType.VarChar, 50), new SqlParameter("@CommonNoteFlow", SqlDbType.VarChar, 50), new SqlParameter("@ItemCount", SqlDbType.VarChar, 50), new SqlParameter("@Hour12Name", SqlDbType.VarChar, 50), new SqlParameter("@Hour12Time", SqlDbType.VarChar), new SqlParameter("@Hour24Name", SqlDbType.VarChar), new SqlParameter("@Hour24Time", SqlDbType.VarChar), new SqlParameter("@Valide", SqlDbType.VarChar, 50) }; sqlParams[0].Value = commonNoteCountEntity.CommonNoteCountFlow; sqlParams[1].Value = commonNoteCountEntity.CommonNoteFlow; sqlParams[2].Value = commonNoteCountEntity.ItemCount; sqlParams[3].Value = commonNoteCountEntity.Hour12Name; sqlParams[4].Value = commonNoteCountEntity.Hour12Time; sqlParams[5].Value = commonNoteCountEntity.Hour24Name; sqlParams[6].Value = commonNoteCountEntity.Hour24Time; sqlParams[7].Value = commonNoteCountEntity.Valide; DrectSoft.DSSqlHelper.DS_SqlHelper.ExecuteNonQuery("EMR_CommonNote.usp_AddOrModCommonNoteCount", sqlParams, CommandType.StoredProcedure); } catch (Exception ex) { throw ex; } }
public CommonNoteCountEntity SaveCommonCount() { try { if (m_commonNoteCountEntity == null) { m_commonNoteCountEntity = new CommonNoteCountEntity(); } if (chkCount.Checked == true) { m_commonNoteCountEntity.Valide = "1"; } else { m_commonNoteCountEntity.Valide = "0"; } m_commonNoteCountEntity.Hour12Name = txt12Name.Text; m_commonNoteCountEntity.Hour24Name = txt24Name.Text; m_commonNoteCountEntity.ItemCount = txtitemCount.Text; m_commonNoteCountEntity.Hour12Time = tim12.Time.ToString("yyyy-MM-dd HH:mm:ss"); m_commonNoteCountEntity.Hour24Time = tim24.Time.ToString("yyyy-MM-dd HH:mm:ss"); m_commonNoteCountEntity.CommonNoteFlow = m_CommonNoteEntity.CommonNoteFlow; return(m_commonNoteCountEntity); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取统计数据 xll 20130620 /// </summary> private void InitCommonCount() { try { chkCount.Checked = false; if (string.IsNullOrEmpty(m_CommonNoteEntity.CommonNoteFlow)) { return; } m_commonNoteCountEntity = CommonNoteBiz.GetCommonNoteCount(m_CommonNoteEntity.CommonNoteFlow); if (m_commonNoteCountEntity == null) { return; } txtitemCount.Text = m_commonNoteCountEntity.ItemCount; txt12Name.Text = m_commonNoteCountEntity.Hour12Name == null ? "12小时统计" : m_commonNoteCountEntity.Hour12Name; txt24Name.Text = m_commonNoteCountEntity.Hour24Name == null ? "24小时统计" : m_commonNoteCountEntity.Hour24Name; chkCount.Checked = m_commonNoteCountEntity.Valide == "1" ? true : false; tim12.Time = string.IsNullOrEmpty(m_commonNoteCountEntity.Hour12Time) ? Convert.ToDateTime("2013-06-20 07:00:00") : Convert.ToDateTime(m_commonNoteCountEntity.Hour12Time); tim24.Time = string.IsNullOrEmpty(m_commonNoteCountEntity.Hour24Time) ? Convert.ToDateTime("2013-06-20 19:00:00") : Convert.ToDateTime(m_commonNoteCountEntity.Hour24Time); } catch (Exception ex) { throw ex; } }
/// <summary> /// 通用单据匹配使用 /// </summary> /// <param name="commnoteflow"></param> /// <returns></returns> public static CommonNoteCountEntity GetCommonNoteCount(string commnoteflow) { try { string sqlStr = string.Format(@"select * from commonnotecount c where c.commonnoteflow='{0}'", commnoteflow); DataTable dt = DrectSoft.DSSqlHelper.DS_SqlHelper.ExecuteDataTable(sqlStr, CommandType.Text); CommonNoteCountEntity commonNoteCountEntity = DataTableToList <CommonNoteCountEntity> .ConvertToModelOne(dt); return(commonNoteCountEntity); } catch (Exception ex) { throw ex; } }