public string Insert_T12207(t12207 t12207, string user, string siteCode) { var data = ""; try { data = obj.Insert_T12207(t12207, user, siteCode); } catch (Exception e) { MethodBase m = MethodBase.GetCurrentMethod(); obj.Log(m.ReflectedType.Name + "." + m.Name, "1", e.Message); } return(data); //var data = obj.Insert_T12207(t12207, user, siteCode); //return data; }
public ActionResult Insert_T12207(t12207 t12207) { try { var user = Session["T_EMP_CODE"].ToString(); //var siteCode = Session["T_SITE_CODE"].ToString(); var siteCode = Session["T_REFERRAL_CODE"].ToString(); var data = repository.Insert_T12207(t12207, user, siteCode); string JSONString = string.Empty; JSONString = JsonConvert.SerializeObject(data); return(Json(JSONString, JsonRequestBehavior.AllowGet)); } catch (Exception e) { err.SetServerErrorLog(ControllerContext.RouteData.Values["controller"].ToString(), ControllerContext.RouteData.Values["action"].ToString(), Session["T_ENTRY_USER"] == null ? "" : Session["T_ENTRY_USER"].ToString(), e.Message); return(Json(e.Message, JsonRequestBehavior.AllowGet)); } }
public string Insert_T12207(t12207 t12207, string user, string siteCode) { string msg = ""; int count = Query($"SELECT T_BLOOD_REQNO FROM T12065 WHERE T_SITE_CODE='{siteCode}' and T_BLOOD_REQNO = '{t12207.T_BLOOD_REQNO}'").Rows.Count; var max = Query($"SELECT LPAD(NVL(MAX(T_BLOOD_REQNO),0)+1,7,0) T_BLOOD_REQNO FROM T12065 WHERE T_SITE_CODE='{siteCode}'"); var maxbloodReqNo = max.Rows[0]["T_BLOOD_REQNO"]; BeginTransaction(); if (count == 0) { if (Command($"INSERT INTO T12065(T_ENTRY_USER,T_ENTRY_DATE,T_BLOOD_REQNO,T_BLOOD_REQDATE,T_BLOOD_REQTIME,T_REF_HOSP,T_BLOOD_GRP,T_PRODUCT_CODE,T_NUM_UNIT,T_CROSSMATCH_FLAG,T_SITE_CODE,T_REQUEST_STATUS) VALUES ('{user}', TRUNC(SYSDATE), '{maxbloodReqNo}', TRUNC(SYSDATE), TO_CHAR(SYSDATE,'HH24MI'), '{t12207.T_REF_HOSP}','{t12207.T_BLOOD_GRP}','{t12207.T_PRODUCT_CODE}','{t12207.T_NUM_UNIT}','{t12207.T_CROSSMATCH_FLAG}','{siteCode}','1')")) { CommitTransaction(); msg = "N0040"; } else { RollbackTransaction(); msg = "N0071"; } } else { if (Command( $"UPDATE T12065 SET T_UPD_USER='******',T_UPD_DATE=TRUNC(SYSDATE),T_BLOOD_REQDATE=TRUNC(SYSDATE),T_BLOOD_REQTIME=TO_CHAR(SYSDATE,'HH24MI'), T_REF_HOSP='{t12207.T_REF_HOSP}',T_BLOOD_GRP='{t12207.T_BLOOD_GRP}',T_PRODUCT_CODE='{t12207.T_PRODUCT_CODE}',T_NUM_UNIT='{t12207.T_NUM_UNIT}',T_CROSSMATCH_FLAG='{t12207.T_CROSSMATCH_FLAG}' WHERE T_BLOOD_REQNO='{t12207.T_BLOOD_REQNO}' AND T_SITE_CODE='{siteCode}'")) { CommitTransaction(); msg = "N0041"; } else { RollbackTransaction(); msg = "N0072"; } } return(msg); }