public ActionResult DayPlan(DayPlans dayView) { try { string strReq = ""; string[] arrMsgs; strReq = Request.Url.Query; strReq = strReq.Substring(strReq.IndexOf('?') + 1); if (strReq != null) { arrMsgs = strReq.Split('?'); } Session["Empcd"] = strReq; ListPlans lst = new ListPlans(); dayView.Empcd = EncryDecry.Decrypt(Session["Empcd"].ToString()).Replace("Empcd=", ""); dayView.Date = DateTime.Today.ToString("dd/MM/yyyy"); var Get_Plans = _WPO.GetDayPlanss(dayView); lst.DayPlan = Get_Plans; return(View(lst)); } catch (Exception ex) { return(null); } }
public List <DayPlans> GetPopupRecords(DayPlans obj) { try { List <DayPlans> model = new List <DayPlans>(); DataSet ds = GetPopupRecord(obj); //Description Start End Empcd foreach (DataRow dr in ds.Tables[0].Rows) { DayPlans dt = new DayPlans(); dt.Start = dr["StartTime"].ToString(); dt.End = dr["EndTime"].ToString(); dt.Description = dr["Description"].ToString(); dt.Empcd = dr["Empcd"].ToString(); dt.EventID = Convert.ToInt32(dr["EventID"]); dt.Date = dr["insertdate"].ToString(); model.Add(dt); } return(model); } catch (Exception) { return(null); } }
//Display records in popup model public DataSet GetPopupRecord(DayPlans obj) { SqlConnection con = new SqlConnection(strConnLive); try { con.Open(); SqlCommand cmd = new SqlCommand("HRAlign_Inland.dbo.Usp_WeeklyPlanCalender", con); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter sda = new SqlDataAdapter(cmd); cmd.Parameters.AddWithValue("@mode", "GetPopUpRecords"); cmd.Parameters.AddWithValue("@Empcd", obj.Empcd); DataSet ds = new DataSet(); sda.Fill(ds); return(ds); } catch (Exception ex) { return(null); } finally { con.Close(); } }
//Insert plans in entry page public List <DayPlans> DayPlanInsert(DayPlans obj) { SqlConnection con = new SqlConnection(strConnLive); try { DateTime.ParseExact(obj.Date.ToString(), "yyyy-MM-dd", CultureInfo.InvariantCulture) .ToString("dd/MM/yyyy", CultureInfo.InvariantCulture); string result = string.Empty; con.Open(); SqlCommand cmd = new SqlCommand("HRAlign_Inland.dbo.Usp_WeeklyPlanCalender", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@mode", "DaydataInsert"); cmd.Parameters.AddWithValue("@eventdate", obj.Date); cmd.Parameters.AddWithValue("@Start", obj.Start); cmd.Parameters.AddWithValue("@End", obj.End); cmd.Parameters.AddWithValue("@Description", obj.Description); cmd.Parameters.AddWithValue("@Empcd", obj.Empcd); int i = cmd.ExecuteNonQuery(); return(GetDayPlanss(obj)); } catch (Exception ex) { return(null); } finally { con.Close(); } }
//Insert dayplans in popup model public string DayPlanList(DayPlans obj) { SqlConnection con = new SqlConnection(strConnLive); try { string result = string.Empty; con.Open(); SqlCommand cmd = new SqlCommand("HRAlign_Inland.dbo.Usp_WeeklyPlanCalender", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@mode", "WorksheetInsert"); cmd.Parameters.AddWithValue("@eventdate", obj.Date); cmd.Parameters.AddWithValue("@Start", obj.Start); cmd.Parameters.AddWithValue("@End", obj.End); cmd.Parameters.AddWithValue("@Description", obj.Description); cmd.Parameters.AddWithValue("@Empcd", obj.Empcd); int i = cmd.ExecuteNonQuery(); return(result); } catch (Exception ex) { return(null); } finally { con.Close(); } }
public ActionResult DayPlansInsert(DayPlans obj, FormCollection frms) { obj.Date = frms["date"]; obj.Start = frms["From"]; obj.End = frms["To"]; obj.Description = frms["Description"]; obj.Empcd = EncryDecry.Decrypt(Session["Empcd"].ToString()).Replace("Empcd=", ""); _WPO.DayPlanList(obj); //ViewBag.PopRecords = _WPO.GetPopupRecord(obj); //ListPlans lst1 = new ListPlans(); return(Redirect("https://localhost:44382/DayWise/DayPlan?s2o+vZQxoM0UHPZVdQPaCA==")); }
public ActionResult DayPlan(DayPlans dayView, FormCollection frms) { try { string strReq = ""; strReq = Session["Empcd"].ToString(); string[] arrEmpcd; string[] arrMsgs; strReq = strReq.Replace("%2f", "/"); strReq = strReq.Replace("%3F", ""); strReq = strReq.Replace("%2F", "/"); strReq = strReq.Replace("%2B", "+"); strReq = EncryDecry.Decrypt(strReq); if (strReq != null) { arrMsgs = strReq.Split('&'); } else { arrMsgs = null; } arrEmpcd = arrMsgs[0].Split('='); string emp = arrEmpcd[1].ToString().Trim(); dayView.Start = frms["From"]; dayView.End = frms["To"]; dayView.Description = frms["Description"]; dayView.Empcd = emp; ListPlans lst1 = new ListPlans(); var Get_Plans1 = _WPO.DayPlanInsert(dayView); lst1.DayPlan = Get_Plans1; return(View(lst1)); } catch (Exception ex) { return(null); } }
public ActionResult SHOW() { try { if (Request.Form["ShowPlans"] != null) { string principle = Convert.ToString(Request["date"].ToString()); DayPlans dayPlans = new DayPlans(); dayPlans.Empcd = Session["Empcd"].ToString(); dayPlans.Date = principle; var getHistory = _WPO.GetDayPlanss(dayPlans); } ListPlans lst1 = new ListPlans(); return(View(lst1)); } catch (Exception ex) { return(null); } }