public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { UserLocationVo inVo = (UserLocationVo)vo; StringBuilder sql = new StringBuilder(); sql.Append("insert into m_user_location(user_location_cd, user_location_name, dept_cd, registration_user_cd, registration_date_time, factory_cd) "); sql.Append("values(:user_location_cd,:user_location_name, :dept_cd, :registration_user_cd,now(),:factory_cd)"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("user_location_cd", inVo.UserLocationCode); sqlParameter.AddParameterString("user_location_name", inVo.UserLocationName); sqlParameter.AddParameterString("dept_cd", inVo.DeptCode); sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode); sqlParameter.AddParameterString("registration_user_cd", inVo.RegistrationUserCode); //execute SQL UserLocationVo outVo = new UserLocationVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { UserLocationVo inVo = (UserLocationVo)vo; StringBuilder sql = new StringBuilder(); sql.Append("update m_user_location set user_location_cd=:user_location_cd,user_location_name=:user_location_name, dept_cd=:dept_cd"); sql.Append(" where user_location_id =:user_location_id"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("user_location_cd", inVo.UserLocationCode); sqlParameter.AddParameterString("user_location_name", inVo.UserLocationName); sqlParameter.AddParameterInteger("user_location_id", inVo.UserLocationId); sqlParameter.AddParameterString("dept_cd", inVo.DeptCode); sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode); sqlParameter.AddParameterString("registration_user_cd", inVo.RegistrationUserCode); //execute SQL Vo.UserLocationVo outVo = new Vo.UserLocationVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
private void GridBind() { UserLocationDetails_dgv.DataSource = null; try { UserLocationVo vo = new UserLocationVo { UserLocationCode = UserLocationCode_txt.Text, UserLocationName = UserLocationName_txt.Text }; ValueObjectList <UserLocationVo> volist = (ValueObjectList <UserLocationVo>)DefaultCbmInvoker.Invoke(new GetUserLocationCbm(), vo); if (volist.GetList() != null && volist.GetList().Count > 0) { UserLocationDetails_dgv.AutoGenerateColumns = false; BindingSource bindingsource = new BindingSource(volist.GetList(), null); UserLocationDetails_dgv.DataSource = bindingsource; } else { messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); } UserLocationDetails_dgv.ClearSelection(); Update_btn.Enabled = false; Delete_btn.Enabled = false; } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } }
private void BindUpdateCavityData() { int selectedrowindex = UserLocationDetails_dgv.SelectedCells[0].RowIndex; UserLocationVo vo = (UserLocationVo)UserLocationDetails_dgv.Rows[selectedrowindex].DataBoundItem; AddUserLocationForm addform = new AddUserLocationForm(); addform.vo = vo; addform.ShowDialog(); 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) { UserLocationVo inVo = (UserLocationVo)vo; StringBuilder sql = new StringBuilder(); ValueObjectList <UserLocationVo> voList = new ValueObjectList <UserLocationVo>(); DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty); DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("select user_location_id,user_location_cd,user_location_name,dept_cd, registration_user_cd,registration_date_time,factory_cd from m_user_location"); 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.UserLocationId > 0) { sql.Append(" and user_location_id = :user_location_id "); sqlParameter.AddParameterInteger("user_location_id", inVo.UserLocationId); } if (!string.IsNullOrEmpty(inVo.UserLocationCode)) { sql.Append(" and user_location_cd = :user_location_cd "); sqlParameter.AddParameterString("user_location_cd", inVo.UserLocationCode); } if (!string.IsNullOrEmpty(inVo.UserLocationName)) { sql.Append(" and user_location_name = :user_location_name "); sqlParameter.AddParameterString("user_location_name", inVo.UserLocationName); } //create command //DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); while (dataReader.Read()) { UserLocationVo outVo = new UserLocationVo { UserLocationCode = dataReader["user_location_cd"].ToString(), UserLocationId = int.Parse(dataReader["user_location_id"].ToString()), UserLocationName = dataReader["user_location_name"].ToString(), DeptCode = dataReader["dept_cd"].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) { UserLocationVo inVo = (UserLocationVo)vo; StringBuilder sql = new StringBuilder(); DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty); DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("delete from m_user_location Where 1=1 "); if (!String.IsNullOrEmpty(inVo.FactoryCode)) { sql.Append(" and factory_cd = :factory_cd "); sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode); } if (inVo.UserLocationId > 0) { sql.Append(" and user_location_id = :user_location_id "); sqlParameter.AddParameterInteger("user_location_id", inVo.UserLocationId); } if (!string.IsNullOrEmpty(inVo.UserLocationCode)) { sql.Append(" and user_location_cd = :user_location_cd "); sqlParameter.AddParameterString("user_location_cd", inVo.UserLocationCode); } if (!string.IsNullOrEmpty(inVo.UserLocationName)) { sql.Append(" and user_location_name = :user_location_name "); sqlParameter.AddParameterString("user_location_name", inVo.UserLocationName); } //create command sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL UserLocationVo outVo = new UserLocationVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
private bool checkdate() { if (UserLocationCode_txt.Text.Trim().Length == 0) { messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, UserLocationCode_lbl.Text); popUpMessage.Warning(messageData, Text); UserLocationCode_txt.Focus(); return(false); } if (UserLocationName_txt.Text.Trim().Length == 0) { messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, UserLocationName_lbl.Text); popUpMessage.Warning(messageData, Text); UserLocationName_txt.Focus(); return(false); } UserLocationCode_txt.Text = UserLocationCode_txt.Text.Trim(); UserLocationName_txt.Text = UserLocationName_txt.Text.Trim(); UserLocationVo outVo = new UserLocationVo(), inVo = new UserLocationVo { UserLocationId = vo.UserLocationId, UserLocationCode = UserLocationCode_txt.Text }; try { outVo = (UserLocationVo)DefaultCbmInvoker.Invoke(new CheckUserLocationCbm(), inVo); if (outVo.AffectedCount > 0) { messageData = new MessageData("mmcc00006", Properties.Resources.mmcc00006, UserLocationCode_lbl.Text); popUpMessage.Warning(messageData, Text); UserLocationCode_txt.Focus(); return(false); } } catch (Com.Nidec.Mes.Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return(false); } return(true); }
private void Delete_btn_Click(object sender, EventArgs e) { if (UserLocationDetails_dgv.SelectedRows.Count > 0) { int selectedrowindex = UserLocationDetails_dgv.SelectedCells[0].RowIndex; UserLocationVo vo = (UserLocationVo)UserLocationDetails_dgv.Rows[selectedrowindex].DataBoundItem; messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, vo.UserLocationCode); logger.Info(messageData); DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text); if (dialogResult == DialogResult.OK) { try { UserLocationVo outVo = (UserLocationVo)DefaultCbmInvoker.Invoke(new DeleteUserLocationCbm(), 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 void Ok_btn_Click(object sender, EventArgs e) { if (checkdate()) { UserLocationVo outvo = new UserLocationVo(); UserLocationVo invo = new UserLocationVo { UserLocationId = vo.UserLocationId, UserLocationCode = UserLocationCode_txt.Text, UserLocationName = UserLocationName_txt.Text, DeptCode = locationcode_cmb.Text, FactoryCode = UserData.GetUserData().FactoryCode, RegistrationUserCode = UserData.GetUserData().UserCode }; try { if (invo.UserLocationId > 0) { outvo = (UserLocationVo)DefaultCbmInvoker.Invoke(new UpdateUserLocationCbm(), invo); } else { outvo = (UserLocationVo)DefaultCbmInvoker.Invoke(new AddUserLocationCbm(), invo); } messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, UserLocationCode_lbl.Text + " : " + UserLocationCode_txt.Text); logger.Info(messageData); popUpMessage.Information(messageData, Text); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } if ((IntSuccess > 0) || (IntSuccess == 0)) { this.DialogResult = DialogResult.OK; this.Close(); } } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { UserLocationVo inVo = (UserLocationVo)vo; StringBuilder sql = new StringBuilder(); DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty); DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("Select Count(*) as UserLocationCount "); sql.Append(" from m_user_location"); 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.UserLocationCode)) { sql.Append(" and UPPER(user_location_cd) = UPPER(:user_location_cd) "); sqlParameter.AddParameterString("user_location_cd", inVo.UserLocationCode); } if (inVo.UserLocationId > 0) { sql.Append(" and user_location_id != :user_location_id "); ///????? sqlParameter.AddParameterInteger("user_location_id", inVo.UserLocationId); } sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); UserLocationVo outVo = new UserLocationVo(); while (dataReader.Read()) { outVo.AffectedCount = Convert.ToInt32(dataReader["UserLocationCount"].ToString()); } dataReader.Close(); return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { UserLocationVo inVo = (UserLocationVo)vo; ValueObjectList <UserLocationVo> voList = new ValueObjectList <UserLocationVo>(); StringBuilder sql = new StringBuilder(); //CREATE SQL ADAPTER AND PARAMETER LIST DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("select user_location_id, user_location_cd, user_location_name from m_user_location where 1=1 "); if (!string.IsNullOrEmpty(inVo.user_location_cd)) { sql.Append("and user_location_cd ='").Append(inVo.user_location_cd).Append("' "); } if (!string.IsNullOrEmpty(inVo.user_location_name)) { sql.Append("and user_location_name ='").Append(inVo.user_location_name).Append("' "); } sql.Append("order by user_location_id"); sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); sql.Clear(); //EXECUTE READER FROM COMMAND IDataReader datareader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); while (datareader.Read()) { UserLocationVo outVo = new UserLocationVo { user_location_id = (int)datareader["user_location_id"], user_location_cd = datareader["user_location_cd"].ToString(), user_location_name = datareader["user_location_name"].ToString() }; voList.add(outVo); } datareader.Close(); return(voList); }