コード例 #1
0
 public static request getRequestById(int id)
 {
     var result = new request();
     SqlDataReader myReader;
     using (var myConn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ChartConnection"].ConnectionString))
     {
         using (var myCmd = new SqlCommand("GetRequestByID " + id, myConn))
         {
             try
             {
                 myConn.Open();
                 myReader = myCmd.ExecuteReader();
                 if (myReader.HasRows)
                 {
                     while (myReader.Read())
                     {
                         result.id = (int)myReader["id"];
                         result.mar = (int)myReader["mar"];
                         result.login = (string)myReader["login"];
                         result.bu_id = (int)myReader["bu_id"];
                         result.part_id = (int)myReader["part_id"];
                         result.batch = (string)myReader["batch"];
                         result.run_det = (string)myReader["run_det"];
                         result.due_date = (DateTime)myReader["due_date"];
                         result.sta_id = (int)myReader["sta_id"];
                         result.pri_id = (int)myReader["pri_id"];
                         result.userID = (int)myReader["userID"];
                         result.act_due_date = (DateTime)myReader["act_due_date"];
                         result.meas_method = checkIfNull(myReader["meas_method"].ToString());
                         result.comment = checkIfNull(myReader["comment"].ToString());
                         result.work_req = checkIfNull(myReader["work_req"].ToString());
                         result.attachment = checkIfNull(myReader["attachment"].ToString());
                         result.aps_id = checkIfInt(myReader["aps_id"].ToString());
                         result.mac_id = checkIfInt(myReader["mac_id"].ToString());
                         result.rfr_id = checkIfInt(myReader["rfr_id"].ToString());
                         result.rework = Boolean.Parse(myReader["rework"].ToString());
                         result.include_full_fair_report_required = checkIfInt(myReader["include_full_fair_report_required"].ToString());
                         result.cad_compare_volume_graphics = checkIfInt(myReader["cad_compare_volume_graphics"].ToString());
                         result.volume_graphics = checkIfInt(myReader["volume_graphics"].ToString());
                         result.other_please_specify = checkIfInt(myReader["other_please_specify"].ToString());
                         result.cmm_measurement = checkIfInt(myReader["cmm_measurement"].ToString());
                         result.vmm_measurement = checkIfInt(myReader["vmm_measurement"].ToString());
                         result.ocps_comments = checkIfNull(myReader["ocps_comments"].ToString());
                     }
                 }
             }
             catch (Exception e)
             {
                 var x = e.ToString();
             }
         }
     }
     return result;
 }