public ActionResult Edit(TRN_EXPENSE trn_expense) { if (ModelState.IsValid) { db.TRN_EXPENSE_UPDATE(trn_expense.EXP_NO, decimal.Parse(Session["sess_USER_NO"].ToString()), decimal.Parse(Session["sess_LOGON_NO"].ToString()), DateTime.Now, null, 1, trn_expense.USER_NO, trn_expense.AGENT_USER_NO, trn_expense.TRN_EXP_DATE, trn_expense.APPROVE_TYPE_NO, trn_expense.APPROVE_TIME, trn_expense.APPROVE_USER_NO, trn_expense.APPROVE_LOGON_NO, trn_expense.REASON_NO, trn_expense.REAMRKS, trn_expense.IS_TRN_LOCKED, trn_expense.IS_LOCK_BY_SYSTEM, trn_expense.TRN_LOCK_DATE, trn_expense.TRN_LOCK_USER_NO, trn_expense.TRN_LOCK_LOGON_NO, trn_expense.IS_MANUAL_ENTRY, trn_expense.OFFLINE_EXP_NO); List <string> lstTmp = new List <string>(); foreach (string curSession in Session) { if (curSession.Contains("ExpenseEntry")) { lstTmp.Add(curSession); temp_TRN_EXPENSE_DET temp_sess_det = (temp_TRN_EXPENSE_DET)Session[curSession]; if (!temp_sess_det.set_deleted) { TRN_EXPENSE_DET dt = db.TRN_EXPENSE_DET.Where(s => s.EXP_DET_NO == temp_sess_det.editID).FirstOrDefault(); if (dt != null) { db.TRN_EXPENSE_DET_UPDATE(Convert.ToDecimal(temp_sess_det.editID), decimal.Parse(Session["sess_USER_NO"].ToString()), decimal.Parse(Session["sess_LOGON_NO"].ToString()), DateTime.Now, null, 1, trn_expense.EXP_NO, temp_sess_det.exp_type, temp_sess_det.amount, dt.APPROVE_EXP_TYPE_NO, dt.APPROVE_EXP_AMT, dt.APPROVE_TYPE_NO, dt.APPROVE_TIME, dt.APPROVE_USER_NO, dt.APPROVE_LOGON_NO, dt.REASON_NO, dt.REAMRKS, dt.OFFLINE_EXP_NO, dt.OFFLINE_EXP_DET_NO, dt.LAT_VAL, dt.LON_VAL, temp_sess_det.vendor, temp_sess_det.comments); } else { db.TRN_EXPENSE_DET_INSERT(decimal.Parse(Session["sess_USER_NO"].ToString()), decimal.Parse(Session["sess_LOGON_NO"].ToString()), DateTime.Now, null, 1, trn_expense.EXP_NO, temp_sess_det.exp_type, temp_sess_det.amount, null, null, null, null, temp_sess_det.vendor, temp_sess_det.comments); } } else { TRN_EXPENSE_DET dt = db.TRN_EXPENSE_DET.Where(s => s.EXP_DET_NO == temp_sess_det.editID).FirstOrDefault(); db.TRN_EXPENSE_DET_DELETE(dt.EXP_DET_NO, decimal.Parse(Session["sess_USER_NO"].ToString()), decimal.Parse(Session["sess_LOGON_NO"].ToString())); } } } return(RedirectToAction("Index")); } ViewBag.APPROVE_TYPE_NO = new SelectList(db.GEN_APPROVE_TYPE, "APPROVE_TYPE_NO", "APPROVE_TYPE", trn_expense.APPROVE_TYPE_NO); ViewBag.USER_NO = new SelectList(db.SEC_USERS, "USER_NO", "LAST_ACTION", trn_expense.USER_NO); ViewBag.FY_NO = new SelectList(db.SET_FISCAL_YEAR, "FY_NO", "LAST_ACTION", trn_expense.FY_NO); ViewBag.REASON_NO = new SelectList(db.SET_REASON, "REASON_NO", "LAST_ACTION", trn_expense.REASON_NO); return(View(trn_expense)); }
public JsonResult GetExpenseFromSession(string test) { temp_TRN_EXPENSE_DET tmpdet = (temp_TRN_EXPENSE_DET)Session["ExpenseEntry" + test]; SET_EXP_TYPE exptype = db.SET_EXP_TYPE.Where(s => s.EXP_TYPE_NO == tmpdet.exp_type).First(); return(Json(new { type = exptype.EXP_TYPE_NAME, amnt = tmpdet.amount, vendor = tmpdet.vendor, coment = tmpdet.comments, editid = tmpdet.editID })); }
/**Web service part * */ public JsonResult RemoveExpenseFromSession(string test) { temp_TRN_EXPENSE_DET tmpdet = (temp_TRN_EXPENSE_DET)Session["ExpenseEntry" + test]; tmpdet.set_deleted = true; Session["ExpenseEntry" + test] = tmpdet; return(Json(new { type = tmpdet.exp_type, amnt = tmpdet.amount, vendor = tmpdet.vendor, coment = tmpdet.comments, editid = tmpdet.editID })); }
public ActionResult Create(TRN_EXPENSE trn_expense) { if (ModelState.IsValid) { decimal id = db.TRN_EXPENSE_INSERT(decimal.Parse(Session["sess_USER_NO"].ToString()), decimal.Parse(Session["sess_LOGON_NO"].ToString()), DateTime.Now, null, 1, trn_expense.USER_NO, null, trn_expense.TRN_EXP_DATE, 1, null).FirstOrDefault().Value; List <string> lstTmp = new List <string>(); foreach (string curSession in Session) { if (curSession.Contains("ExpenseEntry")) { lstTmp.Add(curSession); temp_TRN_EXPENSE_DET temp_sess_det = (temp_TRN_EXPENSE_DET)Session[curSession]; if (!temp_sess_det.set_deleted) { db.TRN_EXPENSE_DET_INSERT(decimal.Parse(Session["sess_USER_NO"].ToString()), decimal.Parse(Session["sess_LOGON_NO"].ToString()), DateTime.Now, null, 1, id, temp_sess_det.exp_type, temp_sess_det.amount, null, null, null, null, temp_sess_det.vendor, temp_sess_det.comments); } } } foreach (string del in lstTmp) { Session.Remove(del); } return(RedirectToAction("Index")); } ViewBag.APPROVE_TYPE_NO = new SelectList(db.GEN_APPROVE_TYPE, "APPROVE_TYPE_NO", "APPROVE_TYPE", trn_expense.APPROVE_TYPE_NO); ViewBag.USER_NO = new SelectList(db.SEC_USERS, "USER_NO", "LAST_ACTION", trn_expense.USER_NO); ViewBag.FY_NO = new SelectList(db.SET_FISCAL_YEAR, "FY_NO", "LAST_ACTION", trn_expense.FY_NO); ViewBag.REASON_NO = new SelectList(db.SET_REASON, "REASON_NO", "LAST_ACTION", trn_expense.REASON_NO); return(View(trn_expense)); }
public JsonResult SaveExpenseOnSession(decimal ExpenseTypes, decimal txtamnt, string txtVendor, string txtComments, string sessName) { if (sessName == "") { if (Session["ExpenseEntry" + ExpenseTypes + "-" + txtamnt + "-" + txtVendor.Replace(" ", "")] == null) { Session["ExpenseEntry" + ExpenseTypes + "-" + txtamnt + "-" + txtVendor.Replace(" ", "")] = new temp_TRN_EXPENSE_DET(ExpenseTypes, txtamnt, txtVendor, txtComments); } else { temp_TRN_EXPENSE_DET tmp = (temp_TRN_EXPENSE_DET)Session["ExpenseEntry" + ExpenseTypes + "-" + txtamnt + "-" + txtVendor.Replace(" ", "")]; tmp.set_deleted = true; Session["ExpenseEntry" + ExpenseTypes + "-" + txtamnt + "-" + txtVendor.Replace(" ", "")] = tmp; } } else { temp_TRN_EXPENSE_DET tmp = (temp_TRN_EXPENSE_DET)Session["ExpenseEntry" + sessName]; tmp.set_deleted = true; Session["ExpenseEntry" + ExpenseTypes + "-" + txtamnt + "-" + txtVendor.Replace(" ", "")] = new temp_TRN_EXPENSE_DET(ExpenseTypes, txtamnt, txtVendor, txtComments); } return(Json(new { dt = ExpenseTypes + "-" + txtamnt })); }