예제 #1
0
        public bool AddEducationalTraining(Int64 subjectid, string institution, string location,
            string degree, string enddate, string fieldOfStudy, XmlDocument PropertyListXML)
        {
            ActivityLog(PropertyListXML, subjectid, institution + ", " + location + ", ", degree + ", " + enddate + ", " + fieldOfStudy);
            bool error = false;
            try
            {

                EducationalTrainingRequest eatr = new EducationalTrainingRequest();
                eatr.EducationalTrainingForID = new StoreNodeParam();
                eatr.EducationalTrainingForID.Value = subjectid;
                eatr.EducationalTrainingForID.ParamOrdinal = 0;

                eatr.Institution = new StoreNodeParam();
                eatr.Institution.Value = institution;
                eatr.Institution.ParamOrdinal = 1;

                eatr.Location = new StoreNodeParam();
                eatr.Location.Value = location;
                eatr.Location.ParamOrdinal = 2;

                eatr.Degree = new StoreNodeParam();
                eatr.Degree.Value = degree;
                eatr.Degree.ParamOrdinal = 3;

                eatr.EndDate = new StoreNodeParam();
                eatr.EndDate.Value = enddate;
                eatr.EndDate.ParamOrdinal = 4;

                eatr.FieldOfStudy = new StoreNodeParam();
                eatr.FieldOfStudy.Value = fieldOfStudy;
                eatr.FieldOfStudy.ParamOrdinal = 5;

                error = this.StoreEducationalTrainingReceipt(eatr);

            }
            catch (Exception e)
            {
                Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace);
                throw new Exception(e.Message);
            }

            return error;
        }
예제 #2
0
        private bool StoreEducationalTrainingReceipt(EducationalTrainingRequest eatr)
        {
            SessionManagement sm = new SessionManagement();
            string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString;

            SqlConnection dbconnection = new SqlConnection(connstr);

            SqlParameter[] param = new SqlParameter[eatr.Length];

            bool error = false;

            try
            {
                dbconnection.Open();

                if (eatr.ExistingEducationalTrainingURI != null)
                    param[eatr.ExistingEducationalTrainingURI.ParamOrdinal] = new SqlParameter("@ExistingEducationalTrainingURI", eatr.ExistingEducationalTrainingURI.Value);

                if (eatr.EducationalTrainingForID != null)
                    param[eatr.EducationalTrainingForID.ParamOrdinal] = new SqlParameter("@educationalTrainingForID", Convert.ToInt64(eatr.EducationalTrainingForID.Value));

                if (eatr.Institution != null)
                    param[eatr.Institution.ParamOrdinal] = new SqlParameter("@institution", eatr.Institution.Value.ToString());

                if (eatr.Location != null)
                    param[eatr.Location.ParamOrdinal] = new SqlParameter("@location", eatr.Location.Value.ToString());

                if (eatr.Degree != null)
                    param[eatr.Degree.ParamOrdinal] = new SqlParameter("@degree", eatr.Degree.Value.ToString());

                if (eatr.EndDate != null)
                    param[eatr.EndDate.ParamOrdinal] = new SqlParameter("@endDate", eatr.EndDate.Value.ToString());

                if (eatr.FieldOfStudy != null)
                    param[eatr.FieldOfStudy.ParamOrdinal] = new SqlParameter("@fieldOfStudy", eatr.FieldOfStudy.Value.ToString());

                param[eatr.Length - 3] = new SqlParameter("@sessionID", sm.Session().SessionID);

                param[eatr.Length - 2] = new SqlParameter("@error", null);
                param[eatr.Length - 2].DbType = DbType.Boolean;
                param[eatr.Length - 2].Direction = ParameterDirection.Output;

                param[eatr.Length - 1] = new SqlParameter("@nodeid", null);
                param[eatr.Length - 1].DbType = DbType.Int64;
                param[eatr.Length - 1].Direction = ParameterDirection.Output;

                // TODO
                SqlCommand comm = GetDBCommand(ref dbconnection, "[Edit.Module].[CustomEditEducationalTraining.StoreItem]", CommandType.StoredProcedure, CommandBehavior.CloseConnection, param);
                //For Output Parameters you need to pass a connection object to the framework so you can close it before reading the output params value.
                ExecuteSQLDataCommand(comm);

                comm.Connection.Close();

                if (dbconnection.State != ConnectionState.Closed)
                    dbconnection.Close();

                error = Convert.ToBoolean(param[eatr.Length - 2].Value);

                Framework.Utilities.Cache.AlterDependency(eatr.EducationalTrainingForID.Value.ToString());
            }
            catch (Exception e)
            {
                Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace);
                throw new Exception(e.Message);
            }

            return error;
        }
예제 #3
0
        public bool UpdateEducationalTraining(string existingTrainingURI, long subjectID, string institution, string location,
            string degree, string enddate, string fieldOfStudy)
        {
            bool error = false;
            try
            {
                EditActivityLog(subjectID, "http://vivoweb.org/ontology/core#educationalTraining", null, institution + ", " + location + ", ", degree + ", " + enddate + ", " + fieldOfStudy);

                string label = degree + " " + institution;

                EducationalTrainingRequest eatr = new EducationalTrainingRequest();
                eatr.ExistingEducationalTrainingURI = new StoreNodeParam();
                eatr.ExistingEducationalTrainingURI.Value = existingTrainingURI;
                eatr.ExistingEducationalTrainingURI.ParamOrdinal = 0;

                eatr.Institution = new StoreNodeParam();
                eatr.Institution.Value = institution;
                eatr.Institution.ParamOrdinal = 1;

                eatr.Location = new StoreNodeParam();
                eatr.Location.Value = location;
                eatr.Location.ParamOrdinal = 2;

                eatr.Degree = new StoreNodeParam();
                eatr.Degree.Value = degree;
                eatr.Degree.ParamOrdinal = 3;

                eatr.EndDate = new StoreNodeParam();
                eatr.EndDate.Value = enddate;
                eatr.EndDate.ParamOrdinal = 4;

                eatr.FieldOfStudy = new StoreNodeParam();
                eatr.FieldOfStudy.Value = fieldOfStudy;
                eatr.FieldOfStudy.ParamOrdinal = 5;

                eatr.EducationalTrainingForID = new StoreNodeParam();
                eatr.EducationalTrainingForID.Value = this.GetStoreNode(existingTrainingURI).ToString();
                eatr.EducationalTrainingForID.ParamOrdinal = 6;
                error = this.StoreEducationalTrainingReceipt(eatr);
            }
            catch (Exception e)
            {
                Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace);
                throw new Exception(e.Message);
            }

            return error;
        }