コード例 #1
0
        protected void btnStopScheduleType_Click(object sender, EventArgs e)
        {
            lblStopMessage.Text = string.Empty;
            if (drpStopScheduleType.SelectedValue == "0")
            {
                lblStopMessage.Text      = "Schedule Type Empty !";
                lblStopMessage.ForeColor = Color.Red;
                MPStopSchedule.Show();
            }
            else if (txtStopDate.Text == "")
            {
                lblStopMessage.Text      = "Stop Date empty!";
                lblStopMessage.ForeColor = Color.Red;
                MPStopSchedule.Show();
            }
            else if (drpTimeStopSchedule.SelectedValue == "")
            {
                lblStopMessage.Text      = "Stop Time empty!";
                lblStopMessage.ForeColor = Color.Red;
                MPStopSchedule.Show();
            }
            else
            {
                object         result;
                SqlParameter[] param = new SqlParameter[]
                {
                    new SqlParameter("@OPR", 16),
                    new SqlParameter("@ScheduleTypeId", drpStopScheduleType.SelectedValue),
                    new SqlParameter("@StoppageDate", Convert.ToString(txtStopDate.Text)),
                    new SqlParameter("@StoppageTime", Convert.ToString(drpTimeStopSchedule.SelectedValue)),
                    new SqlParameter("@StoppageBy", Convert.ToString(Session["username"])),
                    new SqlParameter("@CurrentStatus", 0)
                };

                result = DBClass.ExecuteScalar_WithParam(param, "DM_SP_DML_DATA");

                if (Convert.ToInt64(result) > 0)
                {
                    ViewState["Active"]      = null;
                    lblStopMessage.Text      = "Schedule Stop Run Success";
                    lblStopMessage.ForeColor = Color.Green;
                    ClearStopSchedule();
                    BindScheduleStatusGrid();
                    MPStopSchedule.Hide();
                }
                else if (Convert.ToInt64(result) == -1)
                {
                    lblStopMessage.Text      = "Error, Future Date time not allowed!";
                    lblStopMessage.ForeColor = Color.Red;
                    MPStopSchedule.Show();
                }
                else
                {
                    lblStopMessage.Text      = "Error, Something went wrong!";
                    lblStopMessage.ForeColor = Color.Red;
                    MPStopSchedule.Show();
                }
            }
        }
コード例 #2
0
 protected void btnStopSchedule_Click(Object Sender, EventArgs e)
 {
     lblStopMessage.Text = String.Empty;
     GetScheduleType(drpStopScheduleType);
     txtStopDate.Text = lbldate.Text;
     //txtStopDate.Attributes.Add("readonly", "true");
     BindTimeControl(drpTimeStopSchedule);
     MPStopSchedule.Show();
 }