public void Save_EngagementSchedule(string type, int schedule_engid)
        {
            SaveTempScheduleDetails();
            DataTable dt = (DataTable)ViewState["temptable"];
            string schedule_type, schedule_days, schedule_stime, schedule_endtime, notes;
            Nullable<DateTime> schedulde_date;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                schedulde_date = Convert.ToDateTime(dt.Rows[i]["schedule_date"]);
                schedule_type = dt.Rows[i]["schedule_type"].ToString();
                schedule_days = dt.Rows[i]["schedule_day"].ToString();
                schedule_stime = dt.Rows[i]["schedule_st_time"].ToString();
                schedule_endtime = dt.Rows[i]["schedule_end_time"].ToString();
                notes = dt.Rows[i]["schedule_notes"].ToString();
                ScheduleData objsch = new ScheduleData();
                if (Convert.ToInt32(dt.Rows[i]["schedule_id"]) == 0)
                {
                    objsch.Engagementschedule_Insert(schedule_engid, schedule_type, schedulde_date, schedule_days, schedule_stime, schedule_endtime, notes);
                }

                //    objsch.Engagementschedule_Update(schedule_id, schedule_engid, schedule_type, schedulde_date, schedule_days, schedule_stime, schedule_endtime, notes);

            }
            //Response.Redirect("~/Engagement.aspx?engmtid=" + schedule_engid.ToString() + "&status=1");
        }
        public void SaveTempScheduleDetails()
        {
            CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
            TextInfo textInfo = cultureInfo.TextInfo;
            if (trfooter.Visible == true)
            {
                string schedule_type, schedule_days, schedule_stime, schedule_endtime, notes;
                Nullable<DateTime> schedulde_date;
                schedulde_date = Convert.ToDateTime(txtscheduedate.Text);
                schedule_type = ddlscheduletype.SelectedItem.Text;
                schedule_days = textInfo.ToTitleCase(Convert.ToDateTime(txtscheduedate.Text).DayOfWeek.ToString().Substring(0, 3));
                schedule_stime = Convert.ToString(txtschedule_sttime.Text);
                schedule_endtime = Convert.ToString(txtschedule_endtime.Text);
                notes = txtschedulenotes.Text;
                ScheduleData objsch = new ScheduleData();
                string msg = objsch.Engagementschedule_Insert(engagementid, schedule_type, schedulde_date, schedule_days, schedule_stime, schedule_endtime, notes);
                if (msg == "")
                {
                    bindScheduleDetails(Convert.ToInt32(engagementid));
                }
                else
                {
                    lbl_msg.Text = msg;
                    lbl_msg.ForeColor = System.Drawing.Color.Orange;
                }

            }
        }