Esempio n. 1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        MonitorMotorInfo    info   = new MonitorMotorInfo(ID);
        MonitorPersonHelper helper = new MonitorPersonHelper();

        if (!string.IsNullOrEmpty(ID))
        {
            info.MotorNO   = txtName.Text;
            info.StartDate = DateTime.Parse(txtStart.Text);
            if (!string.IsNullOrEmpty(txtEnd.Text))
            {
                info.EndDate = DateTime.Parse(txtEnd.Text);
            }
            info.MotorType = ddlType.SelectedValue;
            helper.UpdateMonitorMotor(info);
        }
        else
        {
            info.ID        = Guid.NewGuid().ToString();
            info.MotorNO   = txtName.Text;
            info.StartDate = DateTime.Parse(txtStart.Text);
            if (!string.IsNullOrEmpty(txtEnd.Text))
            {
                info.EndDate = DateTime.Parse(txtEnd.Text);
            }
            info.MotorType = ddlType.SelectedValue;
            info.CreatedBy = SysContext.CurrentUserID.ToString();
            info.CreatedOn = DateTime.Now;
            info.Status    = "A";
            helper.AddMonitorMotor(info);
        }

        ScriptManager.RegisterStartupScript(btnSave, btnSave.GetType(), "success", "SubmitDialog();", true);
    }
Esempio n. 2
0
        public static AjaxResult RemoveMonitorPerson(string ID)
        {
            MonitorPersonHelper helper = new MonitorPersonHelper();

            helper.DeleteMonitorPerson(ID);
            return(AjaxResult.Success());
        }