コード例 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Crime_HistoryObject cbiObject = new Crime_HistoryObject();
            CrimeInformationService cisObj = new CrimeInformationService();

            try
            {
                cbiObject.RefNo = txtRefNo.Text;
                cbiObject.CrimeType = ddlCrimeType.SelectedValue;
                cbiObject.Description = txtDescription.Text;
                cbiObject.CrimeCode = txtCrimeCode.Text;
                cbiObject.CrimeDate = Convert.ToDateTime(txtCrimeDate.Text);
                cbiObject.CreateBy = User.Identity.Name;
                cbiObject.CreateDate = DateTime.Now;
                cbiObject.LastUpdateBy = User.Identity.Name;
                cbiObject.LastUpdateDate = DateTime.Now;
                if (cisObj.InsertCrimeHistory(cbiObject))
                {
                    Response.Redirect("crime-case-details.aspx?refno=" + txtRefNo.Text);
                }
            }
            catch (Exception ex)
            {
                ErrorMessage.Text = ex.Message;
            }
        }
コード例 #2
0
        /// <summary>
        /// Insert Crime History Information using this fuction
        /// </summary>
        /// <returns></returns>
        public bool InsertCrimeHistory(Crime_HistoryObject chObject)
        {
            clsBase baseObj = new clsBase();

            string sqlstring = "INSERT INTO [Crime_History] ([RefNo],[CrimeType],[Description],[CrimeCode],[CrimeDate]" +
                               ",[CreateBy],[CreateDate],[LastUpdateBy],[LastUpdateDate]) VALUES (@RefNo," +
                               "@CrimeType,@Description,@CrimeCode,@CrimeDate,@CreateBy,@CreateDate," +
                               "@LastUpdateBy,@LastUpdateDate)";

            List<SqlParameter> parametersList = new List<SqlParameter>();
            parametersList.Add(new SqlParameter("@RefNo", chObject.RefNo));
            parametersList.Add(new SqlParameter("@CrimeType", chObject.CrimeType));
            parametersList.Add(new SqlParameter("@Description", chObject.Description));
            parametersList.Add(new SqlParameter("@CrimeCode", chObject.CrimeCode));
            parametersList.Add(new SqlParameter("@CrimeDate", chObject.CrimeDate));
            parametersList.Add(new SqlParameter("@CreateBy", chObject.CreateBy));
            parametersList.Add(new SqlParameter("@CreateDate", chObject.CreateDate));
            parametersList.Add(new SqlParameter("@LastUpdateBy", chObject.LastUpdateBy));
            parametersList.Add(new SqlParameter("@LastUpdateDate", chObject.LastUpdateDate));

            return baseObj.InsertData(sqlstring, parametersList);
        }