public ActionResult MAS090_GetInstrumentDetail(string InstrumentCode) { ObjectResultData res = new ObjectResultData(); try { IInstrumentMasterHandler hand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; dtInstrumentDetail detail = null; List <dtInstrumentDetail> list = hand.GetInstrumentDetail(InstrumentCode, MiscType.C_LINE_UP_TYPE, CurrencyUtil.C_CURRENCY_LOCAL, CurrencyUtil.C_CURRENCY_US); if (list.Count > 0) { detail = list[0]; MAS090_ScreenParameter MAS090Param = GetScreenObject <MAS090_ScreenParameter>(); if (detail.UpdateDate.HasValue) { MAS090Param.updateDate = detail.UpdateDate.Value; } } res.ResultData = detail; return(Json(res)); } catch (Exception ex) { res.AddErrorMessage(ex); return(null); } }
public ActionResult MAS090() { MAS090_ScreenParameter MAS090Param = new MAS090_ScreenParameter(); ViewBag.HasPermissionAdd = ""; ViewBag.HasPermissionEdit = ""; try { MAS090Param = GetScreenObject <MAS090_ScreenParameter>(); ViewBag.HasPermissionAdd = CheckUserPermission(ScreenID.C_SCREEN_ID_MAINTAIN_INSTRUMENT_INFO, FunctionID.C_FUNC_ID_ADD); ViewBag.HasPermissionEdit = CheckUserPermission(ScreenID.C_SCREEN_ID_MAINTAIN_INSTRUMENT_INFO, FunctionID.C_FUNC_ID_EDIT); ViewBag.InstrumentTypeGeneral = InstrumentType.C_INST_TYPE_GENERAL; } catch { } return(View()); }
public ActionResult MAS090_UpdateInstrument(MAS090_SaveInstrument instrument) { ObjectResultData res = new ObjectResultData(); try { #region Check system suspending res = checkSystemSuspending(); if (res.IsError) { return(Json(res)); } #endregion res.MessageType = MessageModel.MESSAGE_TYPE.WARNING; #region Validate require field ValidatorUtil validator = new ValidatorUtil(this); if (!instrument.SaleFlag.HasValue) { instrument.SaleFlag = false; } if (!instrument.RentalFlag.HasValue) { instrument.RentalFlag = false; } if (!instrument.InstrumentFlag.HasValue) { instrument.InstrumentFlag = false; } if (!instrument.ZeroBahtAssetFlag.HasValue) { instrument.ZeroBahtAssetFlag = false; } if (!instrument.MaintenanceFlag.HasValue) { instrument.MaintenanceFlag = false; } if (!instrument.ControllerFlag.HasValue) { instrument.ControllerFlag = false; } if (InstrumentType.C_INST_TYPE_GENERAL.Equals(instrument.InstrumentTypeCode)) { if (instrument.LineUpTypeCode == null) { validator.AddErrorMessage(MessageUtil.MODULE_MASTER, MAS090_Screen, MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, "RLineUpTypeCode", "lblLineUpType", "LineUpTypeCode"); } if (instrument.ExpansionTypeCode == null) { validator.AddErrorMessage(MessageUtil.MODULE_MASTER, MAS090_Screen, MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, "RExpansionTypeCode", "lblExpansionType", "ExpansionTypeCode"); } } ValidatorUtil.BuildErrorMessage(res, validator); if (res.IsError) { return(Json(res)); } #endregion #region If Have change expansion type instrument.currentExpansionTypeCode = instrument.currentExpansionTypeCode == "" ? null : instrument.currentExpansionTypeCode; IInstrumentMasterHandler hand = ServiceContainer.GetService <IInstrumentMasterHandler>() as IInstrumentMasterHandler; if ((instrument.currentExpansionTypeCode == null && instrument.ExpansionTypeCode != null) || (instrument.ExpansionTypeCode != null && !instrument.currentExpansionTypeCode.Equals(instrument.ExpansionTypeCode))) { List <bool?> listCheck = hand.CheckExistParentChild(instrument.InstrumentCode); if (listCheck[0].Value) { res.AddErrorMessage(MessageUtil.MODULE_MASTER, MessageUtil.MessageList.MSG1022); return(Json(res)); } } #endregion //instrument.UpdateBy = CommonUtil.dsTransData.dtUserData.EmpNo; //instrument.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime; MAS090_ScreenParameter MAS090Param = GetScreenObject <MAS090_ScreenParameter>(); instrument.UpdateDate = MAS090Param.updateDate; // add by Jirawat Jannet on 216-12-23 #region Set amount and currency type if (instrument.SaleUnitPriceCurrencyType == CurrencyUtil.C_CURRENCY_US) { instrument.SaleUnitPriceUsd = instrument.SaleUnitPrice; instrument.SaleUnitPrice = null; } else { instrument.SaleUnitPriceUsd = null; } if (instrument.RentalUnitPriceCurrencyType == CurrencyUtil.C_CURRENCY_US) { instrument.RentalUnitPriceUsd = instrument.RentalUnitPrice; instrument.RentalUnitPrice = null; } else { instrument.RentalUnitPriceUsd = null; } if (instrument.AddUnitPriceCurrencyType == CurrencyUtil.C_CURRENCY_US) { instrument.AddUnitPriceUsd = instrument.AddUnitPrice; instrument.AddUnitPrice = null; } else { instrument.AddUnitPriceUsd = null; } if (instrument.RemoveUnitPriceCurrencyType == CurrencyUtil.C_CURRENCY_US) { instrument.RemoveUnitPriceUsd = instrument.RemoveUnitPrice; instrument.RemoveUnitPrice = null; } else { instrument.RemoveUnitPriceUsd = null; } if (instrument.MoveUnitPriceCurrencyType == CurrencyUtil.C_CURRENCY_US) { instrument.MoveUnitPriceUsd = instrument.MoveUnitPrice; instrument.MoveUnitPrice = null; } else { instrument.MoveUnitPriceUsd = null; } #endregion List <tbm_Instrument> updatedList = hand.UpdateInstrument(instrument); if (updatedList.Count > 0) { res.ResultData = true; } } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }