Ejemplo n.º 1
0
        public string updateString(string childId, string parameterId, string creator, string type, string value, string order, string status)
        {
            string response            = "";
            List <parameterClass> list = new List <parameterClass>();

            try
            {
                if (parameterId == null || parameterId.Length <= 5)
                {
                    //  Do Stuff
                    parametercreate para = new parametercreate();
                    para.childId = new Guid(childId);
                    para.creator = new Guid(creator);
                    para.type    = type;
                    parameterId  = create(para);
                }

                parameterClass parameter = new parameterClass();
                parameter.childId     = new Guid(childId);
                parameter.parameterId = new Guid(parameterId);
                parameter.creator     = new Guid(creator);
                parameter.type        = type;
                parameter.value       = value;
                parameter.order       = order;

                list.Add(parameter);
                response = update(list);
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
            return(response);
        }
Ejemplo n.º 2
0
        public List <parameterClass> read(Guid childId)
        {
            List <parameterClass> response = new List <parameterClass>();

            try
            {
                SqlConnection con = new SqlConnection(data);
                SqlCommand    cmd = new SqlCommand("SELECT * FROM courseParameter WHERE childId = @childId ORDER BY parameterOrder ASC", con);
                cmd.Parameters.AddWithValue("@childId", childId);
                SqlDataReader Dr;
                con.Open();
                Dr = cmd.ExecuteReader();
                while (Dr.Read())
                {
                    parameterClass parameter = new parameterClass();
                    parameter.creator      = new Guid(Dr["creator"].ToString());
                    parameter.type         = Dr["type"].ToString();
                    parameter.value        = Dr["value"].ToString();
                    parameter.parameterId  = new Guid(Dr["parameterId"].ToString());
                    parameter.childId      = childId;
                    parameter.order        = Dr["parameterOrder"].ToString();
                    parameter.status       = Dr["status"].ToString();
                    parameter.additional_1 = Dr["additional_1"].ToString();
                    parameter.additional_2 = Dr["additional_2"].ToString();
                    parameter.additional_3 = Dr["additional_3"].ToString();
                    parameter.additional_4 = Dr["additional_4"].ToString();
                    response.Add(parameter);
                }
                con.Close();
            }
            catch (SqlException ex)
            {
                //  Log error
                parameterClass parameter = new parameterClass();
                parameter.value = ex.ToString();
                response.Add(parameter);
            }
            catch (Exception ex)
            {
                //  Log error
                parameterClass parameter = new parameterClass();
                parameter.value = ex.ToString();
                response.Add(parameter);
            }
            return(response);
        }
Ejemplo n.º 3
0
 public List <parameterClass> readString(string childId)
 {
     if (childId == null || childId.Length <= 0)
     {
         return(new List <parameterClass>());
     }
     try
     {
         List <parameterClass> response = read(new Guid(childId));
         return(response);
     }
     catch (Exception ex)
     {
         List <parameterClass> response  = read(new Guid(childId));
         parameterClass        parameter = new parameterClass();
         parameter.value = ex.ToString();
         response.Add(parameter);
         return(response);
     }
 }