public ActionResult TicketClose(int Id) { if (!chkSesionUser()) { return(RedirectToAction("Login", "Login", new { returnUrl = "~/Ticket/Index" })); } data_userDataContext Con = new data_userDataContext(); var User = (from xx in Con.MAS_USERs join yy in Con.MAS_DEPs on xx.D_ID equals yy.DP_ID where xx.STCODE == userOnline select new { xx, yy }).FirstOrDefault(); using (DB_LEDataContext Context = new DB_LEDataContext()) { var insert_Close = Context.TASK_MAINs.Where(s => s.ID == Id).FirstOrDefault(); //insert_Close.CLOSE_NAME = User.xx.FNAME + " " + User.xx.LNAME; //insert_Close.CLOSE_DATE = DateTime.Now; //insert_Close.APPROVE_ID = 4; insert_Close.STATUS = "3"; Context.SubmitChanges(); } return(RedirectToAction("TicketDetail", "Ticket", new { TicketId = Id })); }
public ActionResult CreateTicket(TicketModel newItem) { if (!chkSesionUser()) { return(RedirectToAction("Login", "Login", new { returnUrl = "~/Ticket/Index" })); } string tketNo = ticketNo(); using (DB_LEDataContext Context = new DB_LEDataContext()) { TASK_MAIN Insert_Main = new TASK_MAIN(); CultureInfo us = CultureInfo.GetCultureInfo("en-US"); //System.Globalization.CultureInfo cultureinfo = new System.Globalization.CultureInfo("nl-NL"); DateTime dt = DateTime.Parse(newItem.Add.TicketSdate.ToString(), us); Insert_Main.TICKETNO = tketNo; Insert_Main.TITLE = newItem.Add.TicketName; Insert_Main.DETAIL = newItem.Add.Detail; Insert_Main.CREATEDATE = DateTime.Now; Insert_Main.CREATECODE = userOnline; Insert_Main.S_DATE = DateTime.Parse(newItem.Add.TicketSdate.ToString(), us); Insert_Main.E_DATE = DateTime.Parse(newItem.Add.TicketFdate.ToString(), us); Insert_Main.STCODE = userOnline; Insert_Main.STATUS = "3"; Insert_Main.FLAG = "1"; //Insert_Main.APPROVE_ID = 1; Context.TASK_MAINs.InsertOnSubmit(Insert_Main); Context.SubmitChanges(); //var sql = (from xx in Context.TASK_MAINs // where xx.TICKETNO == tketNo // select xx).FirstOrDefault(); //var doc = from xx in Context.MAS_DOCs // select xx; //int i = 0; //foreach (var item in doc) //{ // TASK_SUB Insert_Sub = new TASK_SUB(); // if (newItem.GetCheck[i].Checked == true) // { // Insert_Sub.LE_ID = sql.ID; // Insert_Sub.DOC_ID = newItem.GetCheck[i].ID; // Insert_Sub.DETAIL_SUB = newItem.GetCheck[i].NAME; // Context.TASK_SUBs.InsertOnSubmit(Insert_Sub); // Context.SubmitChanges(); // } // i++; //} } return(RedirectToAction("Index", "Ticket")); }
public ActionResult Delete(int Id) { try { using (DB_LEDataContext Context = new DB_LEDataContext()) { var sql_Main = Context.TASK_MAINs.Where(s => s.ID == Id).FirstOrDefault(); sql_Main.STATUS = "1"; sql_Main.FLAG = "0"; Context.SubmitChanges(); } } catch { } return(RedirectToAction("Index", "Ticket")); }