public static void doctorShiftSave(DoctorShiftsHL docshi) { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = Common.getConnection(); cmd.CommandText = "Doctor_Shift_Insert"; cmd.CommandType = System.Data.CommandType.StoredProcedure; //Shift Name SqlParameter sShiftsName = new SqlParameter("@shiftName", docshi.shiftName); sShiftsName.SqlDbType = System.Data.SqlDbType.NVarChar; cmd.Parameters.Add(sShiftsName); //From SqlParameter tFrom = new SqlParameter("@from", docshi.from); tFrom.SqlDbType = System.Data.SqlDbType.Time; cmd.Parameters.Add(tFrom); //To SqlParameter tTo = new SqlParameter("@to", docshi.to); tTo.SqlDbType = System.Data.SqlDbType.Time; cmd.Parameters.Add(tTo); cmd.ExecuteNonQuery(); } }
public static List <DoctorShiftsHL> getDoctorShifts() { List <DoctorShiftsHL> doctorShiftList = new List <DoctorShiftsHL>(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = Common.getConnection(); cmd.CommandText = "Doctor_Shift_Select"; cmd.CommandType = System.Data.CommandType.StoredProcedure; SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); for (int i = 0; i < dt.Rows.Count; i++) { DoctorShiftsHL ds = new DoctorShiftsHL(); ds.shiftId = Int32.Parse(dt.Rows[i]["shiftId"].ToString()); ds.shiftName = dt.Rows[i]["shiftName"].ToString(); ds.from = (TimeSpan)dt.Rows[i]["from"]; ds.to = (TimeSpan)dt.Rows[i]["to"]; doctorShiftList.Add(ds); } return(doctorShiftList); } }
public static void doctorShiftUpdate(DoctorShiftsHL docshi) { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = Common.getConnection(); cmd.CommandText = "Doctor_Shift_Update"; cmd.CommandType = System.Data.CommandType.StoredProcedure; //ShifId Integer param SqlParameter iShiftId = new SqlParameter("@shiftId", docshi.shiftId); iShiftId.SqlDbType = System.Data.SqlDbType.Int; cmd.Parameters.Add(iShiftId); //shiftName NVarChar param SqlParameter sShiftName = new SqlParameter("@shiftName", docshi.shiftName); sShiftName.SqlDbType = System.Data.SqlDbType.NVarChar; cmd.Parameters.Add(sShiftName); //from Time(2) param SqlParameter tFrom = new SqlParameter("@from", docshi.from); tFrom.SqlDbType = System.Data.SqlDbType.Time; cmd.Parameters.Add(tFrom); //to Time(2) param SqlParameter tTo = new SqlParameter("@to", docshi.to); tTo.SqlDbType = System.Data.SqlDbType.Time; cmd.Parameters.Add(tTo); cmd.ExecuteNonQuery(); } }
public static void doctorShiftDelete(DoctorShiftsHL docshi) { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = Common.getConnection(); cmd.CommandText = "Doctor_Shift_Delete"; cmd.CommandType = System.Data.CommandType.StoredProcedure; SqlParameter iShiftId = new SqlParameter("@shiftId", docshi.shiftId); iShiftId.SqlDbType = System.Data.SqlDbType.Int; cmd.Parameters.Add(iShiftId); cmd.ExecuteNonQuery(); } }
public static DataTable getDoctorShiftListById(DoctorShiftsHL docShift) { SqlCommand cmd = new SqlCommand(); SqlDataAdapter da = new SqlDataAdapter(); DataTable dt = new DataTable(); cmd.Connection = Common.getConnection(); cmd.CommandText = "Doctor_Shift_Search_Id"; cmd.CommandType = System.Data.CommandType.StoredProcedure; SqlParameter iShiftId = new SqlParameter("@shiftId", docShift.shiftId); iShiftId.SqlDbType = System.Data.SqlDbType.Int; cmd.Parameters.Add(iShiftId); da.SelectCommand = cmd; da.Fill(dt); return(dt); }
public static DataTable getDoctorShiftListByName(DoctorShiftsHL docShift) { SqlCommand cmd = new SqlCommand(); SqlDataAdapter da = new SqlDataAdapter(); DataTable dt = new DataTable(); cmd.Connection = Common.getConnection(); cmd.CommandText = "Doctor_Shift_Search_Name"; cmd.CommandType = System.Data.CommandType.StoredProcedure; SqlParameter sShiftName = new SqlParameter("@shiftName", docShift.shiftName); sShiftName.SqlDbType = System.Data.SqlDbType.NVarChar; cmd.Parameters.Add(sShiftName); da.SelectCommand = cmd; da.Fill(dt); return(dt); }