コード例 #1
0
        private void AddNewAppointment(object sender, EventArgs e)
        {
            //int day = (int)((FlowLayoutPanel)sender).Tag;
            int day = (int)((Label)sender).Tag;

            if (day != 0 && day < 100)    //was needed before changing event clickable to label
            {
                {
                    var withBlock = new manageAppointment();
                    withBlock.AppID            = 0;
                    withBlock.txtCustomer.Text = "";
                    withBlock.txtAddress.Text  = "";
                    withBlock.txtComment.Text  = "";
                    withBlock.dtpDate.Value    = new DateTime(currentDate.Year, currentDate.Month, day);
                    withBlock.ShowDialog();
                }

                DisplayCurrentDate();
            }

            /*else if (day != 0 && day < 200)
             * {
             *  {
             *      var withBlock = new manageAppointment();
             *      withBlock.AppID = 0;
             *      withBlock.txtCustomer.Text = "";
             *      withBlock.txtAddress.Text = "";
             *      withBlock.txtComment.Text = "";
             *      withBlock.dtpDate.Value = new DateTime(currentDate.Year, currentDate.AddMonths(-1).Month, (day-100));
             *      withBlock.ShowDialog();
             *  }
             *
             *  DisplayCurrentDate();
             * }*/
        }
コード例 #2
0
        private void ShowAppointmentDetail(object sender, EventArgs e)
        {
            int       appID = (int)((LinkLabel)sender).Tag;
            string    sql   = $"select * from Appointments where ID = {appID}";
            DataTable dt    = QueryAsDataTable(sql);

            if (dt.Rows.Count > 0)
            {
                DataRow row = dt.Rows[0];
                {
                    var withBlock = new manageAppointment();
                    withBlock.AppID            = appID;
                    withBlock.txtCustomer.Text = row["ContactName"].ToString();
                    withBlock.txtAddress.Text  = row["Address"].ToString();
                    withBlock.txtComment.Text  = row["Comment"].ToString();
                    withBlock.dtpDate.Value    = DateTime.Parse(row["AppDate"].ToString());
                    withBlock.ShowDialog();
                }

                DisplayCurrentDate();
            }
        }