add all change in now.
This commit is contained in:
@@ -10,9 +10,26 @@ public class Seed
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
public int InsertOneUser()
|
||||
|
||||
public int InsertOneUser()
|
||||
{
|
||||
int id = -1;
|
||||
string sptext = "CREATE OR REPLACE FUNCTION public.usp_search_user( " +
|
||||
" iemail character varying,ifirstname character varying,ilastname character varying) " +
|
||||
" RETURNS TABLE(id integer, fistname character varying, lastname character varying, email character varying," +
|
||||
" stype integer, sactive boolean, srole integer, spassword character varying) " +
|
||||
" AS $$ BEGIN " +
|
||||
" return query SELECT e.id, e.firstname, e.lastname, e.email, e.stype," +
|
||||
" e.sactive, e.srole, e.spassword " +
|
||||
" FROM public.staff e " +
|
||||
" WHERE (iemail = '' or e.email ilike iemail || '%') " +
|
||||
" and (ilastname = '' or e.lastname ilike ilastname || '%') " +
|
||||
" and (ifirstname = '' or e.firstname ilike ifirstname || '%'); "+
|
||||
"END; " +
|
||||
" $$ " +
|
||||
" LANGUAGE 'plpgsql'; ";
|
||||
|
||||
|
||||
int id = -1;
|
||||
//password = password
|
||||
string txt = " INSERT INTO staff ( " +
|
||||
"firstname, lastname, email, phone, stype, srole, spassword, sactive) " +
|
||||
@@ -20,8 +37,9 @@ public class Seed
|
||||
" ( 'kham', 'vilaythong', 'kham.vilaythong@gmail.com', '009', 1, 2, 'cGFzc3dvcmQ=', true), " +
|
||||
" ( 'sy', 'vilaythong', 'sy.vilaythong@gmail.com', '007', 1, 2, 'cGFzc3dvcmQ=', true), " +
|
||||
" ( 'Hung', 'Nguyen', 'hung.gnuyen@gmail.com', '008', 1, 2, 'cGFzc3dvcmQ=', true); ";
|
||||
string workertxt = "INSERT INTO person ( firstname, lastname,email,phone,address,dob ,alive, fatherId, image, sex)" +
|
||||
"VALUES " +
|
||||
|
||||
string workertxt = "INSERT INTO person ( firstname, lastname,email,phone,address,dob ,alive, fatherId, image, sex) " +
|
||||
" VALUES " +
|
||||
" ('Ho 1','Tran', 'Ho.Tran@hotmail.com', '002', '1 Cabramatta','1960-09-01', true, 0,'', 'M'), " +
|
||||
" ('Jimmy 2','Tran', 'Ho.Tran@hotmail.com', '003', '34 Cabramatta','1980-09-01', true, 1,'','M'), " +
|
||||
" ('Joe 3','Tran', 'Joe.Tran@hotmail.com', '006', '32 Cabramatta','1980-10-01', true, 1,'','M'), " +
|
||||
@@ -51,6 +69,11 @@ public class Seed
|
||||
|
||||
conn.Open();
|
||||
var command = conn.CreateCommand();
|
||||
command.CommandText = sptext;
|
||||
command.CommandType = System.Data.CommandType.Text;
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
command = conn.CreateCommand();
|
||||
command.CommandText = txt;
|
||||
command.CommandType = System.Data.CommandType.Text;
|
||||
command.ExecuteNonQuery();
|
||||
@@ -74,9 +97,10 @@ public class Seed
|
||||
id = 1;
|
||||
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
id = -10;
|
||||
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user