コード例 #1
0
        public bool QuestionHead(QuestionHead obj)
        {
            Connect();

            SqlCommand cmd = new SqlCommand("IUQuestionHead", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@HospitalID", HospitalID);
            cmd.Parameters.AddWithValue("@LocationID", LocationID);

            if (obj.QuestionHeadID == 0)
            {
                cmd.Parameters.AddWithValue("@QuestionHeadID", 0);
                cmd.Parameters.AddWithValue("@Mode", "Add");
            }
            else
            {
                cmd.Parameters.AddWithValue("@QuestionHeadID", obj.QuestionHeadID);
                cmd.Parameters.AddWithValue("@Mode", "Edit");
            }


            if (obj.ReferenceCode == null)
            {
                cmd.Parameters.AddWithValue("@ReferenceCode", string.Empty);
            }
            else
            {
                cmd.Parameters.AddWithValue("@ReferenceCode", obj.ReferenceCode);
            }

            cmd.Parameters.AddWithValue("@QuestionHeadName", obj.QuestionHeadName);

            cmd.Parameters.AddWithValue("@CreationID", UserID);


            con.Open();
            int i = cmd.ExecuteNonQuery();

            con.Close();
            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
 public ActionResult QuestionHead(QuestionHead obj)
 {
     try
     {
         BL_QuestionHead questionhead2 = new BL_QuestionHead();
         if (questionhead2.CheckQuestionHead(obj.QuestionHeadID, obj.QuestionHeadName))
         {
             if (questionhead2.QuestionHead(obj))
             {
                 ModelState.Clear();
                 ViewData["flag"] = "Done";
             }
         }
         else
         {
             ViewData["flag"] = "Error";
         }
         return(View());
     }
     catch (Exception)
     {
         return(View());
     }
 }