Ejemplo n.º 1
0
        // Create a candidate
        public int InsertCandidate(CandidateModel candidateModel)
        {
            int        count = 0;
            SqlCommand cmd;

            Connection();
            cmd             = new SqlCommand("uspInsertCandidate", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@candidateId", candidateModel.CandidateId);
            cmd.Parameters.AddWithValue("@firstName", candidateModel.FirstName);
            cmd.Parameters.AddWithValue("@lastName", candidateModel.LastName);
            cmd.Parameters.AddWithValue("@manifesto", candidateModel.Manifesto);
            cmd.Parameters.AddWithValue("@imageUrl", candidateModel.ImageUrl);
            cmd.Parameters.AddWithValue("@previousHistory", candidateModel.PreviousHistory);
            cmd.Parameters.AddWithValue("@campaignId", candidateModel.CampaignId);
            cmd.Parameters.AddWithValue("@employeeId", candidateModel.EmployeeId);

            try
            {
                connection.Open();
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
            finally
            {
                connection.Close();
            }
            return(count);
        }
Ejemplo n.º 2
0
        private DataSet GetPreviousHistoryData(CandidateModel candidateModel)
        {
            DataSet   ds = new DataSet("Histories");
            DataTable dt = new DataTable("History");
            DataRow   row;

            dt.Columns.Add("Description");
            ds.Tables.Add(dt);
            string history = candidateModel.PreviousHistory;

            row = dt.NewRow();
            row["Description"] = history;
            dt.Rows.Add(row);
            ds.AcceptChanges();
            return(ds);
        }