예제 #1
0
        public void Write(ReferredApplicant reffObj)
        {
            string        cs  = ConfigurationManager.ConnectionStrings["TaviscaSandwichConnectionString"].ConnectionString;
            SqlConnection con = new SqlConnection(cs);

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

            cmd.CommandType = CommandType.StoredProcedure;
            SqlParameter prm1  = new SqlParameter("@app_name", SqlDbType.NVarChar);
            SqlParameter prm2  = new SqlParameter("@experience", SqlDbType.Int);
            SqlParameter prm3  = new SqlParameter("@app_email", SqlDbType.NVarChar);
            SqlParameter prm4  = new SqlParameter("@qualification", SqlDbType.NVarChar);
            SqlParameter prm5  = new SqlParameter("@resume", SqlDbType.NVarChar);
            SqlParameter prm6  = new SqlParameter("@post", SqlDbType.NVarChar);
            SqlParameter prm7  = new SqlParameter("@dos", SqlDbType.Date);
            SqlParameter prm8  = new SqlParameter("@status", SqlDbType.NVarChar);
            SqlParameter prm9  = new SqlParameter("@ref_name", SqlDbType.NVarChar);
            SqlParameter prm10 = new SqlParameter("@ref_email", SqlDbType.NVarChar);



            prm1.Value  = reffObj.GetReferredEmployeeName();
            prm2.Value  = reffObj.GetExperianceInYears();
            prm3.Value  = reffObj.GetEmailAddress();
            prm4.Value  = reffObj.GetQualification();
            prm5.Value  = reffObj.GetResumePath();
            prm6.Value  = reffObj.GetPost();
            prm7.Value  = reffObj.GetDateOfSubmission();
            prm8.Value  = reffObj.GetApplicantStatus();
            prm9.Value  = reffObj.GetReferredEmployeeName();
            prm10.Value = reffObj.GetReferrentEmailId();


            cmd.Parameters.Add(prm1);
            cmd.Parameters.Add(prm2);
            cmd.Parameters.Add(prm3);
            cmd.Parameters.Add(prm4);
            cmd.Parameters.Add(prm5);
            cmd.Parameters.Add(prm6);
            cmd.Parameters.Add(prm7);
            cmd.Parameters.Add(prm8);
            cmd.Parameters.Add(prm9);
            cmd.Parameters.Add(prm10);


            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet        ds = new DataSet();

            da.Fill(ds, "InsertedRow");
        }
예제 #2
0
        public void Write(ReferredApplicant reffObj)
        {
            int             ReferralNo;
            Connection      d    = new Connection();
            OleDbConnection conn = d.GetConnection();

            conn.Open();
            OleDbCommand cm2 = new OleDbCommand("select MAX(ReferralNo) from [Sheet1$]", conn);

            ReferralNo = Convert.ToInt32(cm2.ExecuteScalar()) + 1;

            OleDbCommand cmd = new OleDbCommand("insert into [Sheet1$]  values(?,?,?,?,?,?,?,?,?)", conn);

            cmd.Parameters.Add("Referred_By", OleDbType.VarChar).Value       = reffObj.GetReferredEmployeeName();
            cmd.Parameters.Add("Name", OleDbType.VarChar).Value              = reffObj.GetApplicantName();
            cmd.Parameters.Add("Post", OleDbType.VarChar).Value              = reffObj.GetPost();
            cmd.Parameters.Add("Experience", OleDbType.Integer).Value        = reffObj.GetExperianceInYears();
            cmd.Parameters.Add("Email", OleDbType.VarChar).Value             = reffObj.GetEmailAddress();
            cmd.Parameters.Add("Resume", OleDbType.VarChar).Value            = reffObj.GetResumePath();
            cmd.Parameters.Add("ApplicationStatus", OleDbType.VarChar).Value = reffObj.GetApplicantStatus();
            cmd.Parameters.Add("ReferralNo", OleDbType.Integer).Value        = ReferralNo;
            cmd.Parameters.Add("Date_Of_Submission", OleDbType.Date).Value   = reffObj.GetDateOfSubmission();
            cmd.ExecuteNonQuery();
        }