private void DataExtract(MPOP_Dashboard.VoteOpeningandClosingEntry voc) { voc.VotingTimeId = hfVotingTimeId.Value; //voc.StartDate = DateTime.ParseExact(txtStartDate.Text, "dd/MM/yyyy", null);//DateTime.Parse(txtStartDate.Text); //if (Session["StartDate"] != null) voc.StartDate = DateTime.Parse(Session["StartDate"].ToString()); //cldStartDate.SelectedDate; //else //voc.StartDate = DateTime.ParseExact(txtStartDate.Text, "dd/MM/yyyy", null); //voc.EndDate = DateTime.ParseExact(txtEndDate.Text, "dd/MM/yyyy", null);//DateTime.Parse(txtEndDate.Text); voc.EndDate = DateTime.Parse(Session["EndDate"].ToString());//cldEndDate.SelectedDate; voc.Title = txtTitle.Text; if (btnSave.Text == "Save") { voc.Flag = (int)MPOP_Dashboard_Enum.StoredProcedureType.Insert; } else if (btnSave.Text == "Update") { voc.Flag = (int)MPOP_Dashboard_Enum.StoredProcedureType.Update; } else if (btnSave.Text == "Delete") { voc.Flag = (int)MPOP_Dashboard_Enum.StoredProcedureType.Delete; } }
protected void btnSave_Click(object sender, EventArgs e) { if (cldStartDate.SelectedDate != DateTime.Parse("1/1/0001 12:00:00 AM") && cldEndDate.SelectedDate != DateTime.Parse("1/1/0001 12:00:00 AM")) { MPOP_Dashboard.MPOP_Dashoard_Class mpop_dashboard_class = new MPOP_Dashoard_Class(); MPOP_Dashboard.VoteOpeningandClosingEntry voc = new MPOP_Dashboard.VoteOpeningandClosingEntry(); DataExtract(voc); db.sp_MPOP_Dashboard_VotingOpeningandClosing_CRUD( voc.VotingTimeId, voc.StartDate, voc.EndDate, voc.Title, voc.Flag ); //PageClear(); Response.Redirect("VoteOpeningandClosing_List.aspx?"); } else { lblMessage.Text = "Please choose start date and end date!"; } }