public ActionResult BaseCurrencyView(string seqNo, string Msg) { //권한 체크=================================================== if (!chk.chkPermission("BaseCurrency", "PER_SELECT")) { return(RedirectToAction("Index", "Home", new { msg = chk.alertStr })); } //=========================================================== BaseCurrencyModels model = new BaseCurrencyModels(); int pSeqNo = 0; if (int.TryParse(seqNo, out pSeqNo)) { model.act_type = "updt"; model.act_key = pSeqNo; } else { model.act_type = "ins"; model.Item.SEQNO = 0; } if (!String.IsNullOrEmpty(Msg)) { ViewBag.PublicPopupMsg = Msg; } model.Item = act.GetBaseCurrencyView(pSeqNo); return(View(model)); }
public ActionResult BaseCurrencyView(BaseCurrencyModels model) { if (model.act_type == "ins") { //권한 체크=================================================== if (!chk.chkPermission("BaseCurrency", "PER_INSERT")) { return(RedirectToAction("BaseCurrencyView", new { msg = chk.alertStr })); } //=========================================================== } if (model.act_type == "updt") { //권한 체크=================================================== if (!chk.chkPermission("BaseCurrency", "PER_UPDATE")) { return(RedirectToAction("BaseCurrencyView", new { msg = chk.alertStr })); } //=========================================================== } string PublicPopupMsg = act.setBaseCurrency(model); return(RedirectToAction("BaseCurrencyView", new { seqNo = model.act_key, Msg = PublicPopupMsg })); }
public string setAMNTList(BaseCurrencyModels model) { string errorStr = ""; string result = ""; string exeQueryStr = ""; List <string> exeQueryList = new List <string>(); foreach (var item in model.Items) { exeQueryStr = " INSERT INTO conf_exchange_rate ( CURRENCY_UNIT, AMNT)VALUES( "; exeQueryStr += "'" + item.CURRENCY_UNIT + "'"; exeQueryStr += ", " + item.AMNT + ""; exeQueryStr += " ) "; exeQueryList.Add(exeQueryStr); } result = "실패."; if (exeQuery(exeQueryList, out errorStr)) { result = "성공."; } return(result); }
public JsonResult GetExchangeRate() { BaseCurrencyModels model = new BaseCurrencyModels(); model = act.GetBaseCurrencyList(); double basicUnt = 0; foreach (var item in model.Items) { basicUnt = item.BASIC_UNIT * 100; item.AMNT = comModel.GetExchangeRate_ExRateOrg(item.CURRENCY_UNIT, "KRW", Convert.ToInt32(basicUnt)); // EXCHANGE-RATES.ORG 환율 가져오기 } return(Json(model.Items)); }
public ActionResult BaseCurrency(BaseCurrencyModels model) { //권한 체크=================================================== if (!chk.chkPermission("BaseCurrency", "PER_SELECT")) { return(RedirectToAction("Index", "Home", new { msg = chk.alertStr })); } //=========================================================== //환율 일괄 저장일 경우 if (model.act_type == "set_AMNT") { //권한 체크=================================================== if (!chk.chkPermission("BaseCurrency", "PER_INSERT")) { return(RedirectToAction("basecurrency", new { msg = chk.alertStr })); } //=========================================================== TempData["PublicMsg"] = act.setAMNTList(model); //삭제 model.act_type = "list"; model.act_key = 0; return(RedirectToAction("BaseCurrency", model)); } //삭제일 경우 if (model.act_type == "del") { //권한 체크=================================================== if (!chk.chkPermission("BaseCurrency", "PER_DELETE")) { return(RedirectToAction("basecurrency", new { msg = chk.alertStr })); } //=========================================================== TempData["PublicMsg"] = act.delBaseCurrency(model.act_key); //삭제 model.act_type = "list"; model.act_key = 0; return(RedirectToAction("BaseCurrency", model)); } model = act.GetBaseCurrencyList(); return(View(model)); }
//Base 통화 관리 ================================================================================================= // GET: Base 통화 관리 public ActionResult BaseCurrency(string msg) { //권한 체크=================================================== if (!chk.chkPermission("BaseCurrency", "PER_SELECT")) { return(RedirectToAction("Index", "Home", new { msg = chk.alertStr })); } //=========================================================== TempData["PublicMsg"] = null; if (!string.IsNullOrEmpty(msg)) { TempData["PublicMsg"] = msg; } BaseCurrencyModels model = new BaseCurrencyModels(); model = act.GetBaseCurrencyList(); return(View(model)); }
public BaseCurrencyModels GetBaseCurrencyList() { string errorStr = ""; string listQuery = " SELECT cc.SEQNO ,cc.CURRENCY_UNIT ,BASIC_UNIT ,MEMO ,AMNT ,DATETIME_UPD FROM conf_currency cc left outer join "; listQuery += " (SELECT CURRENCY_UNIT, AMNT, DATETIME_UPD FROM conf_exchange_rate "; listQuery += " WHERE SEQNO in (SELECT max(SEQNO) FROM conf_exchange_rate GROUP BY CURRENCY_UNIT )) cer"; listQuery += " on cc.CURRENCY_UNIT = cer.CURRENCY_UNIT order by cc.SEQNO"; DataTable listDt = getQueryResult(listQuery, out errorStr); BaseCurrencyModels model = new BaseCurrencyModels(); if (listDt != null && listDt.Rows.Count != 0) { for (int i = 0; i < listDt.Rows.Count; i++) { ConfCurrency temp = new ConfCurrency(); temp.SEQNO = int.Parse(listDt.Rows[i]["SEQNO"].ToString().Trim()); temp.CURRENCY_UNIT = listDt.Rows[i]["CURRENCY_UNIT"].ToString().Trim(); if (listDt.Rows[i]["BASIC_UNIT"].ToString().Trim() != "") { temp.BASIC_UNIT = Convert.ToDouble(listDt.Rows[i]["BASIC_UNIT"].ToString().Trim()); } temp.MEMO = listDt.Rows[i]["MEMO"].ToString().Trim(); if (listDt.Rows[i]["AMNT"].ToString().Trim() != "") { temp.AMNT = Convert.ToDouble(listDt.Rows[i]["AMNT"].ToString().Trim()); } temp.DATETIME_UPD = listDt.Rows[i]["DATETIME_UPD"].ToString().Trim(); model.Items.Add(temp); } } return(model); }
public string setBaseCurrency(BaseCurrencyModels model) { string errorStr = ""; string result = ""; string exeQueryStr = ""; List <string> exeQueryList = new List <string>(); if (model.act_type != null && model.act_type == "ins") { exeQueryStr = " INSERT INTO conf_currency ( CURRENCY_UNIT, BASIC_UNIT, MEMO )VALUES( "; exeQueryStr += "'" + model.Item.CURRENCY_UNIT + "'"; exeQueryStr += ", " + model.Item.BASIC_UNIT + ""; exeQueryStr += ", '" + model.Item.MEMO + "'"; exeQueryStr += " ) "; exeQueryList.Add(exeQueryStr); exeQueryStr = " INSERT INTO conf_exchange_rate ( CURRENCY_UNIT, AMNT)VALUES( "; exeQueryStr += "'" + model.Item.CURRENCY_UNIT + "'"; exeQueryStr += ", " + model.Item.AMNT + ""; exeQueryStr += " ) "; exeQueryList.Add(exeQueryStr); } else if (model.act_type != null && model.act_type == "updt") { exeQueryStr = " UPDATE conf_currency SET "; exeQueryStr += " CURRENCY_UNIT = '" + model.Item.CURRENCY_UNIT + "'"; exeQueryStr += ", BASIC_UNIT = '" + model.Item.BASIC_UNIT + "'"; exeQueryStr += ", MEMO = '" + model.Item.MEMO + "'"; exeQueryStr += " WHERE SEQNO = " + model.Item.SEQNO; exeQueryList.Add(exeQueryStr); exeQueryStr = " INSERT INTO conf_exchange_rate ( CURRENCY_UNIT, AMNT)VALUES( "; exeQueryStr += "'" + model.Item.CURRENCY_UNIT + "'"; exeQueryStr += ", " + model.Item.AMNT + ""; exeQueryStr += " ) "; exeQueryList.Add(exeQueryStr); } else { result = "잘못된 접근입니다."; return(result); } if (exeQuery(exeQueryList, out errorStr)) { result = "성공."; } //(msh)else 쿼리 추가 else { result = "실패."; } return(result); }