public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { DrawVo inVo = (DrawVo)vo; StringBuilder sql = new StringBuilder(); sql.Append("insert into public.m_ncvp_draw(draw_cd, draw_name, registration_user_cd, registration_date_time, factory_cd) "); sql.Append("values(:draw_cd,:draw_name, :registration_user_cd,now(),:factory_cd)"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("draw_cd", inVo.DrawCode); sqlParameter.AddParameterString("draw_name", inVo.DrawName); sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode); sqlParameter.AddParameterString("registration_user_cd", inVo.RegistrationUserCode); //execute SQL DrawVo outVo = new DrawVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
/// <summary> /// selects user record for updation and show user form /// </summary> private void BindUpdateCavityData() { int selectedrowindex = Draw_dgv.SelectedCells[0].RowIndex; DrawVo vo = (DrawVo)Draw_dgv.Rows[selectedrowindex].DataBoundItem; AddDrawMasterForm addform = new AddDrawMasterForm(); addform.vo = vo; if (addform.IntSuccess > 0) { messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(); } else if (addform.IntSuccess == 0) { messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(); } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { DrawVo inVo = (DrawVo)vo; StringBuilder sql = new StringBuilder(); sql.Append("update public.m_draw set draw_cd=:draw_cd,draw_name=:draw_name"); sql.Append(" where draw_id =:draw_id"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("draw_cd", inVo.DrawCode); sqlParameter.AddParameterString("draw_name", inVo.DrawName); sqlParameter.AddParameterInteger("draw_id", inVo.DrawId); sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode); sqlParameter.AddParameterString("registration_user_cd", inVo.RegistrationUserCode); //execute SQL DrawVo outVo = new DrawVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { DrawVo inVo = (DrawVo)vo; StringBuilder sql = new StringBuilder(); ValueObjectList <DrawVo> voList = new ValueObjectList <DrawVo>(); DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty); DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("select draw_id, draw_cd, draw_name, registration_user_cd, registration_date_time, factory_cd from m_ncvp_draw"); sql.Append(" Where 1=1 "); if (!String.IsNullOrEmpty(inVo.FactoryCode)) { sql.Append(" and factory_cd = :factory_cd "); sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode); } if (inVo.DrawId > 0) { sql.Append(" and draw_id = :draw_id "); sqlParameter.AddParameterInteger("draw_id", inVo.DrawId); } if (!string.IsNullOrEmpty(inVo.DrawCode)) { sql.Append(" and draw_cd = :draw_cd "); sqlParameter.AddParameterString("draw_cd", inVo.DrawCode); } if (!string.IsNullOrEmpty(inVo.DrawName)) { sql.Append(" and draw_name = :draw_name "); sqlParameter.AddParameterString("draw_name", inVo.DrawName); } //create command //DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); while (dataReader.Read()) { DrawVo outVo = new DrawVo { DrawCode = dataReader["draw_cd"].ToString(), DrawId = int.Parse(dataReader["draw_id"].ToString()), DrawName = dataReader["draw_name"].ToString(), RegistrationUserCode = dataReader["registration_user_cd"].ToString(), RegistrationDateTime = DateTime.Parse(dataReader["registration_date_time"].ToString()), FactoryCode = dataReader["factory_cd"].ToString() }; voList.add(outVo); } dataReader.Close(); return(voList); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { DrawVo inVo = (DrawVo)vo; StringBuilder sql = new StringBuilder(); DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty); DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("delete from public.m_draw Where 1=1 "); if (!String.IsNullOrEmpty(inVo.FactoryCode)) { sql.Append(" and factory_cd = :factory_cd "); sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode); } if (inVo.DrawId > 0) { sql.Append(" and draw_id = :draw_id "); sqlParameter.AddParameterInteger("draw_id", inVo.DrawId); } if (!string.IsNullOrEmpty(inVo.DrawCode)) { sql.Append(" and draw_cd = :draw_cd "); sqlParameter.AddParameterString("draw_cd", inVo.DrawCode); } if (!string.IsNullOrEmpty(inVo.DrawName)) { sql.Append(" and draw_name = :draw_name "); sqlParameter.AddParameterString("draw_name", inVo.DrawName); } //create command sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL DrawVo outVo = new DrawVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
private void Delete_btn_Click(object sender, EventArgs e) { if (Draw_dgv.SelectedRows.Count > 0) { int selectedrowindex = Draw_dgv.SelectedCells[0].RowIndex; DrawVo vo = (DrawVo)Draw_dgv.Rows[selectedrowindex].DataBoundItem; messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, vo.DrawCode); logger.Info(messageData); DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text); if (dialogResult == DialogResult.OK) { try { DrawVo outVo = (DrawVo)DefaultCbmInvoker.Invoke(new DeleteDrawCbm(), vo); if (outVo.AffectedCount > 0) { messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(); } else if (outVo.AffectedCount == 0) { messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(); } } catch (Com.Nidec.Mes.Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } } } }
private bool CheckDate() { if (DrawCode_txt.Text.Trim().Length == 0) { messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, DrawCode_lbl.Text); popUpMessage.Warning(messageData, Text); DrawCode_txt.Focus(); return(false); } if (DrawName_txt.Text.Trim().Length == 0) { messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, DrawName_lbl.Text); popUpMessage.Warning(messageData, Text); DrawName_txt.Focus(); return(false); } DrawCode_txt.Text = DrawCode_txt.Text.Trim(); DrawName_txt.Text = DrawName_txt.Text.Trim(); DrawVo outVo = new DrawVo(), inVo = new DrawVo { DrawId = vo.DrawId, DrawCode = DrawCode_txt.Text }; try { outVo = (DrawVo)DefaultCbmInvoker.Invoke(new CheckDrawCbm(), inVo); if (outVo.AffectedCount > 0) { messageData = new MessageData("mmcc00006", Properties.Resources.mmcc00006, DrawCode_lbl.Text); popUpMessage.Warning(messageData, Text); DrawCode_txt.Focus(); return(false); } } catch (Com.Nidec.Mes.Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return(false); } return(true); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { DrawVo inVo = (DrawVo)vo; StringBuilder sql = new StringBuilder(); DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty); DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("Select Count(*) as DrawCount "); sql.Append(" from public.m_ncvp_draw"); sql.Append(" Where 1=1 "); if (!String.IsNullOrEmpty(inVo.FactoryCode)) { sql.Append(" and factory_cd = :factory_cd "); sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode); } if (!string.IsNullOrEmpty(inVo.DrawCode)) { sql.Append(" and UPPER(draw_cd) = UPPER(:draw_cd) "); sqlParameter.AddParameterString("draw_cd", inVo.DrawCode); } if (inVo.DrawId > 0) { sql.Append(" and draw_id != :draw_id "); sqlParameter.AddParameterInteger("draw_id", inVo.DrawId); } sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); DrawVo outVo = new DrawVo(); while (dataReader.Read()) { outVo.AffectedCount = Convert.ToInt32(dataReader["DrawCount"].ToString()); } dataReader.Close(); return(outVo); }
private void Ok_btn_Click(object sender, EventArgs e) { if (CheckDate()) { DrawVo outVo = new DrawVo(); DrawVo inVo = new DrawVo { DrawId = vo.DrawId, DrawCode = DrawCode_txt.Text, DrawName = DrawName_txt.Text, FactoryCode = UserData.GetUserData().FactoryCode, RegistrationUserCode = UserData.GetUserData().UserCode }; try { if (inVo.DrawId > 0) { outVo = (DrawVo)DefaultCbmInvoker.Invoke(new UpdateDrawCbm(), inVo); } else { outVo = (DrawVo)DefaultCbmInvoker.Invoke(new AddDrawCbm(), inVo); } IntSuccess = outVo.AffectedCount; } catch (Com.Nidec.Mes.Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } if ((IntSuccess > 0) || (IntSuccess == 0)) { this.DialogResult = DialogResult.OK; this.Close(); } } }