コード例 #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DateTime     dateHosting  = DateTime.UtcNow;
            TimeZoneInfo indianZoneId = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
            DateTime     dateNow      = TimeZoneInfo.ConvertTimeFromUtc(dateHosting, indianZoneId);

            if (Request.QueryString["examinationId"] != null)
            {
                ExaminationCL examCL = new ExaminationCL();
                examCL.id           = Convert.ToInt32(Request.QueryString["examinationId"]);
                examCL.classId      = Convert.ToInt32(ddlClass.SelectedValue);
                examCL.name         = txtExamination.Text;
                examCL.dateCreated  = Convert.ToDateTime(txtDateCreated.Text);
                examCL.dateModified = dateNow;
                examCL.isDeleted    = false;
                ExaminationCL examReturn = examinationBLL.updateExamination(examCL);
                Response.Redirect("ManageExamination.aspx?examinationid=" + examReturn.id);
            }
            else
            {
                ExaminationCL examCL = new ExaminationCL();
                examCL.name         = txtExamination.Text;
                examCL.classId      = Convert.ToInt32(ddlClass.SelectedValue);
                examCL.dateCreated  = dateNow;
                examCL.dateModified = dateNow;
                examCL.isDeleted    = false;
                int examId = examinationBLL.addExamination(examCL);
                Response.Redirect("ManageExamination.aspx?examinationid=" + examId);
            }
        }