/// <summary> /// Fills all user records to gridview control /// </summary> private void GridBind(ItemVo conditionInVo) { ItemData_dgv.DataSource = null; try { ItemVo outVo = (ItemVo)base.InvokeCbm(new GetItemMasterMntCbm(), conditionInVo, false); ItemData_dgv.AutoGenerateColumns = false; BindingSource bindingSource1 = new BindingSource(outVo.ItemListVo, null); if (bindingSource1.Count > 0) { ItemData_dgv.DataSource = bindingSource1; } else { messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null); //"item" logger.Info(messageData); popUpMessage.Information(messageData, Text); } ItemData_dgv.ClearSelection(); Update_btn.Enabled = false; Delete_btn.Enabled = false; } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } }
/// <summary> /// form country and factory data for combo /// </summary> private void FormDatatableFromVo() { itemDatatable = new DataTable(); itemDatatable.Columns.Add("id"); itemDatatable.Columns.Add("code"); processFlowRuleDatatable = new DataTable(); processFlowRuleDatatable.Columns.Add("ProcessFlowRuleId", typeof(string)); processFlowRuleDatatable.Columns.Add("Comment", typeof(string)); try { ItemVo ItemOutVo = (ItemVo)base.InvokeCbm(new GetItemMasterMntCbm(), new ItemVo(), false); foreach (ItemVo it in ItemOutVo.ItemListVo) { itemDatatable.Rows.Add(it.ItemId, it.ItemCode); } ProcessFlowRuleVo proceesFlowRuleVo = (ProcessFlowRuleVo)base.InvokeCbm(new GetProcessFlowRuleMasterMntCbm(), new ProcessFlowRuleVo(), false); foreach (ProcessFlowRuleVo pf in proceesFlowRuleVo.ProcessFlowRuleListVo) { processFlowRuleDatatable.Rows.Add(pf.ProcessFlowRuleId, pf.Comment); } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ItemVo inVo = (ItemVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Delete From m_local_item"); sqlQuery.Append(" Where "); sqlQuery.Append(" item_id = :itemid "); sqlQuery.Append(" and factory_cd = :faccd ;"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterInteger("itemid", inVo.ItemId); sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode); ItemVo outVo = new ItemVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
/// <summary> /// selects item record for updation and show item form /// </summary> private void BindUpdateUserData() { int selectedrowindex = ItemData_dgv.SelectedCells[0].RowIndex; ItemVo selectedData = (ItemVo)ItemData_dgv.Rows[selectedrowindex].DataBoundItem; AddItemForm newAddForm = new AddItemForm(); newAddForm.CreateForm(CommonConstants.MODE_UPDATE, selectedData); newAddForm.ShowDialog(this); if (newAddForm.IntSuccess > 0) { messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); } else if (newAddForm.IntSuccess == 0) { messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ItemVo inVo = (ItemVo)arg; ItemVo outVo = new ItemVo(); StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Update m_local_item"); sqlQuery.Append(" Set "); sqlQuery.Append(" item_name = :itemname, "); sqlQuery.Append(" unit_type = :unittype "); sqlQuery.Append(" Where "); sqlQuery.Append(" item_id = :itemid ;"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterInteger("itemid", inVo.ItemId); sqlParameter.AddParameterString("itemname", inVo.ItemName); sqlParameter.AddParameterInteger("unittype", inVo.UnitType); //execute SQL outVo.AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter); return(outVo); }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { return; } tabControl2.SelectedIndex = 1; ItemVo updateItem = ItemList.Find(x => x.Item_Code == dgvSearchResult.SelectedRows[0].Cells[1].Value.ToString()); txtUpCode.Text = updateItem.Item_Code; txtUpName.Text = updateItem.Item_Name; txtUpEnName.Text = updateItem.Item_Name_Eng; txtUpEngAbb.Text = updateItem.Item_Name_Eng_Alias; cmbInType.Text = updateItem.Item_Type; txtUpSpec.Text = updateItem.Item_Spec; txtUpUnit.Text = updateItem.Item_Unit; nuUpIron.Value = updateItem.IronUPH; nuUpRolling.Value = updateItem.RollingUPH; nuUpSteel.Value = updateItem.SteelUPH; nuUpPack.Value = updateItem.PackageUPH; txtUpRemark.Text = updateItem.Remark; // cmbUpLvl1.Text = updateItem.Level_1; // cmbUpLvl2.Text = updateItem.Level_2; // cmbUpLvl3.Text = updateItem.Level_3; //cmbUpLvl4.Text = updateItem.Level_4; //cmbUpLvl5.Text = updateItem.Level_5; //txtUpCavity.Text = updateItem.Cavity.ToString(); //nuUpLine.Value = updateItem.Line_Per_Qty; //nuUpShot.Value = updateItem.Shot_Per_Qty; //nuUpGVQty.Value = updateItem.Dry_GV_Qty; //nuUpProQty.Value = updateItem.PrdQty_Per_Hour; //nuUpPerQty.Value = updateItem.PrdQTy_Per_Batch; //txtUpRemark.Text = updateItem.Remark; }
public void Sell(ItemVo vo) { StaticItemVo staticVo = StaticDataPool.Instance.staticItemPool.GetStaticDataVo(vo.id); Remove(vo); DataManager.Instance.roleVo.exp += staticVo.price; GameRoot.Instance.evt.CallEvent(GameEventDefine.ROLE_INFO, null); }
public AddItemForm CreateForm(string pmode, ItemVo dataItem = null) { mode = pmode; updateData = dataItem; return(new AddItemForm()); }
/// <summary> /// inserts/updates item details /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void Ok_btn_Click(object sender, EventArgs e) { if (CheckMandatory()) { ItemVo inVo = new ItemVo { ItemCode = ItemCode_txt.Text, ItemName = ItemName_txt.Text, UnitType = Convert.ToInt32(UnitType_cmb.SelectedValue), //RegistrationDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), RegistrationUserCode = UserData.GetUserData().UserCode, FactoryCode = UserData.GetUserData().FactoryCode }; if (string.Equals(mode, CommonConstants.MODE_ADD)) { ItemVo checkVo = DuplicateCheck(inVo); if (checkVo != null && checkVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, ItemCode_lbl.Text + " : " + ItemCode_txt.Text); logger.Info(messageData); popUpMessage.ApplicationError(messageData, Text); return; } } try { if (string.Equals(mode, CommonConstants.MODE_ADD)) { ItemVo outVo = (ItemVo)base.InvokeCbm(new AddItemMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } else if (mode.Equals(CommonConstants.MODE_UPDATE)) { inVo.ItemId = updateData.ItemId; ItemVo outVo = (ItemVo)base.InvokeCbm(new UpdateItemMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } if ((IntSuccess > 0) || (IntSuccess == 0)) { this.Close(); } } }
/// <summary> /// For setting selected user record into respective controls(textbox and combobox) for update operation /// passing selected user data as parameter /// </summary> /// <param name="dgvData"></param> private void LoadUserData(ItemVo dgvData) { if (dgvData != null) { ItemCode_txt.Text = dgvData.ItemCode; ItemName_txt.Text = dgvData.ItemName; UnitType_cmb.SelectedValue = dgvData.UnitType.ToString(); } }
public void Remove(ItemVo vo) { if (vo.num > 1) { vo.num--; } else { vo.num--; _dataList.Remove(vo); } }
public void Load(string str) { string[] arr = str.Split('|'); for (int i = 0; i < arr.Length; i++) { if (arr[i] != "") { ItemVo itemVo = new ItemVo(); itemVo.Update(arr[i]); _dataList.Add(itemVo); } } }
public void Create(ItemVo itemVo, CallBackFunctionWithInt callback) { if (itemVo.num <= 0) { Destroy(gameObject); } this.callback = callback; this.itemVo = itemVo; staticItemVo = StaticDataPool.Instance.staticItemPool.GetStaticDataVo(itemVo.id); textName.text = staticItemVo.name; textDesc.text = staticItemVo.desc; textNum.text = "X" + itemVo.num; icon.sprite = ResourceManager.Instance.GetItemIcon(staticItemVo.icon); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ItemVo inVo = (ItemVo)arg; ItemVo outVo = new ItemVo(); StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Insert into m_local_item"); sqlQuery.Append(" ( "); sqlQuery.Append(" item_cd, "); sqlQuery.Append(" item_name, "); sqlQuery.Append(" unit_type,"); sqlQuery.Append(" registration_user_cd, "); sqlQuery.Append(" registration_date_time, "); sqlQuery.Append(" factory_cd "); sqlQuery.Append(" ) "); sqlQuery.Append("VALUES "); sqlQuery.Append(" ( "); sqlQuery.Append(" :itemcode ,"); sqlQuery.Append(" :itemname ,"); sqlQuery.Append(" :unittype ,"); sqlQuery.Append(" :registrationusercode ,"); sqlQuery.Append(" :registrationdatetime ,"); sqlQuery.Append(" :factorycode "); sqlQuery.Append(" ) returning item_id "); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("itemcode", inVo.ItemCode); sqlParameter.AddParameterString("itemname", inVo.ItemName); sqlParameter.AddParameterInteger("unittype", inVo.UnitType); sqlParameter.AddParameterString("registrationusercode", UserData.GetUserData().UserCode); sqlParameter.AddParameterDateTime("registrationdatetime", trxContext.ProcessingDBDateTime); sqlParameter.AddParameterString("factorycode", UserData.GetUserData().FactoryCode); outVo.ItemId = (int?)sqlCommandAdapter.ExecuteScalar(sqlParameter) ?? 0; if (outVo.ItemId > 0) { outVo.AffectedCount = 1; } return(outVo); }
/// <summary> /// To idenctify the relation ship with tables /// </summary> private ItemVo CheckItemRelation(ItemVo inVo) { ItemVo outVo = new ItemVo(); try { outVo = (ItemVo)base.InvokeCbm(new CheckItemRelationCbm(), inVo, false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } return(outVo); }
/// <summary> /// Creates seacrh condition as per user inputs /// </summary> /// <returns>search condition</returns> private ItemVo FormConditionVo() { ItemVo inVo = new ItemVo(); if (ItemCode_txt.Text != string.Empty) { inVo.ItemCode = ItemCode_txt.Text; } if (ItemName_txt.Text != string.Empty) { inVo.ItemName = ItemName_txt.Text; } return(inVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ItemVo inVo = (ItemVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("select itm.item_cd, ipw.item_process_work_id as ItmProcessId, "); sqlQuery.Append(" mtype.mold_type_id as MldTypeId from m_local_item itm "); sqlQuery.Append(" left outer join m_item_process_work ipw on itm.item_id = ipw.item_id "); sqlQuery.Append(" left outer join m_mold_type mtype on itm.item_id = mtype.item_id "); sqlQuery.Append(" where itm.factory_cd = :faccd "); if (inVo.ItemCode != null) { sqlQuery.Append(" and UPPER(item_cd) = UPPER(:itemcd)"); } //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode); if (inVo.ItemCode != null) { sqlParameter.AddParameterString("itemcd", inVo.ItemCode); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); ItemVo outVo = new ItemVo(); while (dataReader.Read()) { outVo.ItemProcessWorkId = Convert.ToInt32("0" + dataReader["ItmProcessId"]); outVo.MoldTypeId = Convert.ToInt32("0" + dataReader["MldTypeId"]); } dataReader.Close(); return(outVo); }
private void btnInsert_Click(object sender, EventArgs e) { if (txtInCode.Text == "") { // frm.lblAlertTitle.Text = "<경고>"; frm.lblAlert.ForeColor = Color.Red; return; } ItemVo item = new ItemVo { Item_Code = txtInCode.Text, Item_Name = txtInName.Text, Item_Name_Eng = txtUpEngName.Text, Item_Name_Eng_Alias = txtEngAli.Text, Item_Type = cmbInType.Text, Item_Spec = txtInSpec.Text, Item_Unit = txtInUnit.Text, //Level_1 = cmbLv1.Text, // Level_2 = cmbLv2.Text, // Level_3 = cmbLv3.Text, // Level_4 = cmbLv4.Text, // Level_5 = cmbLv5.Text, IronUPH = Convert.ToDecimal(nuInsIron.Value), RollingUPH = Convert.ToDecimal(nuInsRolling.Value), SteelUPH = Convert.ToDecimal(nuInsSteel.Value), PackageUPH = Convert.ToDecimal(nuInsPackage.Value), //Cavity = int.Parse(txtInCavity.Text), // Line_Per_Qty = Convert.ToInt32(nuLinePCS.Value), // Dry_GV_Qty = Convert.ToInt32(nuInGVQty.Value), //Heat_GV_Qty = Convert.ToInt32(nuInGVQty.Value), Remark = txtInremark.Text }; ItemService service = new ItemService(); if (service.InsertItemInfo(item)) { MessageBox.Show("아이템 정보를 입력하였습니다"); } else { MessageBox.Show("입력 실패다"); } }
public void Add(StaticItemVo vo) { if (_dataList.Count >= DataManager.Instance.roleVo.maxItemNum) { return; } ItemVo itemVo = _dataList.Find(p => p.id == vo.id); if (itemVo != null) { itemVo.num++; } else { ItemVo newItem = new ItemVo(); newItem.id = vo.id; newItem.num = 1; _dataList.Add(newItem); } }
override public void Read(string str) { List <object> jsons = Json.Deserialize(str) as List <object>; for (int i = 0; i < jsons.Count; i++) { Dictionary <string, object> data = jsons[i] as Dictionary <string, object>; ItemVo vo = new ItemVo(); vo.Id = uint.Parse((string)data["Id"]); vo.Name = uint.Parse((string)data["Name"]); vo.Description = uint.Parse((string)data["Description"]); vo.Type = uint.Parse((string)data["Type"]); vo.SubType = uint.Parse((string)data["SubType"]); vo.ItemResources = (string)data["ItemResources"]; vo.ItemIcon = (string)data["ItemIcon"]; vo.ParamValue = (string)data["ParamValue"]; items.Add(vo.Id.ToString(), vo); } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ItemVo inVo = (ItemVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Select Count(*) as ItemCount from m_local_item "); sqlQuery.Append(" where factory_cd = :faccd "); if (inVo.ItemCode != null) { sqlQuery.Append(" and UPPER(item_cd) = UPPER(:itemcd)"); } //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode); if (inVo.ItemCode != null) { sqlParameter.AddParameterString("itemcd", inVo.ItemCode); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); ItemVo outVo = new ItemVo(); while (dataReader.Read()) { outVo.AffectedCount = Convert.ToInt32(dataReader["ItemCount"]); } dataReader.Close(); return(outVo); }
/// <summary> /// Insert item information into item table for display in combo box /// </summary> private void InsertItemInformationIntoItemtable() { itemDatatable = new DataTable(); itemDatatable.Columns.Add("id"); itemDatatable.Columns.Add("code"); try { ItemVo itemOutVo = (ItemVo)base.InvokeCbm(new GetItemMasterMntCbm(), new ItemVo(), false); foreach (ItemVo item in itemOutVo.ItemListVo) { itemDatatable.Rows.Add(item.ItemId, item.ItemCode); } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } }
public void Use(ItemVo itemVo) { StaticItemVo staticVo = StaticDataPool.Instance.staticItemPool.GetStaticDataVo(itemVo.id); switch (staticVo.type) { case 0: break; case 1: break; case 2: if (DataManager.Instance.skillModel._dataList.Find(p => p.id == itemVo.id) == null) { DataManager.Instance.skillModel.Add(StaticDataPool.Instance.staticSkillPool.GetStaticDataVo(int.Parse(staticVo.param1))); Remove(itemVo); } break; } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ItemVo inVo = (ItemVo)arg; StringBuilder sqlQuery = new StringBuilder(); //create SQL sqlQuery.Append("Select li.item_id, li.item_cd, li.item_name,li.unit_type, "); sqlQuery.Append(" CASE li.unit_type WHEN '1' THEN 'Weight'"); sqlQuery.Append(" WHEN '0' THEN 'Count' End as unittype_value "); sqlQuery.Append("from m_local_item li "); sqlQuery.Append(" where li.factory_cd = :faccd "); if (inVo.ItemCode != null) { sqlQuery.Append(" and item_cd like :itemcd "); } if (inVo.ItemName != null) { sqlQuery.Append(" and item_name like :itemname "); } sqlQuery.Append(" order by item_cd "); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); if (!string.IsNullOrEmpty(inVo.FactoryCode)) { sqlParameter.AddParameterString("faccd", inVo.FactoryCode); } else { sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode); } if (inVo.ItemCode != null) { sqlParameter.AddParameterString("itemcd", inVo.ItemCode + "%"); } if (inVo.ItemName != null) { sqlParameter.AddParameterString("itemname", inVo.ItemName + "%"); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); ValueObjectList <ItemVo> outVo = null; while (dataReader.Read()) { ItemVo currOutVo = new ItemVo(); currOutVo.ItemId = ConvertDBNull <Int32>(dataReader, "item_id"); currOutVo.ItemCode = ConvertDBNull <string>(dataReader, "item_cd"); currOutVo.ItemName = ConvertDBNull <string>(dataReader, "item_name"); currOutVo.UnitType = ConvertDBNull <Int32>(dataReader, "unit_type"); currOutVo.UnitType_Display = ConvertDBNull <string>(dataReader, "unittype_value"); if (outVo == null) { outVo = new ValueObjectList <ItemVo>(); } outVo.add(currOutVo); } dataReader.Close(); return(outVo); }
public ValueObject Execute(TransactionContext trxContext, ValueObject vo) { MoldItemVo inVo = (MoldItemVo)vo; ///global item add GlobalItemVo checkGlobalItemInVo = new GlobalItemVo(); checkGlobalItemInVo.GlobalItemCode = inVo.GlobalItemCode; GlobalItemVo checkGlobalItemOutVo = (GlobalItemVo)getGlobalItemMasterMntCbm.Execute(trxContext, checkGlobalItemInVo); GlobalItemVo globalItemOutVo = null; if (checkGlobalItemOutVo == null || checkGlobalItemOutVo.GlobalItemListVo == null || checkGlobalItemOutVo.GlobalItemListVo.Count == 0) { GlobalItemVo globalItemInVo = new GlobalItemVo(); globalItemInVo.GlobalItemCode = inVo.GlobalItemCode; globalItemInVo.GlobalItemName = inVo.GlobalItemCode; globalItemOutVo = (GlobalItemVo)addGlobalItemMasterMntCbm.Execute(trxContext, globalItemInVo); } else { globalItemOutVo = checkGlobalItemOutVo.GlobalItemListVo[0]; } ///local item add ItemVo checkLocalItemInVo = new ItemVo(); checkLocalItemInVo.ItemCode = inVo.LocalItemCode; ItemVo checkLocalItemOutVo = (ItemVo)getItemMasterMntCbm.Execute(trxContext, checkLocalItemInVo); ItemVo localItemOutVo = null; if (checkLocalItemOutVo == null || checkLocalItemOutVo.ItemListVo == null || checkLocalItemOutVo.ItemListVo.Count == 0) { ItemVo localItemInVo = new ItemVo(); localItemInVo.ItemCode = inVo.LocalItemCode; localItemInVo.ItemName = inVo.LocalItemCode; localItemOutVo = (ItemVo)addItemMasterMntCbm.Execute(trxContext, localItemInVo); } else { localItemOutVo = checkLocalItemOutVo.ItemListVo[0]; } GlobalLocalItemVo globalLocalItemInVo = new GlobalLocalItemVo(); globalLocalItemInVo.GlobalItemId = globalItemOutVo.GlobalItemId; globalLocalItemInVo.LocalItemId = localItemOutVo.ItemId; //check and add globallocalitem link table ValueObjectList <GlobalLocalItemVo> checkGlobalLocalItemVo = (ValueObjectList <GlobalLocalItemVo>)checkGlobalLocalItemMasterMntCbm.Execute(trxContext, globalLocalItemInVo); if (checkGlobalLocalItemVo == null || checkGlobalLocalItemVo.GetList() == null || checkGlobalLocalItemVo.GetList().Count == 0) { GlobalLocalItemVo moldItemOutVo = (GlobalLocalItemVo)addGlobalLocalItemMasterMntCbm.Execute(trxContext, globalLocalItemInVo); } inVo.GlobalItemId = globalItemOutVo.GlobalItemId; inVo.LocalItemId = localItemOutVo.ItemId; return(inVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ItemVo inVo = (ItemVo)arg; StringBuilder sqlQuery = new StringBuilder(); //create SQL sqlQuery.Append("Select li.item_id, li.item_cd, li.item_name,li.unit_type, "); sqlQuery.Append(" CASE li.unit_type WHEN '1' THEN 'Weight'"); sqlQuery.Append(" WHEN '0' THEN 'Count' End as unittype_value "); sqlQuery.Append("from m_local_item li "); sqlQuery.Append(" where 1 = 1 "); if (inVo.ItemCode != null) { sqlQuery.Append(" and item_cd like :itemcd "); } if (inVo.ItemName != null) { sqlQuery.Append(" and item_name like :itemname "); } sqlQuery.Append(" order by item_cd "); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); if (inVo.ItemCode != null) { sqlParameter.AddParameterString("itemcd", inVo.ItemCode + "%"); } if (inVo.ItemName != null) { sqlParameter.AddParameterString("itemname", inVo.ItemName + "%"); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); ItemVo outVo = new ItemVo(); while (dataReader.Read()) { ItemVo currOutVo = new ItemVo { ItemId = Convert.ToInt32(dataReader["item_id"]), ItemCode = dataReader["item_cd"].ToString(), ItemName = dataReader["item_name"].ToString(), UnitType = Convert.ToInt32(dataReader["unit_type"]), UnitType_Display = dataReader["unittype_value"].ToString() }; outVo.ItemListVo.Add(currOutVo); } dataReader.Close(); return(outVo); }
/// <summary> /// event to delete the selected record /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void Delete_btn_Click(object sender, EventArgs e) { int selectedrowindex = ItemData_dgv.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = ItemData_dgv.Rows[selectedrowindex]; messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, selectedRow.Cells["colItemCode"].Value.ToString()); logger.Info(messageData); DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text); if (dialogResult == DialogResult.OK) { ItemVo inVo = new ItemVo { ItemId = Convert.ToInt32(selectedRow.Cells["colItemId"].Value), }; inVo.ItemCode = selectedRow.Cells["colItemCode"].Value.ToString(); try { ItemVo outCountVo = CheckItemRelation(inVo); if (outCountVo != null) { StringBuilder message = new StringBuilder(); if (outCountVo.ItemProcessWorkId > 0) { message.Append(ItemRelationTables.ItemProcessWorkId); } if (outCountVo.MoldTypeId > 0) { if (message.Length > 0) { message.Append(" And "); } message.Append(ItemRelationTables.MoldTypeId); } if (message.Length > 0) { messageData = new MessageData("mmce00007", Properties.Resources.mmce00007, message.ToString()); popUpMessage.Information(messageData, Text); return; } } ItemVo outVo = (ItemVo)base.InvokeCbm(new DeleteItemMasterMntCbm(), inVo, false); if (outVo.AffectedCount > 0) { messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); } else if (outVo.AffectedCount == 0) { messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } } else if (dialogResult == DialogResult.Cancel) { //do something else } }