예제 #1
0
    private void FillGrid(int locationID)
    {
        DataTable table = BALBlockedAppointments.SelectBlockAppointment("selectall", 0, locationID);

        gvAdminList.DataSource = table;
        gvAdminList.DataBind();
        if (gvAdminList.Rows.Count > 0)
        {
            lblsearch2.Visible = true;
        }
        else
        {
            lblsearch2.Visible = false;
        }
    }
예제 #2
0
    private void GetRecords(int Id, int locationID)
    {
        DataTable table = BALBlockedAppointments.SelectBlockAppointment("selectbyid", Id, locationID);
        {
            txtblockcal.Text    = Convert.ToString(table.Rows[0]["appblockdate"]);
            txtDescription.Text = Convert.ToString(table.Rows[0]["appblcokdesc"]);

            string[] strFrom = Convert.ToString(table.Rows[0]["appblockfrom"]).Split(' ');

            ddlFrom.SelectedValue     = strFrom[0].Split(':')[0];
            ddlFromAMPM.SelectedValue = strFrom[1];

            string[] strTo = Convert.ToString(table.Rows[0]["appblockto"]).Split(' ');

            ddlTo.SelectedValue     = strTo[0].Split(':')[0];
            ddlToAMPM.SelectedValue = strTo[1];
            //txtZone.Text = Convert.ToString(table.Rows[0]["ZoneName"]);
            ddlBranchName.SelectedValue = Convert.ToString(table.Rows[0]["branchId"]);

            chkIsClosed.Checked = Convert.ToBoolean(table.Rows[0]["IsClosed"]);
        }
    }
예제 #3
0
    protected void ddlChooseBranch_SelectedIndexChanged(object sender, EventArgs e)
    {
        log.Debug("Into ChooseBranch");
        Session["branchname"] = ddlChooseBranch.SelectedItem.Text;

        DataTable dtBrachtiming = BAL_branchtime.GetTiming(ddlChooseBranch.SelectedItem.Value);

        ViewState["LocationData"] = dtBrachtiming;

        ddlAvailabletimeslot.Items.Clear();
        ddlChoosedate.Items.Clear();

        // date selection
        //ddlChoosedate.Items.Add(new ListItem("Please select date", "-1"));
        DataTable dtApDate = new DataTable();

        dtApDate.Columns.Add("ApDate", Type.GetType("System.DateTime"));

        DataTable dtAppBlockDate = new DataTable();

        //dtAppBlockDate = BALBlockedAppointments.SelectBlockAppointment("appstatus", 0, int.Parse(ddlChooseBranch.SelectedItem.Value));
        dtAppBlockDate = BALBlockedAppointments.SelectBlockAppointment("appstatuslocationwise", 0, int.Parse(ddlChooseBranch.SelectedItem.Value));

        ViewState["BlockDate"] = dtAppBlockDate;

        for (int selecteddate = 0; selecteddate < 14; selecteddate++)
        {
            foreach (DataRow dr in dtBrachtiming.Rows)
            {
                if (!Convert.ToBoolean(dr["IsClosed"]))
                {
                    if (dr["WorkingHoursFrom"].ToString() != dr["WorkingHoursTo"].ToString())
                    {
                        //select the date using the week
                        string   strDay      = dr["WorkingDay"].ToString();
                        DateTime currentdate = System.DateTime.Now;
                        currentdate = currentdate.AddDays(selecteddate);
                        //Response.Write("<br>" + currentdate.Date.DayOfWeek.ToString().ToLower() + " " + strDay.ToString().ToLower());

                        //check the blockdate
                        Boolean Isblocked = false;
                        foreach (DataRow item in dtAppBlockDate.Rows)
                        {
                            //if (Convert.ToDateTime(item["appdate"].ToString()) == currentdate)
                            if (Convert.ToDateTime(item["appdate"].ToString()).ToShortDateString() == currentdate.ToShortDateString())
                            {
                                if (item["op"].ToString().ToLower() == "Restrict".ToLower())
                                {
                                    Isblocked = true;
                                }
                            }
                        }

                        if (currentdate.Date.DayOfWeek.ToString().ToLower() == strDay.ToLower())
                        {
                            if (!Isblocked)
                            {
                                if (Session["branchname"].ToString().ToLower() == "swansea")
                                {
                                    if (currentdate.CompareTo(DateTime.Parse("02/12/2013")) <= 0)
                                    {
                                        DataRow drAp = dtApDate.NewRow();
                                        drAp["ApDate"] = currentdate.ToShortDateString();
                                        dtApDate.Rows.Add(drAp);
                                    }
                                }
                                else
                                {
                                    DataRow drAp = dtApDate.NewRow();
                                    drAp["ApDate"] = currentdate.ToShortDateString();
                                    dtApDate.Rows.Add(drAp);
                                }
                            }
                        }
                    }
                }
            }
        }
        DataView dvAp = dtApDate.DefaultView;

        dvAp.Sort = "Apdate ASC";

        foreach (DataRowView item in dvAp)
        {
            ddlChoosedate.Items.Add(new ListItem(((DateTime)item[0]).ToShortDateString(), ((DateTime)item[0]).Date.ToShortDateString()));
        }

        ddlChoosedate.Items.Insert(0, new ListItem("Please select date", "-1"));
        //timing selection
        ddlAvailabletimeslot.Items.Insert(0, new ListItem("Please select time", "-1"));

        log.Debug("Done Choosebranch");
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            log.Debug("Into IsPostBack");

            imgCarPhoto.Src = "~/getcarimage.aspx";

            ////get the brach information
            //DataTable dtLocation = BAL_location.GetCMSByCMSId(0);
            //string strBranchinformation = dtLocation.Rows[0]["LocationName"].ToString();
            //hdnId.Value = dtLocation.Rows[0]["LocationId"].ToString();
            DataTable dt  = BAL_location.GetCMSByCMSId(0);
            DataRow   tdr = dt.NewRow();
            tdr[0] = "0";
            tdr[1] = "Please select";
            dt.Rows.InsertAt(tdr, 0);
            ddlChooseBranch.DataSource     = dt;
            ddlChooseBranch.DataValueField = dt.Columns["LocationId"].ToString();
            ddlChooseBranch.DataTextField  = dt.Columns["LocationName"].ToString();
            ddlChooseBranch.DataBind();

            Session["branchname"] = ddlChooseBranch.SelectedItem.Text;

            DataTable dtBrachtiming = BAL_branchtime.GetTiming(ddlChooseBranch.SelectedItem.Value);
            ViewState["LocationData"] = dtBrachtiming;

            ddlAvailabletimeslot.Items.Clear();
            ddlChoosedate.Items.Clear();

            // date selection
            //ddlChoosedate.Items.Add(new ListItem("Please select date", "-1"));
            DataTable dtApDate = new DataTable();
            dtApDate.Columns.Add("ApDate", Type.GetType("System.DateTime"));

            DataTable dtAppBlockDate = new DataTable();
            dtAppBlockDate = BALBlockedAppointments.SelectBlockAppointment("appstatus", 0, int.Parse(ddlChooseBranch.SelectedItem.Value));

            ViewState["BlockDate"] = dtAppBlockDate;

            for (int selecteddate = 0; selecteddate < 14; selecteddate++)
            {
                foreach (DataRow dr in dtBrachtiming.Rows)
                {
                    if (dr["WorkingHoursFrom"].ToString() != dr["WorkingHoursTo"].ToString())
                    {
                        //select the date using the week
                        string   strDay      = dr["WorkingDay"].ToString();
                        DateTime currentdate = System.DateTime.Now;
                        currentdate = currentdate.AddDays(selecteddate);
                        //Response.Write("<br>" + currentdate.Date.DayOfWeek.ToString().ToLower() + " " + strDay.ToString().ToLower());

                        //check the blockdate
                        Boolean Isblocked = false;
                        foreach (DataRow item in dtAppBlockDate.Rows)
                        {
                            //if (Convert.ToDateTime(item["appdate"].ToString()) == currentdate)
                            if (Convert.ToDateTime(item["appdate"].ToString()).ToShortDateString() == currentdate.ToShortDateString())
                            {
                                if (item["op"].ToString().ToLower() == "Restrict".ToLower())
                                {
                                    Isblocked = true;
                                }
                            }
                        }

                        if (currentdate.Date.DayOfWeek.ToString().ToLower() == strDay.ToLower())
                        {
                            if (!Isblocked)
                            {
                                if (Session["branchname"].ToString().ToLower() == "swansea")
                                {
                                    if (currentdate.CompareTo(DateTime.Parse("02/12/2013")) <= 0)
                                    {
                                        DataRow drAp = dtApDate.NewRow();
                                        drAp["ApDate"] = currentdate.ToShortDateString();
                                        dtApDate.Rows.Add(drAp);
                                    }
                                }
                                else
                                {
                                    DataRow drAp = dtApDate.NewRow();
                                    drAp["ApDate"] = currentdate.ToShortDateString();
                                    dtApDate.Rows.Add(drAp);
                                }
                            }
                        }
                    }
                }
            }
            DataView dvAp = dtApDate.DefaultView;
            dvAp.Sort = "Apdate ASC";

            foreach (DataRowView item in dvAp)
            {
                ddlChoosedate.Items.Add(new ListItem(((DateTime)item[0]).ToShortDateString(), ((DateTime)item[0]).Date.ToShortDateString()));
            }

            ddlChoosedate.Items.Insert(0, new ListItem("Please select date", "-1"));
            //timing selection
            ddlAvailabletimeslot.Items.Insert(0, new ListItem("Please select time", "-1"));
        }

        ddlAvailabletimeslot.Visible = true;
        spanBooked.Visible           = false;
        hlCarButton.Visible          = true;
    }