Example #1
0
    /* Bind Data is use to bind all information to this page that is user Appointment */

    public void BindData()
    {
        UserAppointment App = new UserAppointment();
        DataSet         ds  = new DataSet();
        DataTable       dt  = new DataTable();
        DataView        dv  = new DataView();

        ds = App.GetAllAppointment();
        if (ds.Tables[0].Rows.Count > 0)
        {
            dt = ds.Tables[0];
            dv = dt.DefaultView;
            if ((SortExpression != string.Empty) && (SortDirection != string.Empty))
            {
                dv.Sort = SortExpression + " " + SortDirection;
            }
            grdAppointment.DataSource = dv;
            grdAppointment.DataBind();
            btnDelete.Visible = true;
            lblError.Visible  = false;
            CheckAll();
            check();
            Utility.Setserial(grdAppointment, "srno");
        }
        else
        {
            btnDelete.Visible      = false;
            grdAppointment.Visible = false;
            ErrMessage("No record found");
        }
    }
Example #2
0
 public string BookAppointment(UserAppointment appointment)
 {
     //To Create New Appointment in your System
     return("For " + appointment.Name + " with Email ID : " + appointment.EmailId +
            " and Contact No : " + appointment.ContactNo +
            ", appointment is Booked on : " + appointment.AppointmentDate);
 }
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var req = controllerContext.HttpContext.Request;

            UserAppointment apt = new UserAppointment
            {
                Name            = req.Form["Name"],
                EmailId         = req.Form["EmailId"],
                ContactNo       = req.Form["ContactNo"],
                AppointmentDate = req.Form["Day"] + "/" + req.Form["Month"] + "/" + req.Form["Year"]
            };

            return(apt);
        }
Example #4
0
 protected void btnActiveInActive_Click1(object sender, EventArgs e)
 {
     try
     {
         string AppointmentID = Utility.GetCheckedRow(grdAppointment, "chkSelect");
         if (AppointmentID != "")
         {
             string[] arrIds = AppointmentID.Split(',');
             if (arrIds.Length > 0)
             {
                 foreach (string apptId in arrIds)
                 {
                     UserAppointment App = new UserAppointment();
                     App.ActiveInActiveAppointmentFromAdmin(int.Parse(apptId));
                 }
             }
             BindData();
             SuccesfullMessage("Appointment(s) Active/InActive successfully");
         }
     }
     catch  { }
 }
Example #5
0
 protected void btnExport_Click(object sender, EventArgs e)
 {
     try
     {
         UserAppointment App = new UserAppointment();
         DataSet         ds  = new DataSet();
         ds = App.GetAllAppointmentExport(Convert.ToDateTime(txtStartDate.Text.Trim()), Convert.ToDateTime(txtEndDate.Text.Trim()));
         if (ds.Tables[0].Rows.Count > 0)
         {
             DataTable dt = new DataTable();
             dt = ds.Tables[0];
             Response.ContentType = "Application/vnd.ms-msexcel";
             Response.AddHeader("content-disposition", "attachment;filename=Appointment.csv");
             Response.Write(ToCSV(dt));
             Response.End();
         }
         else
         {
             ErrMessage("No record found");
         }
     }
     catch  { }
 }
Example #6
0
    public void BindData()
    {
        UserAppointment App = new UserAppointment();
        DataSet         ds  = new DataSet();

        if (Request.QueryString["ID"] != null)
        {
            ds = App.GetAppointment(Convert.ToInt32(Request.QueryString["ID"].ToString()));
            #region Paid Ammount and Status
            string ExpectedTotalRevenue = "";
            if (ds.Tables.Count > 0)
            {
                #region Table 0
                if (ds.Tables[0].Rows.Count > 0)
                {
                    lblName.Text       = ds.Tables[0].Rows[0]["FullName"].ToString();
                    lblAddress.Text    = ds.Tables[0].Rows[0]["Address"].ToString();
                    lblPhone.Text      = ds.Tables[0].Rows[0]["Phone"].ToString();
                    txt1.Value         = ds.Tables[0].Rows[0]["AppointmentID"].ToString();
                    lblDate.Text       = ds.Tables[0].Rows[0]["Date"].ToString() + " " + ds.Tables[0].Rows[0]["T"].ToString();
                    lblConfirmBy.Text  = ds.Tables[0].Rows[0]["ConfirmBy"].ToString();
                    lblFlex.Text       = ds.Tables[0].Rows[0]["Flex"].ToString();
                    lblNote.Text       = ds.Tables[0].Rows[0]["Note"].ToString();
                    lblEmail.Text      = ds.Tables[0].Rows[0]["UserName"].ToString();
                    lblPetName.Text    = ds.Tables[0].Rows[0]["PetName"].ToString();
                    lblConfirm.Text    = ds.Tables[0].Rows[0]["ConfirmStatus"].ToString();
                    lblPaidStatus.Text = ds.Tables[0].Rows[0]["PaymentStatus"].ToString();

                    #region not Paid
                    if (ds.Tables[0].Rows[0]["PaymentStatus"].ToString() == "Pending")
                    {
                        #region set Revenue Amount set By Admin
                        if (ds.Tables[0].Rows[0]["Status"].ToString() == "Pending")
                        {
                            try
                            {
                                ExpectedTotalRevenue = ds.Tables[0].Rows[0]["ExpectedTotalRevenue"].ToString() != "" ?
                                                       ds.Tables[0].Rows[0]["ExpectedTotalRevenue"].ToString() : ds.Tables[0].Rows[0]["RevenueCreditCard"].ToString() != "" ?
                                                       ds.Tables[0].Rows[0]["RevenueCreditCard"].ToString() : ds.Tables[0].Rows[0]["RevenueCreditCard"].ToString() != "" ?
                                                       ds.Tables[0].Rows[0]["RevenueCreditCard"].ToString() : ds.Tables[0].Rows[0]["RevenueCash"].ToString() != "" ?
                                                       ds.Tables[0].Rows[0]["RevenueCash"].ToString() : ds.Tables[0].Rows[0]["RevenueInvoice"].ToString() != "" ?
                                                       ds.Tables[0].Rows[0]["RevenueInvoice"].ToString() : ds.Tables[0].Rows[0]["RevenueCCY"].ToString() != "" ?
                                                       ds.Tables[0].Rows[0]["RevenueCCY"].ToString() : "0.00";
                            }
                            catch
                            {
                                ExpectedTotalRevenue = "0.00";
                            }
                        }
                        #endregion set Revenue Amount set By Admin

                        #region set Revenue Amount set By Groomer
                        else if (ds.Tables[0].Rows[0]["Status"].ToString() == "Completed")
                        {
                            try
                            {
                                //if (ds.Tables[0].Rows[0]["PaymentStatus"].ToString() == "Paid")
                                //{
                                //    PaidStatus = "Paid";
                                //}
                                //else if (ds.Tables[0].Rows[0]["PaymentStatus"].ToString() == "Pending")
                                //{
                                //    PaidStatus = "Pending";
                                //}
                                if (ds.Tables[0].Rows[0]["RevAmt"].ToString() != "")
                                {
                                    ExpectedTotalRevenue = ds.Tables[0].Rows[0]["RevAmt"].ToString();
                                    ExpectedTotalRevenue = ExpectedTotalRevenue.Replace(".0000", ".00");
                                }
                                else if (ds.Tables[0].Rows[0]["RevAmt"].ToString() == "" || ds.Tables[0].Rows[0]["RevAmt"].ToString() == null)
                                {
                                    ExpectedTotalRevenue = "0.00";
                                }
                            }
                            catch
                            {
                                ExpectedTotalRevenue = "0.00";
                            }
                        }
                        #endregion set Revenue Amount set By Groomer

                        else
                        {
                            ExpectedTotalRevenue = "0.00";
                        }
                    }
                    #endregion not Paid

                    #region Paid Then Show the Paid Revenue

                    else if (ds.Tables[0].Rows[0]["PaymentStatus"].ToString() == "Paid")
                    {
                        if (ds.Tables[1].Rows.Count > 0)
                        {
                            ExpectedTotalRevenue = ds.Tables[1].Rows[0]["RevAmt"].ToString() != "" ? ds.Tables[1].Rows[0]["RevAmt"].ToString() : "0.00";
                        }
                    }
                    #endregion Paid Then Show the Paid Revenue


                    lblPaidAmount.Text = (string)"$ " + ExpectedTotalRevenue;
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            if (i != ds.Tables[0].Rows.Count - 1)
                            {
                                lblPetServices.Text += ds.Tables[0].Rows[i]["ServiceName"].ToString() + ",";
                            }
                            else
                            {
                                lblPetServices.Text += ds.Tables[0].Rows[i]["ServiceName"].ToString();
                            }
                        }
                    }
                    Session["SelectedDate"] = lblDate.Text;
                }
                #endregion Table 0
            }
            #endregion Paid Ammount and Status
            else
            {
                lblError.Text = "No record found";
            }
        }
    }
Example #7
0
        public List <Appointment> GetConflictingTimeSlots(Dictionary <string, List <Appointment> > userlist)
        {
            List <Appointment> conflictslots = new List <Appointment>();

            List <UserAppointment> userapts = new List <UserAppointment>();

            foreach (KeyValuePair <string, List <Appointment> > entry in userlist)
            {
                foreach (Appointment apt in entry.Value)
                {
                    userapts.Add(new UserAppointment(apt.StartTime, apt.EndTime, entry.Key));
                }
            }

            //we will have global list by username
            userapts.Sort(new UserAppointmentComparator());

            //we have the sorted list by apt start date

            UserAppointment overlapping = null;
            Hashtable       ht          = new Hashtable();

            for (int i = 0; i < userapts.Count; i++)
            {
                UserAppointment current = null;
                UserAppointment next    = null;

                if (overlapping == null)
                {
                    current = userapts[i];
                    next    = userapts[i + 1];
                }
                else
                {
                    current = overlapping;
                    next    = userapts[i];
                }

                //compare the two adjacent appointments

                //check for conflict (s1,e1) (s2, e2)  if conflict s2 < e1
                if (next.StartTime < current.EndTime)
                {
                    if (!ht.ContainsKey(userapts[i].Username))
                    {
                        ht.Add(userapts[i].Username, true);
                    }

                    if (overlapping == null)
                    {
                        if (!ht.ContainsKey(userapts[i + 1].Username))
                        {
                            ht.Add(userapts[i + 1].Username, true);
                        }

                        i++;
                    }

                    //overlapping.StartTime = Max(userapts[i - 1].StartTime, userapts[i].StartTime);
                    //overlapping.EndTime = Min(userapts[i - 1].StartTime, userapts[i].StartTime);
                    overlapping = new UserAppointment(Max(current.StartTime, next.StartTime), Min(current.EndTime, next.EndTime), string.Empty);
                }
                else
                {
                    //no conflict  end of this range so check the ht count

                    if (overlapping != null)
                    {
                        if (ht.Count == userlist.Count)
                        {
                            conflictslots.Add(new Appointment(overlapping.StartTime, overlapping.EndTime));
                        }
                        //reset
                        overlapping = null;
                        i--;
                    }

                    //Either way clear the hashtable
                    ht.Clear();
                }
            }

            //after end
            if (ht.Count == userlist.Count)
            {
                if (overlapping != null)
                {
                    conflictslots.Add(new Appointment(overlapping.StartTime, overlapping.EndTime));
                }
            }

            return(conflictslots);
        }